summaryrefslogtreecommitdiff
path: root/.github/scripts/normalize-armhf-sysroot-symlinks.sh
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
committerChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
commit69344560ea394c06ca94acac46a2e4c3e8b7b229 (patch)
treeebc98370a697a9bbd6b973a14fa5113c475c6db7 /.github/scripts/normalize-armhf-sysroot-symlinks.sh
parent3e9d10a67671d0bd5c7b8c3ca8088f1818322eff (diff)
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
Update upstream source from tag 'upstream/3.2.0_rc1+dfsg'
Update to upstream version '3.2.0~rc1+dfsg' with Debian dir dbff457fd2c3616d5c77b863c7bfb2186ed86047
Diffstat (limited to '.github/scripts/normalize-armhf-sysroot-symlinks.sh')
-rwxr-xr-x.github/scripts/normalize-armhf-sysroot-symlinks.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/.github/scripts/normalize-armhf-sysroot-symlinks.sh b/.github/scripts/normalize-armhf-sysroot-symlinks.sh
new file mode 100755
index 00000000..09a0403b
--- /dev/null
+++ b/.github/scripts/normalize-armhf-sysroot-symlinks.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: normalize-armhf-sysroot-symlinks.sh SYSROOT" >&2
+ exit 2
+fi
+
+sysroot=${1%/}
+if [ ! -d "$sysroot" ]; then
+ echo "ARMHF sysroot does not exist: $sysroot" >&2
+ exit 1
+fi
+
+# Debian packages may contain absolute library links. Make them relative so an
+# x86 linker cannot follow them into the builder host instead of the sysroot.
+count=0
+while IFS= read -r -d '' link; do
+ target="$(readlink -- "$link")"
+ case "$target" in
+ /*)
+ relative="$(realpath --canonicalize-missing \
+ --relative-to="$(dirname -- "$link")" "$sysroot$target")"
+ ln -sfn -- "$relative" "$link"
+ count=$((count + 1))
+ ;;
+ esac
+done < <(find "$sysroot" -type l -print0)
+
+echo "Normalized $count absolute ARMHF sysroot symlinks"