From patchwork Fri Jan 2 23:58:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Bj=C3=B8rn_Forsman?= X-Patchwork-Id: 425075 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 58F3414007F for ; Sat, 3 Jan 2015 10:59:10 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1E3AA8ADB6; Fri, 2 Jan 2015 23:59:09 +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 7fp6HMaWc5Tc; Fri, 2 Jan 2015 23:59:05 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 2BD4786360; Fri, 2 Jan 2015 23:59:04 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 557341C279D for ; Fri, 2 Jan 2015 23:59:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4F390274E4 for ; Fri, 2 Jan 2015 23:59:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XUdOGropa5ET for ; Fri, 2 Jan 2015 23:59:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by silver.osuosl.org (Postfix) with ESMTPS id C5D3526D5B for ; Fri, 2 Jan 2015 23:59:00 +0000 (UTC) Received: by mail-we0-f182.google.com with SMTP id w62so5060004wes.13 for ; Fri, 02 Jan 2015 15:58:59 -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:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=jmSlr0yIMh2woPoZmJOhrrdDc9F+VOM28EOfngQTEBM=; b=BaUyXDFfGl3+N/PYCnVNmbWiF28EKFOwGhmcDeR0aaVKh7zicXq1rgAIPNt9uWcuhM PZvobovPhh0kWuXHNN+ntTMdLBgRn4TwhgN3/M8JHPfNKtMRSCSvoeDx1ZdI/DFEdpOZ Zjoi15qN3YlvNVJFz0k+/Ac3ACTOfMqSez/6e46z+QvSo+J8ip365mQsmRSV14rjZEEC 1z1IEG2jerrbGj8fF6t2eH/janN8Jjb1RnWSwzMh2C/onMTS7pMx0NuWlhyUO+9WLBcq FRlutI17S6WD3u73yUs47e3ZWgWOOv2FeY5mlpue3rK/+xB3ljmH2qcDgvv+DJv/uLPl 4mOQ== X-Received: by 10.180.14.136 with SMTP id p8mr2292284wic.20.1420243139500; Fri, 02 Jan 2015 15:58:59 -0800 (PST) Received: from localhost (cm-84.208.241.218.getinternet.no. [84.208.241.218]) by mx.google.com with ESMTPSA id fm10sm807222wib.7.2015.01.02.15.58.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jan 2015 15:58:58 -0800 (PST) From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= To: buildroot@buildroot.org Date: Sat, 3 Jan 2015 00:58:48 +0100 Message-Id: <1420243128-7708-3-git-send-email-bjorn.forsman@gmail.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1420243128-7708-1-git-send-email-bjorn.forsman@gmail.com> References: <1420243128-7708-1-git-send-email-bjorn.forsman@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 2/2] kconfig/lxdialog: get ncurses CFLAGS with pkg-config X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This makes "make menuconfig" also work on systems where ncurses is not installed in a standard location (such as on NixOS). This patch changes ccflags() so that it tries pkg-config first, and only if pkg-config fails does it go back to the fallback/manual checks. This is the same algorithm that ldflags() already uses. [This patch is already applied upstream (is part of linux v3.18): https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=be8af2d54a66911693eddc556e4f7a866670082b I'm adding this instead of doing a full upstream kconfig sync because there was a conflict in one of the Buildroot kconfig patches (against linux 3.18-rc1), which I was unable to resolve. Just drop this patch next time Buildroot kconfig is synced against upstream. ] Signed-off-by: Bjørn Forsman Acked-by: "Yann E. MORIN" --- support/kconfig/lxdialog/check-lxdialog.sh | 6 ++- ...dialog-get-ncurses-CFLAGS-with-pkg-config.patch | 50 ++++++++++++++++++++++ support/kconfig/patches/series | 1 + 3 files changed, 56 insertions(+), 1 deletion(-) mode change 100644 => 100755 support/kconfig/lxdialog/check-lxdialog.sh create mode 100644 support/kconfig/patches/17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch diff --git a/support/kconfig/lxdialog/check-lxdialog.sh b/support/kconfig/lxdialog/check-lxdialog.sh old mode 100644 new mode 100755 index 4789b72..3ce0a23 --- a/support/kconfig/lxdialog/check-lxdialog.sh +++ b/support/kconfig/lxdialog/check-lxdialog.sh @@ -21,7 +21,11 @@ ldflags() # Where is ncurses.h? ccflags() { - if [ -f /usr/include/ncursesw/curses.h ]; then + if pkg-config --cflags ncursesw 2>/dev/null; then + echo '-DCURSES_LOC="" -DNCURSES_WIDECHAR=1' + elif pkg-config --cflags ncurses 2>/dev/null; then + echo '-DCURSES_LOC=""' + elif [ -f /usr/include/ncursesw/curses.h ]; then echo '-I/usr/include/ncursesw -DCURSES_LOC=""' echo ' -DNCURSES_WIDECHAR=1' elif [ -f /usr/include/ncurses/ncurses.h ]; then diff --git a/support/kconfig/patches/17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch b/support/kconfig/patches/17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch new file mode 100644 index 0000000..1eb48ef --- /dev/null +++ b/support/kconfig/patches/17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch @@ -0,0 +1,50 @@ +From be8af2d54a66911693eddc556e4f7a866670082b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= +Date: Sun, 14 Sep 2014 12:57:50 +0200 +Subject: [PATCH] kconfig/lxdialog: get ncurses CFLAGS with pkg-config +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This makes "make menuconfig" also work on systems where ncurses is not +installed in a standard location (such as on NixOS). + +This patch changes ccflags() so that it tries pkg-config first, and only +if pkg-config fails does it go back to the fallback/manual checks. This +is the same algorithm that ldflags() already uses. + +Signed-off-by: Bjørn Forsman +Signed-off-by: Michal Marek +--- +[This patch is already applied upstream (is part of linux v3.18): +https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=be8af2d54a66911693eddc556e4f7a866670082b + +I'm adding this instead of doing a full upstream kconfig sync because +there was a conflict in one of the Buildroot kconfig patches (against +linux 3.18-rc1), which I was unable to resolve. Just drop this patch next time +Buildroot kconfig is synced against upstream. +] + + scripts/kconfig/lxdialog/check-lxdialog.sh | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh +index 9d2a4c5..5075ebf 100755 +--- a/lxdialog/check-lxdialog.sh ++++ b/lxdialog/check-lxdialog.sh +@@ -21,7 +21,11 @@ ldflags() + # Where is ncurses.h? + ccflags() + { +- if [ -f /usr/include/ncursesw/curses.h ]; then ++ if pkg-config --cflags ncursesw 2>/dev/null; then ++ echo '-DCURSES_LOC="" -DNCURSES_WIDECHAR=1' ++ elif pkg-config --cflags ncurses 2>/dev/null; then ++ echo '-DCURSES_LOC=""' ++ elif [ -f /usr/include/ncursesw/curses.h ]; then + echo '-I/usr/include/ncursesw -DCURSES_LOC=""' + echo ' -DNCURSES_WIDECHAR=1' + elif [ -f /usr/include/ncurses/ncurses.h ]; then +-- +2.1.3 + diff --git a/support/kconfig/patches/series b/support/kconfig/patches/series index 9154d83..e25375e 100644 --- a/support/kconfig/patches/series +++ b/support/kconfig/patches/series @@ -6,3 +6,4 @@ 14-support-out-of-tree-config.patch 15-fix-qconf-moc-rule.patch 16-fix-space-to-de-select-options.patch +17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch