aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-02-01 11:54:40 +0800
committerfanquake <fanquake@gmail.com>2021-02-22 10:49:05 +0800
commita6a1b106dcc4350e420c461171c47e4934087175 (patch)
treef69bb1663865fd1ecdd44d7f9ef5dddffca5dcac /contrib
parent5bb64acd9d3ced6e6f95df282a1a0f8b98522cb0 (diff)
guix: only download sources for hosts being built
If a user is only interested in building for Linux, this saves downloading the macOS compiler and additional dependencies. This will result in a few additional `make` invocations, for the Linux hosts, however this is quite low overhead. Co-authored-by: Carl Dong <contact@carldong.me>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/guix/guix-build.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/contrib/guix/guix-build.sh b/contrib/guix/guix-build.sh
index f29ea9b910..643541de53 100755
--- a/contrib/guix/guix-build.sh
+++ b/contrib/guix/guix-build.sh
@@ -136,9 +136,24 @@ done
# environment)
MAX_JOBS="${MAX_JOBS:-$(nproc)}"
+# Usage: host_to_commonname HOST
+#
+# HOST: The current platform triple we're building for
+#
+host_to_commonname() {
+ case "$1" in
+ *darwin*) echo osx ;;
+ *mingw*) echo win ;;
+ *linux*) echo linux ;;
+ *) exit 1 ;;
+ esac
+}
+
# Download the depends sources now as we won't have internet access in the build
# container
-make -C "${PWD}/depends" -j"$MAX_JOBS" download ${V:+V=1} ${SOURCES_PATH:+SOURCES_PATH="$SOURCES_PATH"}
+for host in $HOSTS; do
+ make -C "${PWD}/depends" -j"$MAX_JOBS" download-"$(host_to_commonname "$host")" ${V:+V=1} ${SOURCES_PATH:+SOURCES_PATH="$SOURCES_PATH"}
+done
# Determine the reference time used for determinism (overridable by environment)
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(git log --format=%at -1)}"