Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Bjørn Forsman" <bjorn.forsman@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] kconfig/lxdialog: get ncurses CFLAGS with pkg-config
Date: Sun, 26 Oct 2014 14:17:25 +0100	[thread overview]
Message-ID: <1414329446-16587-2-git-send-email-bjorn.forsman@gmail.com> (raw)
In-Reply-To: <1414329446-16587-1-git-send-email-bjorn.forsman@gmail.com>

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 (will be 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
(1) there was a conflict in one of the Buildroot kconfg patches (against
linux 3.18-rc1), (2) adding this patch won't create any conflict next
time someone re-syncs kconfig with linux and (3) because this is easier
to review.
]

Signed-off-by: Bj?rn Forsman <bjorn.forsman@gmail.com>
---
 support/kconfig/lxdialog/check-lxdialog.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 support/kconfig/lxdialog/check-lxdialog.sh

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="<ncurses.h>" -DNCURSES_WIDECHAR=1'
+	elif pkg-config --cflags ncurses 2>/dev/null; then
+		echo '-DCURSES_LOC="<ncurses.h>"'
+	elif [ -f /usr/include/ncursesw/curses.h ]; then
 		echo '-I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"'
 		echo ' -DNCURSES_WIDECHAR=1'
 	elif [ -f /usr/include/ncurses/ncurses.h ]; then
-- 
2.1.2

  reply	other threads:[~2014-10-26 13:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-26 13:17 [Buildroot] [PATCH 0/2] Portability fixes for "make menuconfig" Bjørn Forsman
2014-10-26 13:17 ` Bjørn Forsman [this message]
2014-10-26 15:41   ` [Buildroot] [PATCH 1/2] kconfig/lxdialog: get ncurses CFLAGS with pkg-config Thomas Petazzoni
2014-10-26 16:06     ` Bjørn Forsman
2014-10-26 21:16       ` Bjørn Forsman
2014-10-26 21:24         ` Thomas Petazzoni
2014-10-26 21:45           ` Bjørn Forsman
2014-11-05  7:10             ` Bjørn Forsman
2014-11-05  7:15               ` Thomas Petazzoni
2014-12-13 19:04                 ` Bjørn Forsman
2015-01-02 16:01                   ` Bjørn Forsman
2014-10-26 13:17 ` [Buildroot] [PATCH 2/2] Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time Bjørn Forsman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414329446-16587-2-git-send-email-bjorn.forsman@gmail.com \
    --to=bjorn.forsman@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox