Skip to contentSkip to conversation

Portability fixes for "make menuconfig"

PATCH Superseded Bjørn Forsman 2 participants 12 messages Jan 1, 2015 – Jan 2, 2015 Kbuild

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Portability fixes for "make menuconfig"

Hi,

Here are two portability fixes needed to be able to run "make menuconfig" on NixOS[1].

[1]: http://nixos.org/

Bj?rn Forsman (2):
kconfig/lxdialog: get ncurses CFLAGS with pkg-config
Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time

 Makefile                                           |  6 ++-
 ...dialog-get-ncurses-CFLAGS-with-pkg-config.patch | 50 ++++++++++++++++++++++
 support/kconfig/patches/series                     |  1 +
 3 files changed, 56 insertions(+), 1 deletion(-)
 create mode 100644 support/kconfig/patches/17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch
Signature · 4 lines
Changes v1 -> v2:
  - make the kconfig/lxdialog patch a separate patch file, instead of modifying
    the kconfig sources (which are synced with linux from time to time).
    Suggested by Thomas P.
#1 lore raw

PATCH v2 1/2 kconfig/lxdialog: get ncurses CFLAGS with pkg-config

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.
]

---
 ...dialog-get-ncurses-CFLAGS-with-pkg-config.patch | 50 ++++++++++++++++++++++
 support/kconfig/patches/series                     |  1 +
 2 files changed, 51 insertions(+)
 create mode 100644 support/kconfig/patches/17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch
support/kconfig/patches/17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch new file +50 -0
new file mode 100644
index 0000000..65973a3
@@ -0,0 +1,50 @@
+From be8af2d54a66911693eddc556e4f7a866670082b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <[email protected]>
+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 <[email protected]>
+Signed-off-by: Michal Marek <[email protected]>
+---
+[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/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.3
+
support/kconfig/patches/series +1 -0
index 9154d83..e25375e 100644
@@ -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
Signature · 1 line
2.1.3
#2 lore raw

PATCH v2 1/2 kconfig/lxdialog: get ncurses CFLAGS with pkg-config

Bj?rn, All,

On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:

Quoted 10 lines

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

Quoted 7 lines

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.
]

Regards,
Yann E. MORIN.

Quoted 78 lines
---
 ...dialog-get-ncurses-CFLAGS-with-pkg-config.patch | 50 ++++++++++++++++++++++
 support/kconfig/patches/series                     |  1 +
 2 files changed, 51 insertions(+)
 create mode 100644 support/kconfig/patches/17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch
support/kconfig/patches/17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch new file +50 -0
new file mode 100644
index 0000000..65973a3
@@ -0,0 +1,50 @@
+From be8af2d54a66911693eddc556e4f7a866670082b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <[email protected]>
+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 <[email protected]>
+Signed-off-by: Michal Marek <[email protected]>
+---
+[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/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.3
+
support/kconfig/patches/series +1 -0
index 9154d83..e25375e 100644
@@ -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
Signature · 6 lines
2.1.3

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v2 2/2 Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time

In reply to Bjørn Forsman

Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity reasons. But it has an unfortunate side-effect in that "make menuconfig" will not (necessarily) be able to pick up ncurses via host pkg-config, breaking "make menuconfig" on systems where ncurses is installed in a non-standard location.

This patch saves the original PKG_CONFIG_PATH variable in HOST_PKG_CONFIG_PATH and restores the original PKG_CONFIG_PATH variable only in the sub-processes that builds the various menuconfig/nconfig/... targets.

With this change, I am able to run "make menuconfig" on NixOS[1].

[1]: http://nixos.org/

---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Makefile +5 -1
index 5e0b4f2..2f1108f 100644
@@ -264,6 +264,7 @@ export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
 
 # Make sure pkg-config doesn't look outside the buildroot tree
+export HOST_PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
 unexport PKG_CONFIG_PATH
 unexport PKG_CONFIG_SYSROOT_DIR
 unexport PKG_CONFIG_LIBDIR
@@ -692,7 +693,10 @@ export HOSTCFLAGS
 
 $(BUILD_DIR)/buildroot-config/%onf:
 	mkdir -p $(@D)/lxdialog
-	$(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
+	(export PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH); \
+	 $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \
+	         obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) \
+	)
 
 DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
 
Signature · 1 line
2.1.3
#4 lore raw

PATCH v2 2/2 Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time

Bj?rn, All,

On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:

Quoted 25 lines

Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity reasons. But it has an unfortunate side-effect in that "make menuconfig" will not (necessarily) be able to pick up ncurses via host pkg-config, breaking "make menuconfig" on systems where ncurses is installed in a non-standard location.

This patch saves the original PKG_CONFIG_PATH variable in HOST_PKG_CONFIG_PATH and restores the original PKG_CONFIG_PATH variable only in the sub-processes that builds the various menuconfig/nconfig/... targets.

With this change, I am able to run "make menuconfig" on NixOS[1].

[1]: http://nixos.org/

---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Makefile +0 -0
index 5e0b4f2..2f1108f 100644

Makefile export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD · line 267

Quoted 4 lines
Makefile +1 -0
@@ -264,6 +264,7 @@ export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
 
 # Make sure pkg-config doesn't look outside the buildroot tree
+export HOST_PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)

I think you'd want to do an immediate assignment here, and not do an export (see below):

    HOST_PKG_CONFIG_PATH:=$(PKG_CONFIG_PATH)

Makefile export HOSTCFLAGS · line 699

Quoted 12 lines
Makefile +4 -1
 unexport PKG_CONFIG_PATH
 unexport PKG_CONFIG_SYSROOT_DIR
 unexport PKG_CONFIG_LIBDIR
@@ -692,7 +693,10 @@ export HOSTCFLAGS
 
 $(BUILD_DIR)/buildroot-config/%onf:
 	mkdir -p $(@D)/lxdialog
-	$(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
+	(export PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH); \
+	 $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \
+	         obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) \
+	)

Well, you do not need this convoluted sub-shell. Just pass the variable as a make option:

    $(MAKE) PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)

Thus, you do not need to export HOST_PKG_CONFIG_PATH (see above).

Regards,
Yann E. MORIN.

Quoted 10 lines
Makefile +0 -0
 DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
 
Signature · 6 lines
2.1.3

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH v2 2/2 Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time

Hi Yann,

Thanks for the feedback. Comments below.

Quoted 30 lines · Yann E. MORIN

Bj?rn, All,

On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:

Quoted 27 lines

Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity reasons. But it has an unfortunate side-effect in that "make menuconfig" will not (necessarily) be able to pick up ncurses via host pkg-config, breaking "make menuconfig" on systems where ncurses is installed in a non-standard location.

This patch saves the original PKG_CONFIG_PATH variable in HOST_PKG_CONFIG_PATH and restores the original PKG_CONFIG_PATH variable only in the sub-processes that builds the various menuconfig/nconfig/... targets.

With this change, I am able to run "make menuconfig" on NixOS[1].

[1]: http://nixos.org/

---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Makefile +0 -0
index 5e0b4f2..2f1108f 100644
@@ -264,6 +264,7 @@ export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
 
Quoted 7 lines

Makefile export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD · line 267

Quoted 2 lines
Makefile +1 -0
 # Make sure pkg-config doesn't look outside the buildroot tree
+export HOST_PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)

I think you'd want to do an immediate assignment here, and not do an export (see below):

    HOST_PKG_CONFIG_PATH:=$(PKG_CONFIG_PATH)

Will fix.

Quoted 16 lines

Makefile export HOSTCFLAGS · line 699

Quoted 12 lines
Makefile +4 -1
 unexport PKG_CONFIG_PATH
 unexport PKG_CONFIG_SYSROOT_DIR
 unexport PKG_CONFIG_LIBDIR
@@ -692,7 +693,10 @@ export HOSTCFLAGS
 
 $(BUILD_DIR)/buildroot-config/%onf:
      mkdir -p $(@D)/lxdialog
-     $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
+     (export PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH); \
+      $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \
+              obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) \
+     )

Well, you do not need this convoluted sub-shell. Just pass the variable as a make option:

Quoted 1 line
    $(MAKE) PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)

I tested that. It doesn't work. I guess when the variable is given on the command line to make (not 'exported') it is not available to sub-processes that make spawns.

- Bj?rn

#6 lore raw

PATCH v2 2/2 Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time

Quoted 41 lines · Bj?rn Forsman

Hi Yann,

Thanks for the feedback. Comments below.

Quoted 36 lines · Yann E. MORIN

Bj?rn, All,

On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:

Quoted 25 lines

Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity reasons. But it has an unfortunate side-effect in that "make menuconfig" will not (necessarily) be able to pick up ncurses via host pkg-config, breaking "make menuconfig" on systems where ncurses is installed in a non-standard location.

This patch saves the original PKG_CONFIG_PATH variable in HOST_PKG_CONFIG_PATH and restores the original PKG_CONFIG_PATH variable only in the sub-processes that builds the various menuconfig/nconfig/... targets.

With this change, I am able to run "make menuconfig" on NixOS[1].

[1]: http://nixos.org/

---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Makefile +0 -0
index 5e0b4f2..2f1108f 100644

Makefile export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD · line 267

Quoted 4 lines
Makefile +1 -0
@@ -264,6 +264,7 @@ export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
 
 # Make sure pkg-config doesn't look outside the buildroot tree
+export HOST_PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)

I think you'd want to do an immediate assignment here, and not do an export (see below):

Quoted 3 lines
Quoted 1 line
    HOST_PKG_CONFIG_PATH:=$(PKG_CONFIG_PATH)

Will fix.

Some comments. There are other HOST_* variables that are exported from the top-level Makefile. I guess that's why I used 'export' in the first place. For now, nobody but Buildroot itself uses HOST_PKG_CONFIG_PATH (well, when this patch gets in), but I can see a future where pkg-config is used within Buildroot for other host packages too. But it is of course trivial to add the "export" at any time :-)

- Bj?rn

#7 lore raw

PATCH v2 2/2 Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time

Bj?rn, All,

On 2015-01-02 22:34 +0100, Bj?rn Forsman spake thusly:

Quoted 38 lines · Bj?rn Forsman
Quoted 37 lines · Yann E. MORIN
Quoted 36 lines

Bj?rn, All,

On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:

Quoted 25 lines

Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity reasons. But it has an unfortunate side-effect in that "make menuconfig" will not (necessarily) be able to pick up ncurses via host pkg-config, breaking "make menuconfig" on systems where ncurses is installed in a non-standard location.

This patch saves the original PKG_CONFIG_PATH variable in HOST_PKG_CONFIG_PATH and restores the original PKG_CONFIG_PATH variable only in the sub-processes that builds the various menuconfig/nconfig/... targets.

With this change, I am able to run "make menuconfig" on NixOS[1].

[1]: http://nixos.org/

---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Makefile +0 -0
index 5e0b4f2..2f1108f 100644

Makefile export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD · line 267

Quoted 4 lines
Makefile +1 -0
@@ -264,6 +264,7 @@ export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
 
 # Make sure pkg-config doesn't look outside the buildroot tree
+export HOST_PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)

I think you'd want to do an immediate assignment here, and not do an export (see below):

Quoted 7 lines
Quoted 3 lines
Quoted 1 line
    HOST_PKG_CONFIG_PATH:=$(PKG_CONFIG_PATH)

Will fix.

Some comments. There are other HOST_* variables that are exported from the top-level Makefile. I guess that's why I used 'export' in the first place.

You're right. I believe export is not needed, but for consistency sake, I understand you would want to use export on it.

Do with an export if you want, I won't complain much. ;-) But state in the commit log that it is not strictly required for the current use-case, and is here just for consistency with other similarly-named variables.

Quoted 5 lines

For now, nobody but Buildroot itself uses HOST_PKG_CONFIG_PATH (well, when this patch gets in), but I can see a future where pkg-config is used within Buildroot for other host packages too. But it is of course trivial to add the "export" at any time :-)

Hey! :-)

Thanks!

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#8 lore raw

PATCH v2 2/2 Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time

In reply to Bjørn Forsman

Bj?rn, All,

On 2015-01-02 22:28 +0100, Bj?rn Forsman spake thusly:

Quoted 7 lines · Yann E. MORIN
Quoted 6 lines

On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:

Quoted 5 lines

Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity reasons. But it has an unfortunate side-effect in that "make menuconfig" will not (necessarily) be able to pick up ncurses via host pkg-config, breaking "make menuconfig" on systems where ncurses is installed in a non-standard location.

[--SNIP--]

Quoted 13 lines
Quoted 13 lines

Makefile export HOSTCFLAGS · line 699

Quoted 9 lines
Makefile +4 -1
@@ -692,7 +693,10 @@ export HOSTCFLAGS
 
 $(BUILD_DIR)/buildroot-config/%onf:
      mkdir -p $(@D)/lxdialog
-     $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
+     (export PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH); \
+      $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \
+              obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) \
+     )

Well, you do not need this convoluted sub-shell. Just pass the variable as a make option:

Quoted 5 lines
Quoted 1 line
    $(MAKE) PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)

I tested that. It doesn't work. I guess when the variable is given on the command line to make (not 'exported') it is not available to sub-processes that make spawns.

In that case, just put it in front of it, like:

    PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH) $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)

This will put PKG_CONFIG_PATH in the environment just for the duration of the sub-make.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#9 lore raw

PATCH v2 2/2 Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time

Quoted 30 lines · Yann E. MORIN

Bj?rn, All,

On 2015-01-02 22:28 +0100, Bj?rn Forsman spake thusly:

Quoted 7 lines · Yann E. MORIN
Quoted 6 lines

On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:

Quoted 5 lines

Buildroot unexports PKG_CONFIG_PATH in the top-level Makefile for purity reasons. But it has an unfortunate side-effect in that "make menuconfig" will not (necessarily) be able to pick up ncurses via host pkg-config, breaking "make menuconfig" on systems where ncurses is installed in a non-standard location.

[--SNIP--]

Quoted 13 lines
Quoted 13 lines

Makefile export HOSTCFLAGS · line 699

Quoted 9 lines
Makefile +4 -1
@@ -692,7 +693,10 @@ export HOSTCFLAGS
 
 $(BUILD_DIR)/buildroot-config/%onf:
      mkdir -p $(@D)/lxdialog
-     $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
+     (export PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH); \
+      $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \
+              obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) \
+     )

Well, you do not need this convoluted sub-shell. Just pass the variable as a make option:

Quoted 5 lines
Quoted 1 line
    $(MAKE) PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)

I tested that. It doesn't work. I guess when the variable is given on the command line to make (not 'exported') it is not available to sub-processes that make spawns.

Quoted 6 lines

In that case, just put it in front of it, like:

    PKG_CONFIG_PATH=$(HOST_PKG_CONFIG_PATH) $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)

This will put PKG_CONFIG_PATH in the environment just for the duration of the sub-make.

Ah, good point. That works and looks cleaner. Will update.

- Bj?rn

#10 lore raw

v2 cover Portability fixes for "make menuconfig"

In reply to Bjørn Forsman

Bj?rn, All,

On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:

Quoted 8 lines

Here are two portability fixes needed to be able to run "make menuconfig" on NixOS[1].

[1]: http://nixos.org/

Bj?rn Forsman (2):
kconfig/lxdialog: get ncurses CFLAGS with pkg-config
Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time

I think the order should be the other way around, because you need the latter for the former to work.

Regards,
Yann E. MORIN.

Quoted 15 lines
 Makefile                                           |  6 ++-
 ...dialog-get-ncurses-CFLAGS-with-pkg-config.patch | 50 ++++++++++++++++++++++
 support/kconfig/patches/series                     |  1 +
 3 files changed, 56 insertions(+), 1 deletion(-)
 create mode 100644 support/kconfig/patches/17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch
Signature · 8 lines
Changes v1 -> v2:
  - make the kconfig/lxdialog patch a separate patch file, instead of modifying
    the kconfig sources (which are synced with linux from time to time).
    Suggested by Thomas P.
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#11 lore raw

v2 cover Portability fixes for "make menuconfig"

Quoted 6 lines · Yann E. MORIN

Bj?rn, All,

On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:

Quoted 3 lines

Here are two portability fixes needed to be able to run "make menuconfig" on NixOS[1].

Quoted 8 lines
Quoted 5 lines

[1]: http://nixos.org/

Bj?rn Forsman (2):
kconfig/lxdialog: get ncurses CFLAGS with pkg-config
Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time

I think the order should be the other way around, because you need the latter for the former to work.

In my opinion, both orders are equally correct. But I'll change it for you :-)

- Bj?rn