Skip to contentSkip to conversation

Ncurses wide support

PATCH Superseded Gustavo Zacarias 3 participants 9 messages Aug 19, 2014 – Aug 20, 2014

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Ncurses wide support

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

Gustavo Zacarias (3):
package/ncurses: fixup wide support for static targets
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 | 33 +++++++++++++++++++++++++++++++--
 4 files changed, 48 insertions(+), 5 deletions(-)
Signature · 1 line
1.8.5.5
#1 lore raw

PATCH 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 2/4 package/ncurses: fixup wide support for static targets

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 | 9 +++++++++
 2 files changed, 11 insertions(+)
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 +9 -0
index bd2aac0..5eb8b98 100644
@@ -40,12 +40,21 @@ 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).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))
Signature · 1 line
1.8.5.5
#3 lore raw

PATCH 2/4 package/ncurses: fixup wide support for static targets

Quoted 39 lines · 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 | 9 +++++++++
 2 files changed, 11 insertions(+)
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 +5 -0
index bd2aac0..5eb8b98 100644
@@ -40,12 +40,21 @@ 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; \

package/ncurses/ncurses.mk ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y) · line 57

Quoted 10 lines
package/ncurses/ncurses.mk +4 -0
+       done
+endef
+else
 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
+endif

Here you could also do something like
ifeq ($(BR2_PREFER_STATIC_LIB),y)
NCURSES_LIB_EXT = .a
else
NCURSES_LIB_EXT = .so
endif
define NCURSES_LINK_LIBS

       for lib in $(NCURSES_LIBS-y); do \
               ln -sf $${lib}$(NCURSES_LIB_SUFFIX)$(NCURSES_LIB_EXT) \
                       $(1)/usr/lib/$${lib}$(NCURSES_LIB_EXT); \
       done

endef
to avoid duplicating the hook content.

Best regards,
Thomas

#4 lore raw

PATCH 2/4 package/ncurses: fixup wide support for static targets

Dear Thomas De Schampheleire,

Quoted 7 lines · Thomas De Schampheleire

Here you could also do something like
ifeq ($(BR2_PREFER_STATIC_LIB),y)
NCURSES_LIB_EXT = .a
else
NCURSES_LIB_EXT = .so
endif
define NCURSES_LINK_LIBS

Quoted 6 lines
       for lib in $(NCURSES_LIBS-y); do \
               ln -sf $${lib}$(NCURSES_LIB_SUFFIX)$(NCURSES_LIB_EXT) \
                       $(1)/usr/lib/$${lib}$(NCURSES_LIB_EXT); \
       done

endef
to avoid duplicating the hook content.

Except that for now, the semantic is:

* BR2_PREFER_STATIC_LIB=y -> install only static libraries

* BR2_PREFER_STATIC_LIB undefined -> install *both* static and shared libraries.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH 2/4 package/ncurses: fixup wide support for static targets

Hi Thomas,

Quoted 18 lines · Thomas Petazzoni

Dear Thomas De Schampheleire,

Quoted 7 lines · Thomas De Schampheleire

Here you could also do something like
ifeq ($(BR2_PREFER_STATIC_LIB),y)
NCURSES_LIB_EXT = .a
else
NCURSES_LIB_EXT = .so
endif
define NCURSES_LINK_LIBS

Quoted 6 lines
       for lib in $(NCURSES_LIBS-y); do \
               ln -sf $${lib}$(NCURSES_LIB_SUFFIX)$(NCURSES_LIB_EXT) \
                       $(1)/usr/lib/$${lib}$(NCURSES_LIB_EXT); \
       done

endef
to avoid duplicating the hook content.

Quoted 6 lines

Except that for now, the semantic is:

* BR2_PREFER_STATIC_LIB=y -> install only static libraries

* BR2_PREFER_STATIC_LIB undefined -> install *both* static and shared libraries.

Unless I'm missing something that is not what Gustavo's patch does. He explicitly added an else clause. So if STATIC_LIB is not defined, only links for the .so file will be created.

Best regards,
Thomas

#6 lore raw

PATCH 2/4 package/ncurses: fixup wide support for static targets

Quoted 10 lines · Thomas De Schampheleire
Quoted 6 lines

Except that for now, the semantic is:

* BR2_PREFER_STATIC_LIB=y -> install only static libraries

* BR2_PREFER_STATIC_LIB undefined -> install *both* static and shared libraries.

Unless I'm missing something that is not what Gustavo's patch does. He explicitly added an else clause. So if STATIC_LIB is not defined, only links for the .so file will be created.

Hi, true, i'll respin a new fix to get both done when !static. The spirit was to fix the static case omission, even though it works for dynamic it departs from what it should do.
Regards.

#7 lore raw

PATCH 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
#8 lore raw

PATCH 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