From c2e600e53977ee7fee6e25ecce0b366cc8be6347 Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 19 Dec 2018 19:22:35 -0500 Subject: project: custom config: handle all ncurses-related bits at config-time. --- project/config/cfgdefs.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++--- project/depends.mk | 4 ---- 2 files changed, 52 insertions(+), 7 deletions(-) (limited to 'project') diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh index f184cb3..492dd3f 100644 --- a/project/config/cfgdefs.sh +++ b/project/config/cfgdefs.sh @@ -114,15 +114,56 @@ cfgdefs_perform_common_tests() cfgtest_cflags_append '-DHAVE_GETRANDOM_SYSCALL' fi + # ncurses + cfgtest_newline + cfgtest_comment 'ncurses/ncursesw' + mb_cfgtest_headers='ncurses.h' + + if [ $mb_cfgtest_cfgtype = 'target' ]; then + mb_cfgtest_makevar='CFLAGS_NCURSES' + else + mb_cfgtest_makevar='NATIVE_CC_CFLAGS' + fi + + cfgtest_unit_header_presence 'curses.h' + cfgtest_unit_header_presence 'ncurses.h' + + cfgtest_unit_header_presence 'ncurses/panel.h' && mb_panel_wrapper='yes' + cfgtest_unit_header_presence 'ncursesw/panel.h' && mb_panel_wrapper='yes' + + if cfgtest_unit_interface_presence 'is_term_resized'; then + cfgtest_makevar_append '-DHAVE_CURSES_IS_TERM_RESIZED' + fi + + if cfgtest_unit_interface_presence 'resizeterm'; then + cfgtest_makevar_append '-DHAVE_CURSES_RESIZETERM' + fi + + if cfgtest_unit_interface_presence 'resize_term'; then + cfgtest_makevar_append '-DHAVE_CURSES_RESIZE_TERM' + fi + + # ncursesw + if cfgtest_unit_interface_presence 'mvwget_wch'; then + cfgtest_makevar_append '-DHAVE_NCURSESW' + fi + # ncurses: python refers to members of typedef struct _win_st WINDOW - cfgtest_cflags_append '-DNCURSES_INTERNALS' + cfgtest_makevar_append '-DNCURSES_INTERNALS' + + # + if [ -n "$mb_panel_wrapper" ]; then + cfgtest_makevar_append '-I$(PROJECT_DIR)/wrappers' + unset mb_panel_wrapper + fi # ncurses libs (common part) mb_ncurses_libs='-lpanelw -lncursesw' mb_ncurses_tinfo='-ltinfo' - cfgtest_library_presence $mb_ncurses_tinfo \ - && mb_ncurses_libs="$mb_ncurses_libs $mb_ncurses_tinfo" + if cfgtest_library_presence $mb_ncurses_tinfo; then + mb_ncurses_libs="$mb_ncurses_libs $mb_ncurses_tinfo" + fi } @@ -138,6 +179,14 @@ cfgdefs_perform_target_tests() mb_cfgtest_makevar='LDFLAGS_NCURSES_LIBS' cfgtest_makevar_append $mb_ncurses_libs + mb_cfgtest_makevar='LDFLAGS_NCURSES' + cfgtest_makevar_append \ + '-Wl,--as-needed $(LDFLAGS_NCURSES_LIBS)' \ + '-Wl,--no-as-needed' + + mb_cfgtest_makevar='LDFLAGS_NCURSES_STATIC' + cfgtest_makevar_append '$(LDFLAGS_NCURSES)' + # ndbm cfgtest_newline cfgtest_comment 'ndbm' diff --git a/project/depends.mk b/project/depends.mk index ff056a1..e5fe7d5 100644 --- a/project/depends.mk +++ b/project/depends.mk @@ -1,7 +1,4 @@ # shared extensions: dependency switches -CFLAGS_NCURSES = -I$(SYSROOT)/usr/local/include/ncurses -I$(SYSROOT)/usr/include/ncurses -LDFLAGS_NCURSES = -Wl,--as-needed $(LDFLAGS_NCURSES_LIBS) -Wl,--no-as-needed - CFLAGS_SQLITE = -I$(SYSROOT)/usr/local/include/sqlite3 -I$(SYSROOT)/usr/include/sqlite3 CFLAGS_SQLITE += -DMODULE_NAME=\"sqlite3\" CFLAGS_SQLITE += -DSQLITE_OMIT_LOAD_EXTENSION @@ -16,7 +13,6 @@ LDFLAGS_DBM = -lgdbm_compat # static extensions: dependency switch LDFLAGS_PYEXT_STATIC = -lssl -lcrypto -lreadline -lbz2 -lgdbm -lffi -lintl -lz -LDFLAGS_NCURSES_STATIC = $(LDFLAGS_NCURSES) LDFLAGS_SQLITE_STATIC = $(LDFLAGS_SQLITE) LDFLAGS_EXPAT_STATIC = $(LDFLAGS_EXPAT) LDFLAGS_DBM_STATIC = $(LDFLAGS_DBM) -- cgit v1.2.3