summaryrefslogtreecommitdiffstats
path: root/taskcluster/scripts/misc/wrench-macos-build.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /taskcluster/scripts/misc/wrench-macos-build.sh
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'taskcluster/scripts/misc/wrench-macos-build.sh')
-rwxr-xr-xtaskcluster/scripts/misc/wrench-macos-build.sh58
1 files changed, 58 insertions, 0 deletions
diff --git a/taskcluster/scripts/misc/wrench-macos-build.sh b/taskcluster/scripts/misc/wrench-macos-build.sh
new file mode 100755
index 0000000000..43842d4510
--- /dev/null
+++ b/taskcluster/scripts/misc/wrench-macos-build.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+set -x -e -v
+
+source ${GECKO_PATH}/taskcluster/scripts/misc/wr-macos-cross-build-setup.sh
+
+# The osmesa-src build which we do as part of the headless build below
+# doesn't seem to always use CFLAGS/CXXFLAGS where expected. Instead we
+# just squash those flags into CC/CXX and everything works out.
+# Export HOST_CC and HOST_CXX without the squashed flags, so that host
+# builds use them and don't see the target flags.
+export HOST_CC="${CC}"
+export HOST_CXX="${CXX}"
+CFLAGS_VAR="CFLAGS_${TARGET_TRIPLE//-/_}"
+CXXFLAGS_VAR="CXXFLAGS_${TARGET_TRIPLE//-/_}"
+export CC="${CC} ${!CFLAGS_VAR}"
+export ${CFLAGS_VAR}=
+export CXX="${CXX} ${!CXXFLAGS_VAR}"
+export ${CXXFLAGS_VAR}=
+
+export MESON_CROSSFILE=${GECKO_PATH}/gfx/wr/ci-scripts/etc/wr-darwin.meson
+export UPLOAD_DIR="${HOME}/artifacts"
+mkdir -p "${UPLOAD_DIR}"
+
+# Do a cross-build without the `headless` feature
+pushd "${GECKO_PATH}/gfx/wr/wrench"
+cargo build --release -vv --frozen --target=${TARGET_TRIPLE}
+# Package up the resulting wrench binary
+cd "../target/${TARGET_TRIPLE}"
+mkdir -p wrench-macos/bin
+mv release/wrench wrench-macos/bin/
+tar cjf wrench-macos.tar.bz2 wrench-macos
+mv wrench-macos.tar.bz2 "${UPLOAD_DIR}"
+# Clean the build
+cd "${GECKO_PATH}/gfx/wr"
+rm -rf target
+popd
+
+# Do a cross-build with the `headless` feature
+pushd "${GECKO_PATH}/gfx/wr/wrench"
+cargo build --release -vv --frozen --target=${TARGET_TRIPLE} --features headless
+# Package up the wrench binary and some libraries that we will need
+cd "../target/${TARGET_TRIPLE}"
+
+# Copy the native macOS libLLVM as dynamic dependency
+cp "${MOZ_FETCHES_DIR}/clang-mac/clang/lib/libLLVM.dylib" release/build/osmesa-src*/out/mesa/src/gallium/targets/osmesa/
+
+mkdir wrench-macos-headless
+mv release wrench-macos-headless/
+tar cjf wrench-macos-headless.tar.bz2 \
+ wrench-macos-headless/release/wrench \
+ wrench-macos-headless/release/build/osmesa-src*/out/mesa/src/gallium/targets/osmesa \
+ wrench-macos-headless/release/build/osmesa-src*/out/mesa/src/mapi/shared-glapi
+mv wrench-macos-headless.tar.bz2 "${UPLOAD_DIR}"
+
+# Clean the build
+cd "${GECKO_PATH}/gfx/wr"
+rm -rf target
+popd