Skip to content

Commit 522c10e

Browse files
authored
Merge pull request #2407 from swiftwasm/apple-silicon-scripts
Apple Silicon: avoid hardcoding host arch in build scripts
2 parents b98359d + 92ad1ad commit 522c10e

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

utils/webassembly/build-presets.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cmake-c-launcher=%(C_CXX_LAUNCHER)s
77
cmake-cxx-launcher=%(C_CXX_LAUNCHER)s
88
skip-build-benchmarks
99
llvm-targets-to-build=X86;AArch64;WebAssembly
10-
swift-darwin-supported-archs=x86_64
10+
swift-darwin-supported-archs=%(HOST_ARCHITECTURE)s
1111
compiler-vendor=swiftwasm
1212
enable-experimental-concurrency=0
1313

utils/webassembly/build-toolchain.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ WASI_SDK_PATH=$SOURCE_PATH/wasi-sdk
88

99
case $(uname -s) in
1010
Darwin)
11-
OS_SUFFIX=macos_x86_64
11+
OS_SUFFIX=macos_$(uname -m)
1212
HOST_PRESET=webassembly-host-install
13-
HOST_SUFFIX=macosx-x86_64
13+
HOST_SUFFIX=macosx-$(uname -m)
1414
;;
1515
Linux)
1616
if [ "$(grep RELEASE /etc/lsb-release)" == "DISTRIB_RELEASE=18.04" ]; then
17-
OS_SUFFIX=ubuntu18.04_x86_64
17+
OS_SUFFIX=ubuntu18.04_$(uname -m)
1818
elif [ "$(grep RELEASE /etc/lsb-release)" == "DISTRIB_RELEASE=20.04" ]; then
19-
OS_SUFFIX=ubuntu20.04_x86_64
19+
OS_SUFFIX=ubuntu20.04_$(uname -m)
2020
else
2121
echo "Unknown Ubuntu version"
2222
exit 1
2323
fi
2424
HOST_PRESET=webassembly-linux-host-install
25-
HOST_SUFFIX=linux-x86_64
25+
HOST_SUFFIX=linux-$(uname -m)
2626
;;
2727
*)
2828
echo "Unrecognised platform $(uname -s)"
@@ -53,6 +53,7 @@ build_host_toolchain() {
5353
--preset-file="$UTILS_PATH/build-presets.ini" \
5454
--preset=$HOST_PRESET \
5555
--build-dir="$HOST_BUILD_DIR" \
56+
HOST_ARCHITECTURE=$(uname -m) \
5657
INSTALL_DESTDIR="$HOST_TOOLCHAIN_DESTDIR" \
5758
TOOLCHAIN_NAME="$TOOLCHAIN_NAME" \
5859
C_CXX_LAUNCHER="$(which sccache)"

utils/webassembly/ci.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ UTILS_PATH=$SWIFT_PATH/utils/webassembly
99
case $(uname -s) in
1010
Darwin)
1111
DEPENDENCIES_SCRIPT=$UTILS_PATH/macos/install-dependencies.sh
12-
HOST_SUFFIX=macosx-x86_64
12+
HOST_SUFFIX=macosx-$(uname -m)
1313
;;
1414
Linux)
1515
DEPENDENCIES_SCRIPT=$UTILS_PATH/linux/install-dependencies.sh
16-
HOST_SUFFIX=linux-x86_64
16+
HOST_SUFFIX=linux-$(uname -m)
1717
;;
1818
*)
1919
echo "Unrecognised platform $(uname -s)"

0 commit comments

Comments
 (0)