Skip to content

Commit a6a1b10

Browse files
fanquakedongcarl
andcommitted
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 <[email protected]>
1 parent 5bb64ac commit a6a1b10

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

contrib/guix/guix-build.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,24 @@ done
136136
# environment)
137137
MAX_JOBS="${MAX_JOBS:-$(nproc)}"
138138

139+
# Usage: host_to_commonname HOST
140+
#
141+
# HOST: The current platform triple we're building for
142+
#
143+
host_to_commonname() {
144+
case "$1" in
145+
*darwin*) echo osx ;;
146+
*mingw*) echo win ;;
147+
*linux*) echo linux ;;
148+
*) exit 1 ;;
149+
esac
150+
}
151+
139152
# Download the depends sources now as we won't have internet access in the build
140153
# container
141-
make -C "${PWD}/depends" -j"$MAX_JOBS" download ${V:+V=1} ${SOURCES_PATH:+SOURCES_PATH="$SOURCES_PATH"}
154+
for host in $HOSTS; do
155+
make -C "${PWD}/depends" -j"$MAX_JOBS" download-"$(host_to_commonname "$host")" ${V:+V=1} ${SOURCES_PATH:+SOURCES_PATH="$SOURCES_PATH"}
156+
done
142157

143158
# Determine the reference time used for determinism (overridable by environment)
144159
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(git log --format=%at -1)}"

0 commit comments

Comments
 (0)