build: backport a few patches for better Make 4.2+ support

This commit is contained in:
Matthias Schiffer 2016-06-15 19:32:15 +02:00
parent 1059a798ef
commit 20e57a1c71
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
3 changed files with 102 additions and 0 deletions

View File

@ -0,0 +1,24 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 15 Jun 2016 19:31:08 +0200
Subject: scripts: feeds: fix version detection for Make >= 4.2.1
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Backport of LEDE df18b3756fef6a28d9194368d3156f0cd85fae19
diff --git a/scripts/feeds b/scripts/feeds
index f8f29cd..908e56c 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -22,7 +22,10 @@ my @mkver = split /\s+/, `$mk -v`, 4;
my $valid_mk = 1;
$mkver[0] =~ /^GNU/ or $valid_mk = 0;
$mkver[1] =~ /^Make/ or $valid_mk = 0;
-$mkver[2] >= "3.81" or $valid_mk = 0;
+
+my ($mkv1, $mkv2) = split /\./, $mkver[2];
+($mkv1 >= 4 || ($mkv1 == 3 && $mkv2 >= 81)) or $valid_mk = 0;
+
$valid_mk or die "Unsupported version of make found: $mk\n";
my @feeds;

View File

@ -0,0 +1,48 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 15 Jun 2016 19:31:34 +0200
Subject: build: don't add -j for parallel builds with Make 4.2+
Make usually passes -j and jobserver arguments as part of MAKEFLAGS. LEDE
removes MAKEFLAGS to have better control of the build, and re-adds the
jobserver arguments with -j to the Make commandline where desired.
Make 4.2+ behave differently with these arguments passed on the commandline
than in MAKEFLAGS: -j will override the jobserver argument and the job
count will be unlimited.
Moving the flags to MAKEFLAGS will need many packages to be changed and
tested; therefore, we opt for a less invasive change for now and just
remove -j for Make 4.2+, as the jobserver argument alone is enough to
enable parallel builds for these Make versions.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Backport of LEDE 6fb212f2933bbbdf2935124205717c9d0ca72b32
diff --git a/include/host-build.mk b/include/host-build.mk
index e2b5f2f..44401b8 100644
--- a/include/host-build.mk
+++ b/include/host-build.mk
@@ -10,7 +10,7 @@ HOST_INSTALL_DIR ?= $(HOST_BUILD_DIR)/host-install
HOST_BUILD_PARALLEL ?=
ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
- HOST_MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j)
+ HOST_MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
else
HOST_MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS)
endif
diff --git a/include/package.mk b/include/package.mk
index c69d928..a99cdc6 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -23,7 +23,7 @@ PKG_RELRO_PARTIAL ?= 1
PKG_RELRO_FULL ?= 1
ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
- MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j)
+ MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
else
MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS)
endif

View File

@ -0,0 +1,30 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 15 Jun 2016 19:31:49 +0200
Subject: tools/cmake: fix parallel build with Make 4.2+
Avoid using the --parallel argument to the CMake bootstrap, as that doesn't
allow us to remove the -j argument. Instead, pass the HOST_JOBS arguments
in MAKEFLAGS.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Backport of LEDE 96db10752483cb07f822686482b44be6c21fbb5f
diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile
index 08e2b02..6c211de 100644
--- a/tools/cmake/Makefile
+++ b/tools/cmake/Makefile
@@ -18,10 +18,11 @@ HOST_CONFIGURE_PARALLEL:=1
include $(INCLUDE_DIR)/host-build.mk
+HOST_CONFIGURE_CMD := MAKEFLAGS="$(HOST_JOBS)" $(BASH) ./configure
+
HOST_CONFIGURE_VARS :=
HOST_CONFIGURE_ARGS := \
- --prefix=$(STAGING_DIR_HOST) \
- $(if $(MAKE_JOBSERVER),--parallel="$(MAKE_JOBSERVER)")
+ --prefix=$(STAGING_DIR_HOST)
$(eval $(call HostBuild))