summaryrefslogtreecommitdiffstats
path: root/taskcluster/scripts/misc/repack-clang-linux-macosx-cross.sh
diff options
context:
space:
mode:
Diffstat (limited to 'taskcluster/scripts/misc/repack-clang-linux-macosx-cross.sh')
-rwxr-xr-xtaskcluster/scripts/misc/repack-clang-linux-macosx-cross.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/taskcluster/scripts/misc/repack-clang-linux-macosx-cross.sh b/taskcluster/scripts/misc/repack-clang-linux-macosx-cross.sh
new file mode 100755
index 0000000000..c06ddd1411
--- /dev/null
+++ b/taskcluster/scripts/misc/repack-clang-linux-macosx-cross.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+set -x -e -v
+
+# This script is for building clang for macOS targets on a Linux host,
+# including native macOS Compiler-RT libraries.
+
+cd $MOZ_FETCHES_DIR
+
+# We have a native linux64 toolchain in $MOZ_FETCHES_DIR/clang
+# We have a native aarch64 macos compiler-rt in $MOZ_FETCHES_DIR/aarch64/compiler-rt
+# We have a native x86_64 macos compiler-rt in $MOZ_FETCHES_DIR/x86_64/compiler-rt
+clang_lib=$(echo clang/lib/clang/*/lib)
+mkdir -p $clang_lib/darwin
+find {aarch64,x86_64}/compiler-rt/lib/darwin -type f -printf '%f\n' | sort -u | while read f; do
+ f=compiler-rt/lib/darwin/$f
+ if [ -f aarch64/$f -a -f x86_64/$f ]; then
+ # For compiler-rt files that exist on both ends, merge them
+ $MOZ_FETCHES_DIR/cctools/bin/lipo -create {aarch64,x86_64}/$f -output $clang_lib/darwin/${f##*/}
+ elif [ -f aarch64/$f ]; then
+ # For compiler-rt files that exist on either end, copy the existing one
+ cp aarch64/$f $clang_lib/darwin
+ else
+ cp x86_64/$f $clang_lib/darwin
+ fi
+done
+
+tar -cf - clang | python3 $GECKO_PATH/taskcluster/scripts/misc/zstdpy > clang.tar.zst
+
+mkdir -p $UPLOAD_DIR
+mv clang.tar.zst $UPLOAD_DIR