From 4fa3e0ef444f1cf57b9b86e7d840694c5ef43f4d Mon Sep 17 00:00:00 2001 From: mglae Date: Sat, 4 Dec 2021 15:27:26 +0100 Subject: [PATCH 1/2] ncurses: build ncursesw for UTF-8 support - update to 6.3 - Update patches 001 (terminfo xterm) and 002 (alloc fallback) - add patch 003: fix USE_SCROLL_HINTS/USE_HASHMAP logic - add patch 004: fix configure option --with-pkg-config-libdir is broken for cross compilation - Add symbolic links of ncursesw to common ncurses lib and header files to allow all packages to be build. --- packages/devel/ncurses/package.mk | 20 ++++++++++++----- .../patches/ncurses-001-terminfo-xterm.patch | 22 +++++++++---------- .../patches/ncurses-002-alloc-fallbacks.patch | 13 +---------- .../patches/ncurses-003-fix_hints.patch | 18 +++++++++++++++ .../ncurses-004-fix_configure_pkgconfig.patch | 13 +++++++++++ 5 files changed, 57 insertions(+), 29 deletions(-) create mode 100644 packages/devel/ncurses/patches/ncurses-003-fix_hints.patch create mode 100644 packages/devel/ncurses/patches/ncurses-004-fix_configure_pkgconfig.patch diff --git a/packages/devel/ncurses/package.mk b/packages/devel/ncurses/package.mk index 0a1e4bc660..97736b5c15 100644 --- a/packages/devel/ncurses/package.mk +++ b/packages/devel/ncurses/package.mk @@ -3,15 +3,14 @@ # Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="ncurses" -PKG_VERSION="6.1-20181215" -PKG_SHA256="08b07c3e792961f300829512c283d5fefc0b1c421a57b76922c3d13303ed677d" +PKG_VERSION="6.3" +PKG_SHA256="97fc51ac2b085d4cde31ef4d2c3122c21abc217e9090a43a30fc5ec21684e059" PKG_LICENSE="MIT" PKG_SITE="http://www.gnu.org/software/ncurses/" -PKG_URL="http://invisible-mirror.net/archives/ncurses/current/ncurses-${PKG_VERSION}.tgz" +PKG_URL="http://invisible-mirror.net/archives/ncurses/ncurses-${PKG_VERSION}.tar.gz" PKG_DEPENDS_HOST="ccache:host" PKG_DEPENDS_TARGET="toolchain zlib ncurses:host" PKG_LONGDESC="A library is a free software emulation of curses in System V Release 4.0, and more." -# causes some segmentation fault's (dialog) when compiled with gcc's link time optimization. PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--without-ada \ @@ -54,11 +53,12 @@ PKG_CONFIGURE_OPTS_TARGET="--without-ada \ --disable-hashmap \ --disable-safe-sprintf \ --disable-scroll-hints \ - --disable-widec \ + --enable-widec \ --disable-echo \ --disable-warnings \ --disable-home-terminfo \ - --disable-assertions" + --disable-assertions \ + --enable-leaks" PKG_CONFIGURE_OPTS_HOST="--enable-termcap \ --with-termlib \ @@ -67,9 +67,17 @@ PKG_CONFIGURE_OPTS_HOST="--enable-termcap \ --without-manpages" post_makeinstall_target() { + local f cp misc/ncurses-config ${TOOLCHAIN}/bin chmod +x ${TOOLCHAIN}/bin/ncurses-config sed -e "s:\(['=\" ]\)/usr:\\1${PKG_ORIG_SYSROOT_PREFIX}/usr:g" -i ${TOOLCHAIN}/bin/ncurses-config rm -f ${TOOLCHAIN}/bin/ncurses6-config rm -rf ${INSTALL}/usr/bin + # create links to be compatible with any ncurses include path and lib names + ln -sf . ${SYSROOT_PREFIX}/usr/include/ncursesw + ln -sf . ${SYSROOT_PREFIX}/usr/include/ncurses + for f in form menu ncurses panel; do + ln -sf lib${f}w.a ${SYSROOT_PREFIX}/usr/lib/lib${f}.a + ln -sf ${f}w.pc ${SYSROOT_PREFIX}/usr/lib/pkgconfig/${f}.pc + done } diff --git a/packages/devel/ncurses/patches/ncurses-001-terminfo-xterm.patch b/packages/devel/ncurses/patches/ncurses-001-terminfo-xterm.patch index 030213be1e..3c2a9d0f0c 100644 --- a/packages/devel/ncurses/patches/ncurses-001-terminfo-xterm.patch +++ b/packages/devel/ncurses/patches/ncurses-001-terminfo-xterm.patch @@ -1,16 +1,16 @@ Remove recent xterm terminfo features to be compatible with other emulations ---- a/misc/terminfo.src 2018-12-21 18:53:11.000000000 +0100 -+++ a/misc/terminfo.src 2018-12-22 22:56:47.000000000 +0100 -@@ -4335,8 +4335,8 @@ xterm-xfree86|xterm terminal emulator (X - xterm-new|modern xterm terminal emulator, +--- a/misc/terminfo.src 2021-03-20 22:45:39.000000000 +0100 ++++ b/misc/terminfo.src 2021-06-01 23:53:10.335516419 +0200 +@@ -4808,8 +4808,8 @@ xterm-xfree86|xterm terminal emulator (X + xterm+nofkeys|building block for xterm fkey-variants, npc, - indn=\E[%p1%dS, kb2=\EOE, kcbt=\E[Z, kent=\EOM, -- rin=\E[%p1%dT, use=ansi+rep, use=ecma+strikeout, -- use=xterm+sm+1006, use=xterm+pcfkeys, use=xterm+tmux, -+ rin=\E[%p1%dT, use=ecma+strikeout, -+ use=xterm+sm+1005, use=xterm+pcfkeys, use=xterm+tmux, - use=xterm-basic, + kcbt=\E[Z, kent=\EOM, nel=\EE, use=ecma+index, +- use=ansi+rep, use=ecma+strikeout, use=vt420+lrmm, +- use=xterm+sm+1006, use=xterm+tmux, use=ecma+italics, ++ use=ecma+strikeout, use=vt420+lrmm, ++ use=xterm+sm+1005, use=xterm+tmux, use=ecma+italics, + use=xterm+keypad, use=xterm-basic, - # This fragment is for people who cannot agree on what the backspace key + # This version reflects the current xterm features. diff --git a/packages/devel/ncurses/patches/ncurses-002-alloc-fallbacks.patch b/packages/devel/ncurses/patches/ncurses-002-alloc-fallbacks.patch index 218e3a7b32..eaf093adb5 100644 --- a/packages/devel/ncurses/patches/ncurses-002-alloc-fallbacks.patch +++ b/packages/devel/ncurses/patches/ncurses-002-alloc-fallbacks.patch @@ -1,19 +1,8 @@ Fix freeing not allocated fallback entries by allocating a copy. ---- a/ncurses/tinfo/lib_setup.c 2018-11-24 23:13:16.000000000 +0100 -+++ b/ncurses/tinfo/lib_setup.c 2018-12-29 10:31:01.000000000 +0100 -@@ -756,6 +756,8 @@ TINFO_SETUP_TERM(TERMINAL **tp, - if (status != TGETENT_YES) { - const TERMTYPE2 *fallback = _nc_fallback2(tname); - -+ if (fallback) -+ fallback = _nc_copy_entry(fallback); - if (fallback) { - T(("found fallback entry")); - TerminalType(termp) = *fallback; --- a/ncurses/tinfo/tinfo_driver.c 2018-11-24 23:17:03.000000000 +0100 +++ b/ncurses/tinfo/tinfo_driver.c 2018-12-29 10:27:19.000000000 +0100 -@@ -172,6 +172,8 @@ drv_CanHandle(TERMINAL_CONTROL_BLOCK * T +@@ -180,6 +180,8 @@ drv_CanHandle(TERMINAL_CONTROL_BLOCK * T if (status != TGETENT_YES) { const TERMTYPE2 *fallback = _nc_fallback2(tname); diff --git a/packages/devel/ncurses/patches/ncurses-003-fix_hints.patch b/packages/devel/ncurses/patches/ncurses-003-fix_hints.patch new file mode 100644 index 0000000000..8462304867 --- /dev/null +++ b/packages/devel/ncurses/patches/ncurses-003-fix_hints.patch @@ -0,0 +1,18 @@ +Fix USE_SCROLL_HINTS/USE_HASHMAP logic + +--- a/ncurses/curses.priv.h 2018-12-16 02:16:58.000000000 +0100 ++++ a/ncurses/curses.priv.h 2021-05-30 00:12:14.086528124 +0200 +@@ -258,10 +258,9 @@ extern NCURSES_EXPORT(void *) _nc_memmov + /* + * Scroll hints are useless when hashmap is used + */ +-#if !USE_SCROLL_HINTS +-#if !USE_HASHMAP +-#define USE_SCROLL_HINTS 1 +-#else ++#if USE_SCROLL_HINTS ++#if USE_HASHMAP ++#undef USE_SCROLL_HINTS + #define USE_SCROLL_HINTS 0 + #endif + #endif diff --git a/packages/devel/ncurses/patches/ncurses-004-fix_configure_pkgconfig.patch b/packages/devel/ncurses/patches/ncurses-004-fix_configure_pkgconfig.patch new file mode 100644 index 0000000000..9223676c71 --- /dev/null +++ b/packages/devel/ncurses/patches/ncurses-004-fix_configure_pkgconfig.patch @@ -0,0 +1,13 @@ +Fix configure option --with-pkg-config-libdir is broken for cross compilation + +--- a/configure 2021-10-17 17:12:23.000000000 +0200 ++++ b/configure 2021-11-26 00:27:00.224815736 +0100 +@@ -4229,7 +4229,7 @@ echo $ECHO_N "checking for first directo + cf_pkg_config_path=none + for cf_config in $cf_search_path + do +- if test -d "$cf_config" ++ if test -n "$cf_config" + then + cf_pkg_config_path=$cf_config + break From 980e4d521ddd081688e2daf4fe13f9e7a826d82d Mon Sep 17 00:00:00 2001 From: mglae Date: Sat, 4 Dec 2021 15:55:23 +0100 Subject: [PATCH 2/2] mc: allow/enable ncursesw --- .../system-tools-depends/mc/package.mk | 1 - ...01-ticket_4200_ncurses_disable_widec.patch | 71 ------------------- 2 files changed, 72 deletions(-) delete mode 100644 packages/addons/addon-depends/system-tools-depends/mc/patches/mc-001-ticket_4200_ncurses_disable_widec.patch diff --git a/packages/addons/addon-depends/system-tools-depends/mc/package.mk b/packages/addons/addon-depends/system-tools-depends/mc/package.mk index 16ab4575d7..5f299192c3 100644 --- a/packages/addons/addon-depends/system-tools-depends/mc/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/mc/package.mk @@ -38,7 +38,6 @@ PKG_CONFIGURE_OPTS_TARGET=" \ pre_configure_target() { LDFLAGS+=" -lcrypto -lssl" - CFLAGS+=' -DNCURSES_WIDECHAR=0' } post_makeinstall_target() { diff --git a/packages/addons/addon-depends/system-tools-depends/mc/patches/mc-001-ticket_4200_ncurses_disable_widec.patch b/packages/addons/addon-depends/system-tools-depends/mc/patches/mc-001-ticket_4200_ncurses_disable_widec.patch deleted file mode 100644 index fe446847aa..0000000000 --- a/packages/addons/addon-depends/system-tools-depends/mc/patches/mc-001-ticket_4200_ncurses_disable_widec.patch +++ /dev/null @@ -1,71 +0,0 @@ -See https://midnight-commander.org/ticket/4200 - -diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c -index 5cddf5059..2c117ef4b 100644 ---- a/lib/tty/tty-ncurses.c -+++ b/lib/tty/tty-ncurses.c -@@ -560,6 +560,7 @@ tty_fill_region (int y, int x, int rows, int cols, unsigned char ch) - void - tty_colorize_area (int y, int x, int rows, int cols, int color) - { -+#ifdef ENABLE_SHADOWS - cchar_t *ctext; - wchar_t wch[10]; /* TODO not sure if the length is correct */ - attr_t attrs; -@@ -585,6 +586,13 @@ tty_colorize_area (int y, int x, int rows, int cols, int color) - } - - g_free (ctext); -+#else -+ (void) y; -+ (void) x; -+ (void) rows; -+ (void) cols; -+ (void) color; -+#endif /* ENABLE_SHADOWS */ - } - - /* --------------------------------------------------------------------------------------------- */ -diff --git a/lib/tty/tty-ncurses.h b/lib/tty/tty-ncurses.h -index d75df9533..8feb17ccd 100644 ---- a/lib/tty/tty-ncurses.h -+++ b/lib/tty/tty-ncurses.h -@@ -30,6 +30,11 @@ - #define NCURSES_CONST const - #endif - -+/* do not draw shadows if NCurses is built with --disable-widec */ -+#if defined(NCURSES_WIDECHAR) && NCURSES_WIDECHAR -+#define ENABLE_SHADOWS 1 -+#endif -+ - /*** typedefs(not structures) and defined constants **********************************************/ - - /*** enums ***************************************************************************************/ -diff --git a/lib/tty/tty-slang.h b/lib/tty/tty-slang.h -index c36785ffc..15fd00a94 100644 ---- a/lib/tty/tty-slang.h -+++ b/lib/tty/tty-slang.h -@@ -27,6 +27,8 @@ - #define COLS SLtt_Screen_Cols - #define LINES SLtt_Screen_Rows - -+#define ENABLE_SHADOWS 1 -+ - /*** enums ***************************************************************************************/ - - enum -diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c -index ed16d04dd..4c1f5ba84 100644 ---- a/src/filemanager/boxes.c -+++ b/src/filemanager/boxes.c -@@ -280,7 +280,9 @@ appearance_box_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm - switch (msg) - { - case MSG_INIT: -+#ifdef ENABLE_SHADOWS - if (!tty_use_colors ()) -+#endif - { - Widget *shadow; -