All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kconfig/lxdialog: get ncurses CFLAGS with pkg-config
@ 2014-09-14 10:57 Bjørn Forsman
  2014-09-23 14:08 ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Bjørn Forsman @ 2014-09-14 10:57 UTC (permalink / raw)
  To: yann.morin.1998; +Cc: linux-kbuild, Bjørn Forsman

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 <bjorn.forsman@gmail.com>
---
 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 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/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.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] kconfig/lxdialog: get ncurses CFLAGS with pkg-config
  2014-09-14 10:57 [PATCH] kconfig/lxdialog: get ncurses CFLAGS with pkg-config Bjørn Forsman
@ 2014-09-23 14:08 ` Michal Marek
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2014-09-23 14:08 UTC (permalink / raw)
  To: Bjørn Forsman; +Cc: yann.morin.1998, linux-kbuild

On Sun, Sep 14, 2014 at 12:57:50PM +0200, Bjørn Forsman wrote:
> 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.

Applied to kbuild.git#kbuild, thanks.

Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] kconfig/lxdialog: get ncurses CFLAGS with pkg-config
@ 2014-07-11 15:34 Bjørn Forsman
  0 siblings, 0 replies; 5+ messages in thread
From: Bjørn Forsman @ 2014-07-11 15:34 UTC (permalink / raw)
  To: yann.morin.1998; +Cc: linux-kbuild, Bjørn Forsman

check-lxdialog.sh has functions for finding ncurses linker and compiler
flags; ldflags() and ccflags().

ldflags() tries to get linker flags from pkg-config and has a fallback
if pkg-config fails. But ccflags() currently doesn't use pkg-config at
all, instead it does manual checks like this:

  if [ -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
      echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
  [...]

This patch changes ccflags() so that it also tries pkg-config first, and
only if pkg-config fails does it go back to the fallback/manual checks.

This makes ldflags()/ccflags() symmetric (both try to use pkg-config
before falling back to manual checks) and has the nice side-effect of
making "make menuconfig" work on systems where ncurses is not installed
in a standard location (such as on NixOS).

Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
---
 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 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/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.0.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] kconfig/lxdialog: get ncurses CFLAGS with pkg-config
  2013-12-31  0:04 Bjørn Forsman
@ 2014-03-08 15:04 ` Bjørn Forsman
  0 siblings, 0 replies; 5+ messages in thread
From: Bjørn Forsman @ 2014-03-08 15:04 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Bjørn Forsman, Yann E. MORIN

On 31 December 2013 01:04, Bjørn Forsman <bjorn.forsman@gmail.com> wrote:
> check-lxdialog.sh has functions for finding ncurses linker and compiler
> flags; ldflags() and ccflags().
>
> ldflags() tries to get linker flags from pkg-config and has a fallback
> if pkg-config fails. But ccflags() currently doesn't use pkg-config at
> all, instead it does manual checks like this:
>
>   if [ -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
>       echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
>   [...]
>
> This patch changes ccflags() so that it also tries pkg-config first, and
> only if pkg-config fails does it go back to the fallback/manual checks.
>
> This makes ldflags()/ccflags() symmetric (both try to use pkg-config
> before falling back to manual checks) and has the nice side-effect of
> making "make menuconfig" work on systems where ncurses is not installed
> in a standard location (such as on NixOS).
>
> Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
> ---
>  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 100644
> --- a/scripts/kconfig/lxdialog/check-lxdialog.sh
> +++ b/scripts/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
> --
> 1.8.5.2

Ping. No comments?

Best regards,
Bjørn Forsman

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] kconfig/lxdialog: get ncurses CFLAGS with pkg-config
@ 2013-12-31  0:04 Bjørn Forsman
  2014-03-08 15:04 ` Bjørn Forsman
  0 siblings, 1 reply; 5+ messages in thread
From: Bjørn Forsman @ 2013-12-31  0:04 UTC (permalink / raw)
  To: yann.morin.1998; +Cc: linux-kbuild, Bjørn Forsman

check-lxdialog.sh has functions for finding ncurses linker and compiler
flags; ldflags() and ccflags().

ldflags() tries to get linker flags from pkg-config and has a fallback
if pkg-config fails. But ccflags() currently doesn't use pkg-config at
all, instead it does manual checks like this:

  if [ -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
      echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
  [...]

This patch changes ccflags() so that it also tries pkg-config first, and
only if pkg-config fails does it go back to the fallback/manual checks.

This makes ldflags()/ccflags() symmetric (both try to use pkg-config
before falling back to manual checks) and has the nice side-effect of
making "make menuconfig" work on systems where ncurses is not installed
in a standard location (such as on NixOS).

Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
---
 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 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/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
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-23 14:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-14 10:57 [PATCH] kconfig/lxdialog: get ncurses CFLAGS with pkg-config Bjørn Forsman
2014-09-23 14:08 ` Michal Marek
  -- strict thread matches above, loose matches on Subject: below --
2014-07-11 15:34 Bjørn Forsman
2013-12-31  0:04 Bjørn Forsman
2014-03-08 15:04 ` Bjørn Forsman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.