From patchwork Wed Dec 5 18:06:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francois Perrad X-Patchwork-Id: 203914 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 445822C0084 for ; Thu, 6 Dec 2012 05:07:34 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CCAF7826D0; Wed, 5 Dec 2012 18:07:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R0AeKDuXNgar; Wed, 5 Dec 2012 18:07:30 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 3858F8B1E6; Wed, 5 Dec 2012 18:07:29 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 693B68F74A for ; Wed, 5 Dec 2012 18:07:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 5677B8B1E6 for ; Wed, 5 Dec 2012 18:07:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DvznyWdhhWFz for ; Wed, 5 Dec 2012 18:07:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by whitealder.osuosl.org (Postfix) with ESMTPS id 8E3CA826D0 for ; Wed, 5 Dec 2012 18:07:26 +0000 (UTC) Received: by mail-wg0-f43.google.com with SMTP id e12so2617064wge.10 for ; Wed, 05 Dec 2012 10:07:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=CU8lUKaJ8i860i9juM0lGlUS5J5mpdwM0JvABkBsock=; b=CJp3BIpuVzjITvC0AXvOGvl1VVYFgH5q4k67EzjFYCfAtsuC6SX13t20eVc9FGMZDG od4ob4bZ4weyrWhnV3fxrFloaMPKX7nuZL5gm5J5+XNFxGekef1xwbetVpSAcvgS9/OM p7Q6CgzWAHL5h0JpbQnajGd9lv5ar9Ar3Br+tXZ8/sJICWIo3PcS2py12QzhAUdP5DQ6 /3e+7fHsLWMAsYiSCw9ZBTNU/S1uAIEAabvEzIoJUG/HBUm96OpeJUO8buVWUaxRzmAy r7GEAyYmHHPxZbLgRoerS1yWKiEaSLVgek5bMTTc4K8f49vkjTEhAGH1SVESDqu48LKu /49Q== Received: by 10.180.94.226 with SMTP id df2mr4692249wib.11.1354730844758; Wed, 05 Dec 2012 10:07:24 -0800 (PST) Received: from xubuntu-12.04 (239.141.193.77.rev.sfr.net. [77.193.141.239]) by mx.google.com with ESMTPS id ec3sm19987169wib.10.2012.12.05.10.07.19 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Dec 2012 10:07:21 -0800 (PST) From: Francois Perrad To: buildroot@busybox.net Date: Wed, 5 Dec 2012 19:06:51 +0100 Message-Id: <1354730811-14060-1-git-send-email-francois.perrad@gadz.org> X-Mailer: git-send-email 1.7.9.5 Subject: [Buildroot] [PATCH v2] linenoise: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Signed-off-by: Francois Perrad --- package/Config.in | 1 + package/linenoise/Config.in | 6 ++++ package/linenoise/linenoise-get-columns.patch | 20 +++++++++++ package/linenoise/linenoise.mk | 45 +++++++++++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 package/linenoise/Config.in create mode 100644 package/linenoise/linenoise-get-columns.patch create mode 100644 package/linenoise/linenoise.mk diff --git a/package/Config.in b/package/Config.in index e8b8cd7..2c1fba4 100644 --- a/package/Config.in +++ b/package/Config.in @@ -517,6 +517,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..4fb9e40 --- /dev/null +++ b/package/linenoise/linenoise-get-columns.patch @@ -0,0 +1,20 @@ +returns the default value (80) when a real value is not available +(0 is not an acceptable value for COLUMNS, the width of the screen). + +see pull request on upstream : http://github.com/antirez/linenoise/pull/31 + +Signed-off-by: Francois Perrad + +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..343a107 --- /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_LDFLAGS) -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))