Skip to contentSkip to conversation

ncurses: add support for 256 colors

PATCH New Thierry Bultel 3 participants 6 messages Dec 9, 2014 – Dec 12, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ncurses: add support for 256 colors

---
 package/ncurses/Config.in  |  7 +++++++
 package/ncurses/ncurses.mk | 14 +++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
package/ncurses/Config.in +7 -0
index 44713f9..8d0a4b7 100644
@@ -38,4 +38,11 @@ config BR2_PACKAGE_NCURSES_TARGET_PROGS
 	help
 	  Include ncurses programs in target (clear, reset, tput, ...)
 
+config BR2_PACKAGE_NCURSES_EXT_COLORS
+	bool "ncurses extended colors"
+	select BR2_PACKAGE_NCURSES_WCHAR
+	depends on BR2_USE_WCHAR
+	help
+	  compile for 256-color support
+
 endif
package/ncurses/ncurses.mk +13 -1
index e7bd967..262ac94 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 = ncurses$(NCURSES_LIB_SUFFIX)5-config
+NCURSES_CONFIG_SCRIPTS = ncurses$(NCURSES_LIB_SUFFIX)$(NCURSES_ABI_VERSION)-config
 
 NCURSES_CONF_OPTS = \
 	$(if $(BR2_PREFER_STATIC_LIB),--without-shared,--with-shared) \
@@ -107,6 +107,17 @@ define NCURSES_INSTALL_TARGET_PROGS
 endef
 endif
 
+ifeq ($(BR2_PACKAGE_NCURSES_EXT_COLORS),y)
+NCURSES_CONF_OPTS += --enable-ext-colors
+NCURSES_ABI_VERSION = 6
+define NCURSES_INSTALL_TARGET_256_COLORS_TERMINFO
+	cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm+256color $(TARGET_DIR)/usr/share/terminfo/x
+	cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-256color $(TARGET_DIR)/usr/share/terminfo/x
+endef
+else
+NCURSES_ABI_VERSION = 5
+endif
+
 define NCURSES_INSTALL_TARGET_CMDS
 	mkdir -p $(TARGET_DIR)/usr/lib
 	$(NCURSES_INSTALL_TARGET_LIBS)
@@ -117,6 +128,7 @@ define NCURSES_INSTALL_TARGET_CMDS
 	cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm $(TARGET_DIR)/usr/share/terminfo/x
 	cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-color $(TARGET_DIR)/usr/share/terminfo/x
 	cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-xfree86 $(TARGET_DIR)/usr/share/terminfo/x
+	$(NCURSES_INSTALL_TARGET_256_COLORS_TERMINFO)
 	mkdir -p $(TARGET_DIR)/usr/share/terminfo/v
 	cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt100 $(TARGET_DIR)/usr/share/terminfo/v
 	cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt102 $(TARGET_DIR)/usr/share/terminfo/v
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 ncurses: add support for 256 colors

package/ncurses/Config.in config BR2_PACKAGE_NCURSES_TARGET_PROGS · line 47

Quoted 7 lines · Thierry Bultel
package/ncurses/Config.in +7 -0
+config BR2_PACKAGE_NCURSES_EXT_COLORS
+	bool "ncurses extended colors"
+	select BR2_PACKAGE_NCURSES_WCHAR
+	depends on BR2_USE_WCHAR
+	help
+	  compile for 256-color support
+

Hi.
Do you know the size delta between this option enabled and disabled? I'm asking because it might not be even worth an option. Thanks.
Regards.

#2 lore raw

PATCH 1/1 ncurses: add support for 256 colors

Le 09/12/2014 13:21, Gustavo Zacarias a ?crit :

Quoted 16 lines · Thierry Bultel

package/ncurses/Config.in config BR2_PACKAGE_NCURSES_TARGET_PROGS · line 47

Quoted 8 lines
package/ncurses/Config.in +7 -0
+config BR2_PACKAGE_NCURSES_EXT_COLORS
+	bool "ncurses extended colors"
+	select BR2_PACKAGE_NCURSES_WCHAR
+	depends on BR2_USE_WCHAR
+	help
+	  compile for 256-color support
+

Hi.
Do you know the size delta between this option enabled and disabled? I'm asking because it might not be even worth an option. Thanks.
Regards.

Hi, the size delta is quite small:

256 colors:

-rwxr-xr-x 1 thierry thierry 210K d?c. 9 14:23
output/target/usr/lib/libncursesw.so.6.0

std colors:

-rwxr-xr-x 1 thierry thierry 202K d?c. 9 15:46
output/target/usr/lib/libncursesw.so.5.9

Thierry

#3 lore raw

PATCH 1/1 ncurses: add support for 256 colors

Thierry, All,

On 2014-12-09 15:48 +0100, Thierry Bultel spake thusly:

Quoted 22 lines

Le 09/12/2014 13:21, Gustavo Zacarias a ?crit :

Quoted 16 lines · Thierry Bultel

package/ncurses/Config.in config BR2_PACKAGE_NCURSES_TARGET_PROGS · line 47

Quoted 8 lines
package/ncurses/Config.in +7 -0
+config BR2_PACKAGE_NCURSES_EXT_COLORS
+	bool "ncurses extended colors"
+	select BR2_PACKAGE_NCURSES_WCHAR
+	depends on BR2_USE_WCHAR
+	help
+	  compile for 256-color support
+

Hi.
Do you know the size delta between this option enabled and disabled? I'm asking because it might not be even worth an option. Thanks.
Regards.

Hi, the size delta is quite small:

256 colors:

Quoted 7 lines

-rwxr-xr-x 1 thierry thierry 210K d?c. 9 14:23
output/target/usr/lib/libncursesw.so.6.0

std colors:

-rwxr-xr-x 1 thierry thierry 202K d?c. 9 15:46
output/target/usr/lib/libncursesw.so.5.9

Then, I'd say we just enable it by default, since the size delta is negligible (~4%).

There is only one case that would require that to be an option: if it changes the API, and packages that do not expect it would break.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 1/1 ncurses: add support for 256 colors

Le 11/12/2014 19:14, Yann E. MORIN a ?crit :

Quoted 28 lines

Thierry, All,

On 2014-12-09 15:48 +0100, Thierry Bultel spake thusly:

Quoted 25 lines

Le 09/12/2014 13:21, Gustavo Zacarias a ?crit :

Quoted 16 lines · Thierry Bultel

package/ncurses/Config.in config BR2_PACKAGE_NCURSES_TARGET_PROGS · line 47

Quoted 8 lines
package/ncurses/Config.in +7 -0
+config BR2_PACKAGE_NCURSES_EXT_COLORS
+	bool "ncurses extended colors"
+	select BR2_PACKAGE_NCURSES_WCHAR
+	depends on BR2_USE_WCHAR
+	help
+	  compile for 256-color support
+

Hi.
Do you know the size delta between this option enabled and disabled? I'm asking because it might not be even worth an option. Thanks.
Regards.

Hi, the size delta is quite small:

256 colors:

-rwxr-xr-x 1 thierry thierry 210K d?c. 9 14:23
output/target/usr/lib/libncursesw.so.6.0

Quoted 8 lines
Quoted 4 lines

std colors:

-rwxr-xr-x 1 thierry thierry 202K d?c. 9 15:46
output/target/usr/lib/libncursesw.so.5.9

Then, I'd say we just enable it by default, since the size delta is negligible (~4%).

Shall I then repost the patch with 256 colors enabled by default ?

Quoted 6 lines

There is only one case that would require that to be an option: if it changes the API, and packages that do not expect it would break.

Regards,
Yann E. MORIN.

#5 lore raw

PATCH 1/1 ncurses: add support for 256 colors

Thierry, All,

On 2014-12-12 23:43 +0100, Thierry Bultel spake thusly:

Quoted 29 lines

Le 11/12/2014 19:14, Yann E. MORIN a ?crit :

Quoted 28 lines

On 2014-12-09 15:48 +0100, Thierry Bultel spake thusly:

Quoted 27 lines

Le 09/12/2014 13:21, Gustavo Zacarias a ?crit :

Quoted 16 lines · Thierry Bultel

package/ncurses/Config.in config BR2_PACKAGE_NCURSES_TARGET_PROGS · line 47

Quoted 8 lines
package/ncurses/Config.in +7 -0
+config BR2_PACKAGE_NCURSES_EXT_COLORS
+	bool "ncurses extended colors"
+	select BR2_PACKAGE_NCURSES_WCHAR
+	depends on BR2_USE_WCHAR
+	help
+	  compile for 256-color support
+

Hi.
Do you know the size delta between this option enabled and disabled? I'm asking because it might not be even worth an option. Thanks.
Regards.

Hi, the size delta is quite small:

256 colors:

-rwxr-xr-x 1 thierry thierry 210K d?c. 9 14:23
output/target/usr/lib/libncursesw.so.6.0

std colors:

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

-rwxr-xr-x 1 thierry thierry 202K d?c. 9 15:46
output/target/usr/lib/libncursesw.so.5.9

Then, I'd say we just enable it by default, since the size delta is negligible (~4%).

Shall I then repost the patch with 256 colors enabled by default ?

Yes. Just repeat in the commit log the size values you observed as a reason not to make it an option.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'