Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/2] Portability fixes for "make menuconfig"
@ 2015-01-01 20:54 Bjørn Forsman
  2015-01-01 20:54 ` [Buildroot] [PATCH v2 1/2] kconfig/lxdialog: get ncurses CFLAGS with pkg-config Bjørn Forsman
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Bjørn Forsman @ 2015-01-01 20:54 UTC (permalink / raw)
  To: buildroot

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

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

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

* [Buildroot] [PATCH v2 1/2] kconfig/lxdialog: get ncurses CFLAGS with pkg-config
  2015-01-01 20:54 [Buildroot] [PATCH v2 0/2] Portability fixes for "make menuconfig" Bjørn Forsman
@ 2015-01-01 20:54 ` Bjørn Forsman
  2015-01-02 16:12   ` Yann E. MORIN
  2015-01-01 20:54 ` [Buildroot] [PATCH v2 2/2] Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time Bjørn Forsman
  2015-01-02 16:17 ` [Buildroot] [PATCH v2 0/2] Portability fixes for "make menuconfig" Yann E. MORIN
  2 siblings, 1 reply; 12+ messages in thread
From: Bjørn Forsman @ 2015-01-01 20:54 UTC (permalink / raw)
  To: 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 <bjorn.forsman@gmail.com>
---
 ...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

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..65973a3
--- /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?= <bjorn.forsman@gmail.com>
+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 <bjorn.forsman@gmail.com>
+Signed-off-by: Michal Marek <mmarek@suse.cz>
+---
+[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
+
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
-- 
2.1.3

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

* [Buildroot] [PATCH v2 2/2] Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time
  2015-01-01 20:54 [Buildroot] [PATCH v2 0/2] Portability fixes for "make menuconfig" Bjørn Forsman
  2015-01-01 20:54 ` [Buildroot] [PATCH v2 1/2] kconfig/lxdialog: get ncurses CFLAGS with pkg-config Bjørn Forsman
@ 2015-01-01 20:54 ` Bjørn Forsman
  2015-01-02 16:16   ` Yann E. MORIN
  2015-01-02 16:17 ` [Buildroot] [PATCH v2 0/2] Portability fixes for "make menuconfig" Yann E. MORIN
  2 siblings, 1 reply; 12+ messages in thread
From: Bjørn Forsman @ 2015-01-01 20:54 UTC (permalink / raw)
  To: buildroot

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/

Signed-off-by: Bj?rn Forsman <bjorn.forsman@gmail.com>
---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 5e0b4f2..2f1108f 100644
--- a/Makefile
+++ b/Makefile
@@ -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))
 
-- 
2.1.3

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

* [Buildroot] [PATCH v2 1/2] kconfig/lxdialog: get ncurses CFLAGS with pkg-config
  2015-01-01 20:54 ` [Buildroot] [PATCH v2 1/2] kconfig/lxdialog: get ncurses CFLAGS with pkg-config Bjørn Forsman
@ 2015-01-02 16:12   ` Yann E. MORIN
  0 siblings, 0 replies; 12+ messages in thread
From: Yann E. MORIN @ 2015-01-02 16:12 UTC (permalink / raw)
  To: buildroot

Bj?rn, All,

On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:
> 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 <bjorn.forsman@gmail.com>

Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  ...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
> 
> 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..65973a3
> --- /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?= <bjorn.forsman@gmail.com>
> +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 <bjorn.forsman@gmail.com>
> +Signed-off-by: Michal Marek <mmarek@suse.cz>
> +---
> +[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
> +
> 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
> -- 
> 2.1.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH v2 2/2] Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time
  2015-01-01 20:54 ` [Buildroot] [PATCH v2 2/2] Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time Bjørn Forsman
@ 2015-01-02 16:16   ` Yann E. MORIN
  2015-01-02 21:28     ` Bjørn Forsman
  0 siblings, 1 reply; 12+ messages in thread
From: Yann E. MORIN @ 2015-01-02 16:16 UTC (permalink / raw)
  To: buildroot

Bj?rn, All,

On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:
> 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/
> 
> Signed-off-by: Bj?rn Forsman <bjorn.forsman@gmail.com>
> ---
>  Makefile | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 5e0b4f2..2f1108f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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)

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

>  
>  DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
>  
> -- 
> 2.1.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH v2 0/2] Portability fixes for "make menuconfig"
  2015-01-01 20:54 [Buildroot] [PATCH v2 0/2] Portability fixes for "make menuconfig" Bjørn Forsman
  2015-01-01 20:54 ` [Buildroot] [PATCH v2 1/2] kconfig/lxdialog: get ncurses CFLAGS with pkg-config Bjørn Forsman
  2015-01-01 20:54 ` [Buildroot] [PATCH v2 2/2] Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time Bjørn Forsman
@ 2015-01-02 16:17 ` Yann E. MORIN
  2015-01-02 21:38   ` Bjørn Forsman
  2 siblings, 1 reply; 12+ messages in thread
From: Yann E. MORIN @ 2015-01-02 16:17 UTC (permalink / raw)
  To: buildroot

Bj?rn, All,

On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:
> 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.

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

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH v2 2/2] Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time
  2015-01-02 16:16   ` Yann E. MORIN
@ 2015-01-02 21:28     ` Bjørn Forsman
  2015-01-02 21:34       ` Bjørn Forsman
  2015-01-02 21:39       ` Yann E. MORIN
  0 siblings, 2 replies; 12+ messages in thread
From: Bjørn Forsman @ 2015-01-02 21:28 UTC (permalink / raw)
  To: buildroot

Hi Yann,

Thanks for the feedback. Comments below.

On 2 January 2015 at 17:16, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Bj?rn, All,
>
> On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:
>> 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/
>>
>> Signed-off-by: Bj?rn Forsman <bjorn.forsman@gmail.com>
>> ---
>>  Makefile | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 5e0b4f2..2f1108f 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -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)

Will fix.

>>  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)

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

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

* [Buildroot] [PATCH v2 2/2] Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time
  2015-01-02 21:28     ` Bjørn Forsman
@ 2015-01-02 21:34       ` Bjørn Forsman
  2015-01-02 21:43         ` Yann E. MORIN
  2015-01-02 21:39       ` Yann E. MORIN
  1 sibling, 1 reply; 12+ messages in thread
From: Bjørn Forsman @ 2015-01-02 21:34 UTC (permalink / raw)
  To: buildroot

On 2 January 2015 at 22:28, Bj?rn Forsman <bjorn.forsman@gmail.com> wrote:
> Hi Yann,
>
> Thanks for the feedback. Comments below.
>
> On 2 January 2015 at 17:16, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>> Bj?rn, All,
>>
>> On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:
>>> 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/
>>>
>>> Signed-off-by: Bj?rn Forsman <bjorn.forsman@gmail.com>
>>> ---
>>>  Makefile | 6 +++++-
>>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Makefile b/Makefile
>>> index 5e0b4f2..2f1108f 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -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)
>
> 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

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

* [Buildroot] [PATCH v2 0/2] Portability fixes for "make menuconfig"
  2015-01-02 16:17 ` [Buildroot] [PATCH v2 0/2] Portability fixes for "make menuconfig" Yann E. MORIN
@ 2015-01-02 21:38   ` Bjørn Forsman
  0 siblings, 0 replies; 12+ messages in thread
From: Bjørn Forsman @ 2015-01-02 21:38 UTC (permalink / raw)
  To: buildroot

On 2 January 2015 at 17:17, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Bj?rn, All,
>
> On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:
>> 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.

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

- Bj?rn

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

* [Buildroot] [PATCH v2 2/2] Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time
  2015-01-02 21:28     ` Bjørn Forsman
  2015-01-02 21:34       ` Bjørn Forsman
@ 2015-01-02 21:39       ` Yann E. MORIN
  2015-01-02 23:32         ` Bjørn Forsman
  1 sibling, 1 reply; 12+ messages in thread
From: Yann E. MORIN @ 2015-01-02 21:39 UTC (permalink / raw)
  To: buildroot

Bj?rn, All,

On 2015-01-02 22:28 +0100, Bj?rn Forsman spake thusly:
> On 2 January 2015 at 17:16, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:
> >> 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--]
> >> @@ -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)
> 
> 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.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH v2 2/2] Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time
  2015-01-02 21:34       ` Bjørn Forsman
@ 2015-01-02 21:43         ` Yann E. MORIN
  0 siblings, 0 replies; 12+ messages in thread
From: Yann E. MORIN @ 2015-01-02 21:43 UTC (permalink / raw)
  To: buildroot

Bj?rn, All,

On 2015-01-02 22:34 +0100, Bj?rn Forsman spake thusly:
> On 2 January 2015 at 22:28, Bj?rn Forsman <bjorn.forsman@gmail.com> wrote:
> > On 2 January 2015 at 17:16, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> >> Bj?rn, All,
> >>
> >> On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:
> >>> 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/
> >>>
> >>> Signed-off-by: Bj?rn Forsman <bjorn.forsman@gmail.com>
> >>> ---
> >>>  Makefile | 6 +++++-
> >>>  1 file changed, 5 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/Makefile b/Makefile
> >>> index 5e0b4f2..2f1108f 100644
> >>> --- a/Makefile
> >>> +++ b/Makefile
> >>> @@ -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)
> >
> > 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.

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

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH v2 2/2] Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time
  2015-01-02 21:39       ` Yann E. MORIN
@ 2015-01-02 23:32         ` Bjørn Forsman
  0 siblings, 0 replies; 12+ messages in thread
From: Bjørn Forsman @ 2015-01-02 23:32 UTC (permalink / raw)
  To: buildroot

On 2 January 2015 at 22:39, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Bj?rn, All,
>
> On 2015-01-02 22:28 +0100, Bj?rn Forsman spake thusly:
>> On 2 January 2015 at 17:16, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>> > On 2015-01-01 21:54 +0100, Bj?rn Forsman spake thusly:
>> >> 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--]
>> >> @@ -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)
>>
>> 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.

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

- Bj?rn

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

end of thread, other threads:[~2015-01-02 23:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-01 20:54 [Buildroot] [PATCH v2 0/2] Portability fixes for "make menuconfig" Bjørn Forsman
2015-01-01 20:54 ` [Buildroot] [PATCH v2 1/2] kconfig/lxdialog: get ncurses CFLAGS with pkg-config Bjørn Forsman
2015-01-02 16:12   ` Yann E. MORIN
2015-01-01 20:54 ` [Buildroot] [PATCH v2 2/2] Makefile: pass host PKG_CONFIG_PATH at "make menuconfig" time Bjørn Forsman
2015-01-02 16:16   ` Yann E. MORIN
2015-01-02 21:28     ` Bjørn Forsman
2015-01-02 21:34       ` Bjørn Forsman
2015-01-02 21:43         ` Yann E. MORIN
2015-01-02 21:39       ` Yann E. MORIN
2015-01-02 23:32         ` Bjørn Forsman
2015-01-02 16:17 ` [Buildroot] [PATCH v2 0/2] Portability fixes for "make menuconfig" Yann E. MORIN
2015-01-02 21:38   ` Bjørn Forsman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox