Patchwork [3/4] linenoise: new package

login
register
mail settings
Submitter Francois Perrad
Date Dec. 3, 2012, 4:12 p.m.
Message ID <1354551135-30056-3-git-send-email-francois.perrad@gadz.org>
Download mbox | patch
Permalink /patch/203393/
State Superseded
Headers show

Comments

Francois Perrad - Dec. 3, 2012, 4:12 p.m.
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 package/Config.in                             |    1 +
 package/linenoise/Config.in                   |    6 ++++
 package/linenoise/linenoise-get-columns.patch |   17 ++++++++++
 package/linenoise/linenoise.mk                |   45 +++++++++++++++++++++++++
 4 files changed, 69 insertions(+)
 create mode 100644 package/linenoise/Config.in
 create mode 100644 package/linenoise/linenoise-get-columns.patch
 create mode 100644 package/linenoise/linenoise.mk
Peter Korsgaard - Dec. 5, 2012, 4:42 p.m.
>>>>> "Francois" == Francois Perrad <fperrad@gmail.com> writes:

 Francois> Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
 Francois> ---
 Francois>  package/Config.in                             |    1 +
 Francois>  package/linenoise/Config.in                   |    6 ++++
 Francois>  package/linenoise/linenoise-get-columns.patch |   17 ++++++++++
 Francois>  package/linenoise/linenoise.mk                |   45 +++++++++++++++++++++++++
 Francois>  4 files changed, 69 insertions(+)
 Francois>  create mode 100644 package/linenoise/Config.in
 Francois>  create mode 100644 package/linenoise/linenoise-get-columns.patch
 Francois>  create mode 100644 package/linenoise/linenoise.mk

 Francois> diff --git a/package/linenoise/linenoise-get-columns.patch b/package/linenoise/linenoise-get-columns.patch
 Francois> new file mode 100644
 Francois> index 0000000..180d1c3
 Francois> --- /dev/null
 Francois> +++ b/package/linenoise/linenoise-get-columns.patch
 Francois> @@ -0,0 +1,17 @@
 Francois> +see http://github.com/antirez/linenoise/pull/31

It would still be good to describe what it does and why.


 Francois> +
 Francois> +Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
 Francois> +
 Francois> +Index: b/linenoise.c
 Francois> +===================================================================
 Francois> +--- a/linenoise.c
 Francois> ++++ b/linenoise.c
 Francois> +@@ -182,7 +182,7 @@
 Francois> + static int getColumns(void) {
 Francois> +     struct winsize ws;
 Francois> + 
 Francois> +-    if (ioctl(1, TIOCGWINSZ, &ws) == -1) return 80;
 Francois> ++    if (ioctl(1, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0) return 80;
 Francois> +     return ws.ws_col;
 Francois> + }
 Francois> + 
 Francois> diff --git a/package/linenoise/linenoise.mk b/package/linenoise/linenoise.mk
 Francois> new file mode 100644
 Francois> index 0000000..e7b6124
 Francois> --- /dev/null
 Francois> +++ b/package/linenoise/linenoise.mk
 Francois> @@ -0,0 +1,45 @@
 Francois> +#############################################################
 Francois> +#
 Francois> +# linenoise
 Francois> +#
 Francois> +#############################################################
 Francois> +LINENOISE_VERSION = g8c9b481
 Francois> +LINENOISE_SITE = http://github.com/antirez/linenoise/tarball/master
 Francois> +LINENOISE_LICENSE = BSD-2c
 Francois> +LINENOISE_INSTALL_STAGING = YES
 Francois> +
 Francois> +define LINENOISE_BUILD_CMDS
 Francois> +	cd $(@D); $(TARGET_CC) $(TARGET_CFLAGS) -c linenoise.c
 Francois> +	cd $(@D); $(TARGET_AR) rcu liblinenoise.a linenoise.o
 Francois> +	cd $(@D); $(TARGET_CC) $(TARGET_CFLAGS) -o linenoise_example example.c -L. -llinenoise

Does it make sense to build and install the example? If it does, it
should also use $(TARGET_LDFLAGS).
Francois Perrad - Dec. 5, 2012, 6:06 p.m.
2012/12/5 Peter Korsgaard <jacmet@uclibc.org>:
>>>>>> "Francois" == Francois Perrad <fperrad@gmail.com> writes:
>
>  Francois> Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
>  Francois> ---
>  Francois>  package/Config.in                             |    1 +
>  Francois>  package/linenoise/Config.in                   |    6 ++++
>  Francois>  package/linenoise/linenoise-get-columns.patch |   17 ++++++++++
>  Francois>  package/linenoise/linenoise.mk                |   45 +++++++++++++++++++++++++
>  Francois>  4 files changed, 69 insertions(+)
>  Francois>  create mode 100644 package/linenoise/Config.in
>  Francois>  create mode 100644 package/linenoise/linenoise-get-columns.patch
>  Francois>  create mode 100644 package/linenoise/linenoise.mk
>
>  Francois> diff --git a/package/linenoise/linenoise-get-columns.patch b/package/linenoise/linenoise-get-columns.patch
>  Francois> new file mode 100644
>  Francois> index 0000000..180d1c3
>  Francois> --- /dev/null
>  Francois> +++ b/package/linenoise/linenoise-get-columns.patch
>  Francois> @@ -0,0 +1,17 @@
>  Francois> +see http://github.com/antirez/linenoise/pull/31
>
> It would still be good to describe what it does and why.
>

Ok.

>
>  Francois> +
>  Francois> +Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
>  Francois> +
>  Francois> +Index: b/linenoise.c
>  Francois> +===================================================================
>  Francois> +--- a/linenoise.c
>  Francois> ++++ b/linenoise.c
>  Francois> +@@ -182,7 +182,7 @@
>  Francois> + static int getColumns(void) {
>  Francois> +     struct winsize ws;
>  Francois> +
>  Francois> +-    if (ioctl(1, TIOCGWINSZ, &ws) == -1) return 80;
>  Francois> ++    if (ioctl(1, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0) return 80;
>  Francois> +     return ws.ws_col;
>  Francois> + }
>  Francois> +
>  Francois> diff --git a/package/linenoise/linenoise.mk b/package/linenoise/linenoise.mk
>  Francois> new file mode 100644
>  Francois> index 0000000..e7b6124
>  Francois> --- /dev/null
>  Francois> +++ b/package/linenoise/linenoise.mk
>  Francois> @@ -0,0 +1,45 @@
>  Francois> +#############################################################
>  Francois> +#
>  Francois> +# linenoise
>  Francois> +#
>  Francois> +#############################################################
>  Francois> +LINENOISE_VERSION = g8c9b481
>  Francois> +LINENOISE_SITE = http://github.com/antirez/linenoise/tarball/master
>  Francois> +LINENOISE_LICENSE = BSD-2c
>  Francois> +LINENOISE_INSTALL_STAGING = YES
>  Francois> +
>  Francois> +define LINENOISE_BUILD_CMDS
>  Francois> +    cd $(@D); $(TARGET_CC) $(TARGET_CFLAGS) -c linenoise.c
>  Francois> +    cd $(@D); $(TARGET_AR) rcu liblinenoise.a linenoise.o
>  Francois> +    cd $(@D); $(TARGET_CC) $(TARGET_CFLAGS) -o linenoise_example example.c -L. -llinenoise
>
> Does it make sense to build and install the example? If it does, it
> should also use $(TARGET_LDFLAGS).

Fixed in v2.

Fran├žois

>
>
> --
> Bye, Peter Korsgaard
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

Patch

diff --git a/package/Config.in b/package/Config.in
index 5ba1f05..6117716 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -523,6 +523,7 @@  menu "Text and terminal handling"
 source "package/enchant/Config.in"
 source "package/icu/Config.in"
 source "package/libiconv/Config.in"
+source "package/linenoise/Config.in"
 source "package/ncurses/Config.in"
 source "package/newt/Config.in"
 source "package/pcre/Config.in"
diff --git a/package/linenoise/Config.in b/package/linenoise/Config.in
new file mode 100644
index 0000000..8e4ab91
--- /dev/null
+++ b/package/linenoise/Config.in
@@ -0,0 +1,6 @@ 
+config BR2_PACKAGE_LINENOISE
+	bool "linenoise"
+	help
+	  A small self-contained alternative to readline and libedit
+
+	  https://github.com/antirez/linenoise
diff --git a/package/linenoise/linenoise-get-columns.patch b/package/linenoise/linenoise-get-columns.patch
new file mode 100644
index 0000000..180d1c3
--- /dev/null
+++ b/package/linenoise/linenoise-get-columns.patch
@@ -0,0 +1,17 @@ 
+see http://github.com/antirez/linenoise/pull/31
+
+Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
+
+Index: b/linenoise.c
+===================================================================
+--- a/linenoise.c
++++ b/linenoise.c
+@@ -182,7 +182,7 @@
+ static int getColumns(void) {
+     struct winsize ws;
+ 
+-    if (ioctl(1, TIOCGWINSZ, &ws) == -1) return 80;
++    if (ioctl(1, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0) return 80;
+     return ws.ws_col;
+ }
+ 
diff --git a/package/linenoise/linenoise.mk b/package/linenoise/linenoise.mk
new file mode 100644
index 0000000..e7b6124
--- /dev/null
+++ b/package/linenoise/linenoise.mk
@@ -0,0 +1,45 @@ 
+#############################################################
+#
+# linenoise
+#
+#############################################################
+LINENOISE_VERSION = g8c9b481
+LINENOISE_SITE = http://github.com/antirez/linenoise/tarball/master
+LINENOISE_LICENSE = BSD-2c
+LINENOISE_INSTALL_STAGING = YES
+
+define LINENOISE_BUILD_CMDS
+	cd $(@D); $(TARGET_CC) $(TARGET_CFLAGS) -c linenoise.c
+	cd $(@D); $(TARGET_AR) rcu liblinenoise.a linenoise.o
+	cd $(@D); $(TARGET_CC) $(TARGET_CFLAGS) -o linenoise_example example.c -L. -llinenoise
+endef
+
+define LINENOISE_INSTALL_STAGING_CMDS
+	$(INSTALL) -m 644 -D $(@D)/linenoise.h          $(STAGING_DIR)/usr/include/linenoise.h
+	$(INSTALL) -m 644 -D $(@D)/liblinenoise.a       $(STAGING_DIR)/usr/lib/liblinenoise.a
+	$(INSTALL) -m 755 -D $(@D)/linenoise_example    $(STAGING_DIR)/usr/bin/linenoise_example
+endef
+
+define LINENOISE_UNINSTALL_STAGING_CMDS
+	rm -f   $(STAGING_DIR)/usr/include/linenoise.h
+	rm -f   $(STAGING_DIR)/usr/lib/liblinenoise.a
+	rm -f   $(STAGING_DIR)/usr/bin/linenoise_example
+endef
+
+define LINENOISE_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 644 -D $(@D)/linenoise.h          $(TARGET_DIR)/usr/include/linenoise.h
+	$(INSTALL) -m 644 -D $(@D)/liblinenoise.a       $(TARGET_DIR)/usr/lib/liblinenoise.a
+	$(INSTALL) -m 755 -D $(@D)/linenoise_example    $(TARGET_DIR)/usr/bin/linenoise_example
+endef
+
+define LINENOISE_UNINSTALL_TARGET_CMDS
+	rm -f   $(TARGET_DIR)/usr/include/linenoise.h
+	rm -f   $(TARGET_DIR)/usr/lib/liblinenoise.a
+	rm -f   $(TARGET_DIR)/usr/bin/linenoise_example
+endef
+
+define LINENOISE_CLEAN_CMDS
+	rm -f $(@D)/*.o $(@D)/*.a $(@D)/linenoise_example
+endef
+
+$(eval $(generic-package))