Bug 1367940 - Pass the make jobserver file descriptors down to cargo. r?gps draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 13 Jul 2017 20:07:49 +0900
changeset 608676 e84175b2e5117be34d44cb0252fc1a61ac3c739d
parent 608658 67cd1ee26f2661fa5efe3d952485ab3c89af4271
child 608677 627a72c250a746e081ff95368882548a2c6908e3
push id68369
push userbmo:mh+mozilla@glandium.org
push dateFri, 14 Jul 2017 01:37:53 +0000
reviewersgps
bugs1367940
milestone56.0a1
Bug 1367940 - Pass the make jobserver file descriptors down to cargo. r?gps cargo 1.19, and later cargo 1.20/rustc 1.19 gained support for the make jobserver. But that doesn't work unless make passes the jobserver file descriptors down to subprocesses, which it only does when there is a + prefixing commands.
config/rules.mk
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -908,18 +908,21 @@ endif
 
 # XXX hack to work around dsymutil failing on cross-OSX builds (bug 1380381)
 ifeq ($(HOST_OS_ARCH)-$(OS_ARCH),Linux-Darwin)
 rust_debug_info=1
 else
 rust_debug_info=2
 endif
 
+# We use the + prefix to pass down the jobserver fds to cargo, but we
+# don't use the prefix when make -n is used, so that cargo doesn't run
+# in that case)
 define RUN_CARGO
-env $(environment_cleaner) $(rust_unlock_unstable) $(rustflags_override) $(sccache_wrap) \
+$(if $(findstring n,$(filter-out --%, $(MAKEFLAGS))),,+)env $(environment_cleaner) $(rust_unlock_unstable) $(rustflags_override) $(sccache_wrap) \
 	CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) \
 	RUSTC=$(RUSTC) \
 	RUSTFLAGS='-C debuginfo=$(rust_debug_info)' \
 	MOZ_SRC=$(topsrcdir) \
 	MOZ_DIST=$(ABS_DIST) \
 	LIBCLANG_PATH="$(MOZ_LIBCLANG_PATH)" \
 	CLANG_PATH="$(MOZ_CLANG_PATH)" \
 	PKG_CONFIG_ALLOW_CROSS=1 \