summaryrefslogtreecommitdiffstats
path: root/taskcluster/scripts/misc/repack-clang.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
commit9e3c08db40b8916968b9f30096c7be3f00ce9647 (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /taskcluster/scripts/misc/repack-clang.sh
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'taskcluster/scripts/misc/repack-clang.sh')
-rwxr-xr-xtaskcluster/scripts/misc/repack-clang.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/taskcluster/scripts/misc/repack-clang.sh b/taskcluster/scripts/misc/repack-clang.sh
new file mode 100755
index 0000000000..4a1b3ed01e
--- /dev/null
+++ b/taskcluster/scripts/misc/repack-clang.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+set -x -e -v
+
+shopt -s nullglob
+
+# This script is for repacking clang for cross targets on a Linux host.
+
+cd $MOZ_FETCHES_DIR
+
+# We have a clang toolchain in $MOZ_FETCHES_DIR/clang
+# We have some compiler-rts in $MOZ_FETCHES_DIR/compiler-rt*
+# We have some libunwinds in $MOZ_FETCHES_DIR/libunwind*
+# We copy everything from the compiler-rts into clang/lib/clang/$version/
+# and everything from the libunwinds into clang/
+clang_ver_dir=$(echo clang/lib/clang/*/include)
+clang_ver_dir=${clang_ver_dir%/include}
+[ -n "$clang_ver_dir" ] && for c in compiler-rt* libunwind*; do
+ case $c in
+ compiler-rt*)
+ clang_dir=$clang_ver_dir
+ ;;
+ libunwind*)
+ clang_dir=clang
+ ;;
+ esac
+ find $c -mindepth 1 -type d | while read d; do
+ mkdir -p "$clang_dir/${d#$c/}"
+ find $d -mindepth 1 -maxdepth 1 -not -type d | while read f; do
+ target_file="$clang_dir/${f#$c/}"
+ case $d in
+ compiler-rt-*/lib/darwin)
+ if [ -f "$target_file" ]; then
+ # Unify overlapping files for darwin/
+ $MOZ_FETCHES_DIR/cctools/bin/lipo -create "$f" "$target_file" -output "$target_file.new"
+ mv "$target_file.new" "$target_file"
+ continue
+ fi
+ ;;
+ esac
+ if [ -f "$target_file" ] && ! diff -q "$f" "$target_file" 2>/dev/null; then
+ echo "Cannot copy $f because it is already in ${target_file%/*}" >&2 && exit 1
+ fi
+ cp "$f" "$target_file"
+ done
+ done
+done
+
+if [ -n "$UPLOAD_DIR" ]; then
+ tar caf clang.tar.zst clang
+ mkdir -p $UPLOAD_DIR
+ mv clang.tar.zst $UPLOAD_DIR
+fi