Skip to contentSkip to conversation

Ncurses wide support

PATCH Superseded Gustavo Zacarias 2 participants 7 messages Aug 20, 2014 – Sep 15, 2014

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 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

Gustavo Zacarias (3):
package/ncurses: fixup library symlink for static libs
nano: enable ncursesw support
httping: enable ncurses support

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

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

PATCH v2 1/4 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 v2 1/4 package/ncurses: Allow building wide char support

Quoted 37 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

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 +0 -0
index 4bba8f1..bd2aac0 100644

package/ncurses/ncurses.mk HOST_NCURSES_DEPENDENCIES = · line 15

Quoted 5 lines
package/ncurses/ncurses.mk +1 -1
@@ -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

You don't seem to add a ncursesw5-config -> ncurses5-config symlink, but we explicitly refer to ncurses5-config in several places (and some configure scripts probably also expects it):

package/alsa-utils/alsa-utils.mk: ac_cv_prog_ncurses5_config=$(STAGING_DIR)/bin/ncurses5-config
package/dialog/dialog.mk:DIALOG_CONF_OPT += NCURSES_CONFIG=$(STAGING_DIR)/usr/bin/ncurses5-config

Quoted 9 lines
package/ncurses/ncurses.mk +3 -0
 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

package/ncurses/ncurses.mk ifeq ($(BR2_PACKAGE_BUSYBOX),y) · line 51

Quoted 10 lines
package/ncurses/ncurses.mk +10 -0
+
+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))

What's with this extra whitespace? I see it gets fixed up in patch 2, but we might as well do it right in patch 1 instead.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH v2 1/4 package/ncurses: Allow building wide char support

Quoted 6 lines · Peter Korsgaard

You don't seem to add a ncursesw5-config -> ncurses5-config symlink, but we explicitly refer to ncurses5-config in several places (and some configure scripts probably also expects it):

package/alsa-utils/alsa-utils.mk: ac_cv_prog_ncurses5_config=$(STAGING_DIR)/bin/ncurses5-config
package/dialog/dialog.mk:DIALOG_CONF_OPT += NCURSES_CONFIG=$(STAGING_DIR)/usr/bin/ncurses5-config

Hi.
Well to begin with it's not my patch :)
Usually ncurses5 + ncursesw5 configs are used when you need ABI compatibility which isn't our case (and both libraries built side by side). According to my tests (allyespackageconfig) other than the packages i've sent fixes for before/with this set it all works smoothly.
Also packages that don't know about widec support usually don't look for the non-w variant.

Quoted 2 lines

What's with this extra whitespace? I see it gets fixed up in patch 2, but we might as well do it right in patch 1 instead.

As i've said before, not my patch, just fixed the issue.
I went for a followup patch rather than rebase Jeremy's patch in case he sent a new version, which never happened of course.
Regards.

#4 lore raw

PATCH v2 2/4 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
#5 lore raw

PATCH v2 3/4 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
#6 lore raw

PATCH v2 4/4 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