diff mbox series

[for-next:,1/2] package/make: add host variant

Message ID 20180830203054.7373-1-romain.naour@gmail.com
State Changes Requested
Headers show
Series [for-next:,1/2] package/make: add host variant | expand

Commit Message

Romain Naour Aug. 30, 2018, 8:30 p.m. UTC
Add host variant for make package since glibc 2.28 now require
GNU Make >= 4.0 [1].

We have to ceate gnumake and gmake symlinks to make generated by
Buildroot for the host. Otherwise the one provided by the host
system can be used instead.

The glibc build system is looking for gnumake and gmake before
make.

[1] https://www.sourceware.org/ml/libc-alpha/2018-08/msg00003.html

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/make/make.mk | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Thomas Petazzoni Sept. 1, 2018, 12:51 p.m. UTC | #1
Hello Romain,

Thanks for your work on this topic!

On Thu, 30 Aug 2018 22:30:53 +0200, Romain Naour wrote:

> We have to ceate gnumake and gmake symlinks to make generated by
> Buildroot for the host. Otherwise the one provided by the host
> system can be used instead.
> 
> The glibc build system is looking for gnumake and gmake before
> make.

But the PATH environment variable that we use has $(HOST_DIR)/bin
before the system /usr/bin, and therefore our make in
$(HOST_DIR)/bin/make should be found/used by the glibc build system
instead of the system /usr/bin/make.

Why isn't this working ?

Thanks,

Thomas
Romain Naour Sept. 1, 2018, 7:20 p.m. UTC | #2
Hi Thomas,

Le 01/09/2018 à 14:51, Thomas Petazzoni a écrit :
> Hello Romain,
> 
> Thanks for your work on this topic!
> 
> On Thu, 30 Aug 2018 22:30:53 +0200, Romain Naour wrote:
> 
>> We have to ceate gnumake and gmake symlinks to make generated by
>> Buildroot for the host. Otherwise the one provided by the host
>> system can be used instead.
>>
>> The glibc build system is looking for gnumake and gmake before
>> make.
> 
> But the PATH environment variable that we use has $(HOST_DIR)/bin
> before the system /usr/bin, and therefore our make in
> $(HOST_DIR)/bin/make should be found/used by the glibc build system
> instead of the system /usr/bin/make.
> 
> Why isn't this working ?

It is but glibc is looking at gnumake and gmake at first:

From [1]:
AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
  [GNU Make[^0-9]*\([0-9][0-9.]*\)],
  [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")

On your host (Fedora) you have a symlink to make named gmake (gmake -> make)

You can verify that glibc is using gmake instead of make by looking at config.log.

configure:4672: checking for gnumake
configure:4702: result: no
configure:4672: checking for gmake
configure:4688: found /usr/bin/gmake
configure:4699: result: gmake
configure:4714: checking version of gmake
configure:4724: result: 4.2.1, ok

We can verify that glibc build-system is really using gmake:
ac_cv_prog_MAKE=gmake

So if we want glibc build system to use the make binary provided by Buildroot we
must create gnumake and gmake symlink in $(HOST_DIR)/bin when installing host-make.

Best regards,
Romain

[1]
https://sourceware.org/git/?p=glibc.git;a=blob;f=configure.ac;h=014e09a5d58d102d208ddfaa192d844b1792d94f;hb=refs/heads/release/2.28/master#l952

> 
> Thanks,
> 
> Thomas
>
Thomas Petazzoni Sept. 2, 2018, 7:39 a.m. UTC | #3
Hello,

On Sat, 1 Sep 2018 21:20:36 +0200, Romain Naour wrote:

> From [1]:
> AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
>   [GNU Make[^0-9]*\([0-9][0-9.]*\)],
>   [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
> 
> On your host (Fedora) you have a symlink to make named gmake (gmake -> make)
> 
> You can verify that glibc is using gmake instead of make by looking at config.log.
> 
> configure:4672: checking for gnumake
> configure:4702: result: no
> configure:4672: checking for gmake
> configure:4688: found /usr/bin/gmake
> configure:4699: result: gmake
> configure:4714: checking version of gmake
> configure:4724: result: 4.2.1, ok

OK.

> We can verify that glibc build-system is really using gmake:
> ac_cv_prog_MAKE=gmake
> 
> So if we want glibc build system to use the make binary provided by Buildroot we
> must create gnumake and gmake symlink in $(HOST_DIR)/bin when installing host-make.

Or we can pass ac_cv_prog_MAKE=make. But OK, perhaps doing the symlinks
is better.

Thanks for the explanation!

Thomas
Romain Naour Sept. 2, 2018, 12:25 p.m. UTC | #4
Hi Thomas,

Le 02/09/2018 à 09:39, Thomas Petazzoni a écrit :
> Hello,
> 
> On Sat, 1 Sep 2018 21:20:36 +0200, Romain Naour wrote:
> 
>> From [1]:
>> AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
>>   [GNU Make[^0-9]*\([0-9][0-9.]*\)],
>>   [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
>>
>> On your host (Fedora) you have a symlink to make named gmake (gmake -> make)
>>
>> You can verify that glibc is using gmake instead of make by looking at config.log.
>>
>> configure:4672: checking for gnumake
>> configure:4702: result: no
>> configure:4672: checking for gmake
>> configure:4688: found /usr/bin/gmake
>> configure:4699: result: gmake
>> configure:4714: checking version of gmake
>> configure:4724: result: 4.2.1, ok
> 
> OK.
> 
>> We can verify that glibc build-system is really using gmake:
>> ac_cv_prog_MAKE=gmake
>>
>> So if we want glibc build system to use the make binary provided by Buildroot we
>> must create gnumake and gmake symlink in $(HOST_DIR)/bin when installing host-make.
> 
> Or we can pass ac_cv_prog_MAKE=make. But OK, perhaps doing the symlinks
> is better.

Indeed (I tried with this solution) but I believe that creating gnumake and
gmake symlinks in HOST_DIR is more bulletproof. I don't know if another package
is trying to use gnumake or gmake.

> 
> Thanks for the explanation!

You're welcome!

Best regards,
Romain

> 
> Thomas
>
diff mbox series

Patch

diff --git a/package/make/make.mk b/package/make/make.mk
index 01cd2eaa18..790391c76e 100644
--- a/package/make/make.mk
+++ b/package/make/make.mk
@@ -20,4 +20,18 @@  ifeq ($(BR2_STATIC_LIBS),y)
 MAKE_CONF_OPTS += --disable-load
 endif
 
+HOST_MAKE_DEPENDENCIES = host-pkgconf
+HOST_MAKE_CONF_OPTS = --without-guile
+
+# Some packages, like glibc, are looking for gnumake or gmake before
+# make program.
+# Create these symlink to use make binary generated by Buildroot for
+# the host.
+define HOST_MAKE_INSTALL_GNUMAKE
+	ln -fs make $(HOST_DIR)/bin/gnumake
+	ln -fs make $(HOST_DIR)/bin/gmake
+endef
+HOST_MAKE_POST_INSTALL_HOOKS += HOST_MAKE_INSTALL_GNUMAKE
+
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))