Skip to contentSkip to conversation

Ncurses wide support

PATCH New Gustavo Zacarias 2 participants 8 messages Sep 17, 2014 – Sep 18, 2014

lore
Share & tools
lore
#0 lore raw

v3 cover Ncurses wide support

This is the compiled series for ncurses wide support. Tested a while ago with an allyespackageconfig. Closes bug #6950

Changes for v2:
Make the static fix patch also do it for dynamic targets as well

Changes for v3:
Add alsa-utils & dialog fixes

Gustavo Zacarias (5):
package/ncurses: fixup library symlink for static libs
nano: enable ncursesw support
httping: enable ncurses support
alsa-utils: fixup ncurses config script
dialog: fixup ncurses config script

Jeremy Kerr (1):
package/ncurses: Allow building wide char support

 package/alsa-utils/alsa-utils.mk |  4 ++--
 package/dialog/dialog.mk         |  2 +-
 package/httping/httping.mk       |  3 ++-
 package/nano/nano.mk             |  9 +++++++--
 package/ncurses/Config.in        |  8 ++++++++
 package/ncurses/ncurses.mk       | 35 +++++++++++++++++++++++++++++++++--
 6 files changed, 53 insertions(+), 8 deletions(-)
Signature · 1 line
1.8.5.5
#1 lore raw

PATCH v3 1/6 package/ncurses: Allow building wide char support

From: Jeremy Kerr <[email protected]>

Allow ncurses to be configured with wide char support; this causes the libraries to be built with the 'w' suffix (eg libncursesw.so, libmenuw.so, etc), so we need to create a few symlinks.

---
 package/ncurses/Config.in  |  6 ++++++
 package/ncurses/ncurses.mk | 24 ++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)
package/ncurses/Config.in +6 -0
index e8ab710..b90ec9e 100644
@@ -10,6 +10,12 @@ config BR2_PACKAGE_NCURSES
 
 if BR2_PACKAGE_NCURSES
 
+config BR2_PACKAGE_NCURSES_WCHAR
+	bool "enable wide char support"
+	depends on BR2_USE_WCHAR
+	help
+	  Enable wide char & UTF-8 support in ncurses libraries
+
 config BR2_PACKAGE_NCURSES_TARGET_PANEL
 	bool "ncurses libpanel in target"
 	help
package/ncurses/ncurses.mk +22 -2
index 4bba8f1..bd2aac0 100644
@@ -12,7 +12,7 @@ HOST_NCURSES_DEPENDENCIES =
 NCURSES_PROGS = clear infocmp tabs tic toe tput tset
 NCURSES_LICENSE = MIT with advertising clause
 NCURSES_LICENSE_FILES = README
-NCURSES_CONFIG_SCRIPTS = ncurses5-config
+NCURSES_CONFIG_SCRIPTS = ncurses$(NCURSES_LIB_SUFFIX)5-config
 
 NCURSES_CONF_OPT = \
 	$(if $(BR2_PREFER_STATIC_LIB),--without-shared,--with-shared) \
@@ -36,6 +36,24 @@ ifeq ($(BR2_PACKAGE_BUSYBOX),y)
 	NCURSES_DEPENDENCIES += busybox
 endif
 
+ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
+NCURSES_CONF_OPT += --enable-widec
+NCURSES_LIB_SUFFIX = w
+
+define NCURSES_LINK_LIBS
+	for lib in $(NCURSES_LIBS-y); do \
+		ln -sf $${lib}$(NCURSES_LIB_SUFFIX).so \
+			$(1)/usr/lib/$${lib}.so; \
+	done
+endef
+
+NCURSES_LINK_TARGET_LIBS =  $(call NCURSES_LINK_LIBS, $(TARGET_DIR))
+NCURSES_LINK_STAGING_LIBS =  $(call NCURSES_LINK_LIBS, $(STAGING_DIR))
+
+NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_LIBS
+
+endif
+
 NCURSES_LIBS-y = libncurses
 NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_MENU) += libmenu
 NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_PANEL) += libpanel
@@ -56,7 +74,8 @@ endef
 ifneq ($(BR2_PREFER_STATIC_LIB),y)
 define NCURSES_INSTALL_TARGET_LIBS
 	for lib in $(NCURSES_LIBS-y); do \
-		cp -dpf $(NCURSES_DIR)/lib/$${lib}.so* $(TARGET_DIR)/usr/lib/; \
+		cp -dpf $(NCURSES_DIR)/lib/$${lib}$(NCURSES_LIB_SUFFIX).so* \
+			$(TARGET_DIR)/usr/lib/; \
 	done
 endef
 endif
@@ -74,6 +93,7 @@ endif
 define NCURSES_INSTALL_TARGET_CMDS
 	mkdir -p $(TARGET_DIR)/usr/lib
 	$(NCURSES_INSTALL_TARGET_LIBS)
+	$(NCURSES_LINK_TARGET_LIBS)
 	$(NCURSES_INSTALL_TARGET_PROGS)
 	ln -snf /usr/share/terminfo $(TARGET_DIR)/usr/lib/terminfo
 	mkdir -p $(TARGET_DIR)/usr/share/terminfo/x
Signature · 1 line
1.8.5.5
#2 lore raw

PATCH v3 2/6 package/ncurses: fixup library symlink for static libs

In reply to Gustavo Zacarias

As stated on the list we need to copy static libraries when doing static targets so add the logic for that.

Also exclude the wide option for blackfin flat since there seem to be toolchain issues with that combination - since it's a new feature option someone interested might look into it later.

---
 package/ncurses/Config.in  |  2 ++
 package/ncurses/ncurses.mk | 15 +++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
package/ncurses/Config.in +2 -0
index b90ec9e..3cc0a37 100644
@@ -13,6 +13,8 @@ if BR2_PACKAGE_NCURSES
 config BR2_PACKAGE_NCURSES_WCHAR
 	bool "enable wide char support"
 	depends on BR2_USE_WCHAR
+	# Build broken @ curses.priv.h with bad declarations
+	depends on !(BR2_bfin && BR2_BINFMT_FLAT)
 	help
 	  Enable wide char & UTF-8 support in ncurses libraries
 
package/ncurses/ncurses.mk +13 -2
index bd2aac0..81a3998 100644
@@ -40,15 +40,26 @@ ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
 NCURSES_CONF_OPT += --enable-widec
 NCURSES_LIB_SUFFIX = w
 
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
 define NCURSES_LINK_LIBS
 	for lib in $(NCURSES_LIBS-y); do \
+		ln -sf $${lib}$(NCURSES_LIB_SUFFIX).a \
+			$(1)/usr/lib/$${lib}.a; \
+	done
+endef
+else
+define NCURSES_LINK_LIBS
+	for lib in $(NCURSES_LIBS-y); do \
+		ln -sf $${lib}$(NCURSES_LIB_SUFFIX).a \
+			$(1)/usr/lib/$${lib}.a; \
 		ln -sf $${lib}$(NCURSES_LIB_SUFFIX).so \
 			$(1)/usr/lib/$${lib}.so; \
 	done
 endef
+endif
 
-NCURSES_LINK_TARGET_LIBS =  $(call NCURSES_LINK_LIBS, $(TARGET_DIR))
-NCURSES_LINK_STAGING_LIBS =  $(call NCURSES_LINK_LIBS, $(STAGING_DIR))
+NCURSES_LINK_TARGET_LIBS = $(call NCURSES_LINK_LIBS, $(TARGET_DIR))
+NCURSES_LINK_STAGING_LIBS = $(call NCURSES_LINK_LIBS, $(STAGING_DIR))
 
 NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_LIBS
 
Signature · 1 line
1.8.5.5
#3 lore raw

PATCH v3 3/6 nano: enable ncursesw support

In reply to Gustavo Zacarias

Enable support for ncurses widechar by specifying the proper ncursesw-config when it's enabled, otherwise keep the old trick in place when it's not to avoid automatically picking up the host/distro one.

---
 package/nano/nano.mk | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
package/nano/nano.mk +7 -2
index 9557a93..038aaa5 100644
@@ -9,11 +9,16 @@ NANO_VERSION = $(NANO_VERSION_MAJOR).6
 NANO_SITE = http://www.nano-editor.org/dist/v$(NANO_VERSION_MAJOR)
 NANO_LICENSE = GPLv3+
 NANO_LICENSE_FILES = COPYING
-NANO_MAKE_ENV = CURSES_LIB="-lncurses"
 NANO_CONF_OPT = --without-slang
-NANO_CONF_ENV = ac_cv_prog_NCURSESW_CONFIG=false
 NANO_DEPENDENCIES = ncurses
 
+ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
+	NANO_CONF_ENV += ac_cv_prog_NCURSESW_CONFIG="$(STAGING_DIR)/usr/bin/ncursesw5-config"
+else
+	NANO_CONF_ENV += ac_cv_prog_NCURSESW_CONFIG=false
+	NANO_MAKE_ENV += CURSES_LIB="-lncurses"
+endif
+
 ifeq ($(BR2_PACKAGE_FILE),y)
 	NANO_DEPENDENCIES += file
 else
Signature · 1 line
1.8.5.5
#4 lore raw

PATCH v3 4/6 httping: enable ncurses support

In reply to Gustavo Zacarias

Enable automatic ncurses support now that we've got wide support.

---
 package/httping/httping.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/httping/httping.mk +2 -1
index ca636c0..719b0db 100644
@@ -15,11 +15,12 @@ HTTPING_LDFLAGS = $(TARGET_LDFLAGS) \
 HTTPING_DEPENDENCIES = host-gettext \
 	$(if $(BR2_NEEDS_GETTEXT),gettext) \
 	$(if $(BR2_PACKAGE_LIBICONV),libiconv) \
+	$(if $(BR2_PACKAGE_NCURSES_WCHAR),ncurses) \
 	$(if $(BR2_PACKAGE_OPENSSL),openssl) \
 	$(if $(BR2_PACKAGE_FFTW),fftw)
 HTTPING_MAKE_OPT = $(TARGET_CONFIGURE_OPTS) \
 	FW=$(if $(BR2_PACKAGE_FFTW),yes,no) \
-	NC=no \
+	NC=$(if $(BR2_PACKAGE_NCURSES_WCHAR),yes,no) \
 	SSL=$(if $(BR2_PACKAGE_OPENSSL),yes,no) \
 	TFO=$(if $(BR2_PACKAGE_HTTPING_TFO),yes,no)
 
Signature · 1 line
1.8.5.5
#5 lore raw

PATCH v3 5/6 alsa-utils: fixup ncurses config script

In reply to Gustavo Zacarias

Point the build to the proper (which BTW was broken since it pointed to the wrong directory) ncurses config by using $(NCURSES_CONFIG_SCRIPTS) from the ncurses package directly.
Also select the proper variant (widec/non-widec) in configure.

---
 package/alsa-utils/alsa-utils.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/alsa-utils/alsa-utils.mk +2 -2
index 4536b07..2afd6f9 100644
@@ -14,11 +14,11 @@ ALSA_UTILS_DEPENDENCIES = host-gettext host-pkgconf alsa-lib \
 	$(if $(BR2_PACKAGE_NCURSES),ncurses)
 
 ALSA_UTILS_CONF_ENV = \
-	ac_cv_prog_ncurses5_config=$(STAGING_DIR)/bin/ncurses5-config
+	ac_cv_prog_ncurses5_config=$(STAGING_DIR)/usr/bin/$(NCURSES_CONFIG_SCRIPTS)
 
 ALSA_UTILS_CONF_OPT = \
 	--disable-xmlto \
-	--with-curses=ncurses
+	--with-curses=$(if $(BR2_PACKAGE_NCURSES_WCHAR),ncursesw,ncurses)
 
 ifneq ($(BR2_PACKAGE_ALSA_UTILS_ALSAMIXER),y)
 ALSA_UTILS_CONF_OPT += --disable-alsamixer --disable-alsatest
Signature · 1 line
1.8.5.5
#6 lore raw

PATCH v3 6/6 dialog: fixup ncurses config script

In reply to Gustavo Zacarias

Point the build to the proper ncurses config script by using $(NCURSES_CONFIG_SCRIPTS) from the ncurses package directly.

---
 package/dialog/dialog.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/dialog/dialog.mk +1 -1
index 9af56e7..b5a8c60 100644
@@ -17,6 +17,6 @@ ifneq ($(BR2_ENABLE_LOCALE),y)
 DIALOG_DEPENDENCIES += libiconv
 endif
 
-DIALOG_CONF_OPT += NCURSES_CONFIG=$(STAGING_DIR)/usr/bin/ncurses5-config
+DIALOG_CONF_OPT += NCURSES_CONFIG=$(STAGING_DIR)/usr/bin/$(NCURSES_CONFIG_SCRIPTS)
 
 $(eval $(autotools-package))
Signature · 1 line
1.8.5.5
#7 lore raw

v3 cover Ncurses wide support

In reply to Gustavo Zacarias
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Gustavo" == Gustavo Zacarias <[email protected]> writes:

This is the compiled series for ncurses wide support. Tested a while ago with an allyespackageconfig. Closes bug #6950

Committed series, thanks.

Signature · 1 line
Bye, Peter Korsgaard