From: Felix Fietkau <nbd@nbd.name>
Date: Thu, 12 Jan 2017 13:31:40 +0000 (+0100)
Subject: cmake: restore parallel build support for bootstrap
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=d6de31310cc1924ff077f4f143efa6496e3323aa;p=openwrt%2Fstaging%2Fldir.git

cmake: restore parallel build support for bootstrap

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---

diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile
index a1137c5b50..c56cd40fb5 100644
--- a/tools/cmake/Makefile
+++ b/tools/cmake/Makefile
@@ -20,7 +20,9 @@ HOST_CONFIGURE_PARALLEL:=1
 include $(INCLUDE_DIR)/host-build.mk
 
 HOST_CONFIGURE_CMD := \
-	MAKEFLAGS="$(HOST_JOBS)" $(BASH) ./configure
+	MAKEFLAGS="$(HOST_JOBS)" \
+	$(BASH) ./configure \
+		$(if $(MAKE_JOBSERVER),--parallel="$(MAKE_JOBSERVER)")
 
 HOST_CONFIGURE_VARS :=
 
diff --git a/tools/cmake/patches/150-bootstrap_parallel_make_flag.patch b/tools/cmake/patches/150-bootstrap_parallel_make_flag.patch
new file mode 100644
index 0000000000..6970b83b32
--- /dev/null
+++ b/tools/cmake/patches/150-bootstrap_parallel_make_flag.patch
@@ -0,0 +1,14 @@
+--- a/bootstrap
++++ b/bootstrap
+@@ -958,7 +958,10 @@ int main(){ printf("1%c", (char)0x0a); r
+ ' > "test.c"
+ cmake_original_make_flags="${cmake_make_flags}"
+ if [ "x${cmake_parallel_make}" != "x" ]; then
+-  cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
++  case "$cmake_paralle_make" in
++    [0-9]*) cmake_parallel_make="-j ${cmake_parallel_make}";;
++  esac
++  cmake_make_flags="${cmake_make_flags} ${cmake_parallel_make}"
+ fi
+ for a in ${cmake_make_processors}; do
+   if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then