diff options
author | midipix <writeonce@midipix.org> | 2018-12-19 19:22:35 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-12-19 20:16:28 -0500 |
commit | c2e600e53977ee7fee6e25ecce0b366cc8be6347 (patch) | |
tree | 48cbb041c9fb3eafdbc1c1cce02fac9bac0acc28 | |
parent | 817f377b77db3ab144d10f188e95dd70332852df (diff) | |
download | sbpython2-c2e600e53977ee7fee6e25ecce0b366cc8be6347.tar.bz2 sbpython2-c2e600e53977ee7fee6e25ecce0b366cc8be6347.tar.xz |
project: custom config: handle all ncurses-related bits at config-time.
-rw-r--r-- | profiles/osapi/modern.h | 5 | ||||
-rw-r--r-- | project/config/cfgdefs.sh | 55 | ||||
-rw-r--r-- | project/depends.mk | 4 | ||||
-rw-r--r-- | wrappers/panel.h | 7 |
4 files changed, 59 insertions, 12 deletions
diff --git a/profiles/osapi/modern.h b/profiles/osapi/modern.h index da13d99..4aedf4e 100644 --- a/profiles/osapi/modern.h +++ b/profiles/osapi/modern.h @@ -30,7 +30,6 @@ #define HAVE_SYS_WAIT_H 1 /* libc and third-party headers */ -#define HAVE_CURSES_H 1 #define HAVE_DLFCN_H 1 #define HAVE_ERRNO_H 1 #define HAVE_FCNTL_H 1 @@ -39,7 +38,6 @@ #define HAVE_LANGINFO_H 1 #define HAVE_LIBINTL_H 1 #define HAVE_MEMORY_H 1 -#define HAVE_NCURSES_H 1 #define HAVE_POLL_H 1 #define HAVE_PTHREAD_H 1 #define HAVE_PTY_H 1 @@ -72,9 +70,6 @@ #define HAVE_CONFSTR 1 #define HAVE_COPYSIGN 1 #define HAVE_CTERMID 1 -#define HAVE_CURSES_IS_TERM_RESIZED 1 -#define HAVE_CURSES_RESIZETERM 1 -#define HAVE_CURSES_RESIZE_TERM 1 #define HAVE_DECL_ISFINITE 1 #define HAVE_DECL_ISINF 1 #define HAVE_DECL_ISNAN 1 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' + + # <panel.h> + 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) diff --git a/wrappers/panel.h b/wrappers/panel.h new file mode 100644 index 0000000..307a4e6 --- /dev/null +++ b/wrappers/panel.h @@ -0,0 +1,7 @@ +#ifdef HAVE_NCURSESW_PANEL_H +#include <ncursesw/panel.h> +#else +#ifdef HAVE_NCURSES_PANEL_H +#include <ncurses/panel.h> +#endif +#endif |