diff mbox

[1/1] ncurses: add support for 256 colors

Message ID 1418122710-27852-1-git-send-email-tbultel@free.fr
State Superseded
Headers show

Commit Message

Thierry Bultel Dec. 9, 2014, 10:58 a.m. UTC
Signed-off-by: Thierry Bultel <tbultel@free.fr>
---
 package/ncurses/Config.in  |  7 +++++++
 package/ncurses/ncurses.mk | 14 +++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

Comments

Gustavo Zacarias Dec. 9, 2014, 12:21 p.m. UTC | #1
On 12/09/2014 07:58 AM, Thierry Bultel wrote:

> +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.
Thierry Bultel Dec. 9, 2014, 2:48 p.m. UTC | #2
Le 09/12/2014 13:21, Gustavo Zacarias a écrit :
> On 12/09/2014 07:58 AM, Thierry Bultel wrote:
>
>> +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
Yann E. MORIN Dec. 11, 2014, 6:14 p.m. UTC | #3
Thierry, All,

On 2014-12-09 15:48 +0100, Thierry Bultel spake thusly:
> Le 09/12/2014 13:21, Gustavo Zacarias a écrit :
> >On 12/09/2014 07:58 AM, Thierry Bultel wrote:
> >
> >>+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

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.
Thierry Bultel Dec. 12, 2014, 10:43 p.m. UTC | #4
Le 11/12/2014 19:14, Yann E. MORIN a écrit :
> Thierry, All,
>
> On 2014-12-09 15:48 +0100, Thierry Bultel spake thusly:
>> Le 09/12/2014 13:21, Gustavo Zacarias a écrit :
>>> On 12/09/2014 07:58 AM, Thierry Bultel wrote:
>>>
>>>> +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
>
> 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 ?

> 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.
>
Yann E. MORIN Dec. 12, 2014, 10:46 p.m. UTC | #5
Thierry, All,

On 2014-12-12 23:43 +0100, Thierry Bultel spake thusly:
> Le 11/12/2014 19:14, Yann E. MORIN a écrit :
> >On 2014-12-09 15:48 +0100, Thierry Bultel spake thusly:
> >>Le 09/12/2014 13:21, Gustavo Zacarias a écrit :
> >>>On 12/09/2014 07:58 AM, Thierry Bultel wrote:
> >>>
> >>>>+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
> >
> >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.
diff mbox

Patch

diff --git a/package/ncurses/Config.in b/package/ncurses/Config.in
index 44713f9..8d0a4b7 100644
--- a/package/ncurses/Config.in
+++ b/package/ncurses/Config.in
@@ -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
diff --git a/package/ncurses/ncurses.mk b/package/ncurses/ncurses.mk
index e7bd967..262ac94 100644
--- a/package/ncurses/ncurses.mk
+++ b/package/ncurses/ncurses.mk
@@ -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