summaryrefslogtreecommitdiff
path: root/.github/scripts/build-hamlib-tsan-linux.sh
diff options
context:
space:
mode:
authorhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
committerhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
commitc25cbdf6fb6d946175f4335fab77bfea601b56db (patch)
tree6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /.github/scripts/build-hamlib-tsan-linux.sh
parent71f5689252c9f13e70e1c24856904475b2307809 (diff)
parent0685fcada9f95fe90f70b387cd7d757da8209624 (diff)
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to '.github/scripts/build-hamlib-tsan-linux.sh')
-rwxr-xr-x.github/scripts/build-hamlib-tsan-linux.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/.github/scripts/build-hamlib-tsan-linux.sh b/.github/scripts/build-hamlib-tsan-linux.sh
new file mode 100755
index 00000000..d3b37d57
--- /dev/null
+++ b/.github/scripts/build-hamlib-tsan-linux.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: build-hamlib-tsan-linux.sh PREFIX" >&2
+ exit 2
+fi
+
+script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
+# shellcheck source=.github/scripts/tsan-linux-deps-config.sh
+. "${script_dir}/tsan-linux-deps-config.sh"
+
+prefix=$1
+tsan_require_toolchain
+
+if [ -e "$prefix" ] && [ -n "$(ls -A "$prefix")" ]; then
+ echo "Hamlib TSan prefix already exists and is not empty: $prefix" >&2
+ exit 1
+fi
+
+build_root="$(mktemp -d "${RUNNER_TEMP:-/tmp}/wsjtx-hamlib-tsan.XXXXXX")"
+source_dir="${build_root}/hamlib-src"
+mkdir -p "$prefix" "$source_dir"
+
+git -C "$source_dir" init
+git -C "$source_dir" remote add origin https://github.com/Hamlib/Hamlib.git
+git -C "$source_dir" fetch --depth 1 origin "$TSAN_HAMLIB_COMMIT"
+git -C "$source_dir" checkout --detach FETCH_HEAD
+
+actual_commit="$(git -C "$source_dir" rev-parse HEAD)"
+if [ "$actual_commit" != "$TSAN_HAMLIB_COMMIT" ]; then
+ echo "Hamlib source commit mismatch: expected $TSAN_HAMLIB_COMMIT, got $actual_commit" >&2
+ exit 1
+fi
+
+git -C "$source_dir" fetch --depth 2 origin "$TSAN_HAMLIB_PATCH_COMMIT"
+git -C "$source_dir" cherry-pick --no-commit "$TSAN_HAMLIB_PATCH_COMMIT"
+
+cd "$source_dir"
+./bootstrap
+./configure \
+ --prefix="$prefix" \
+ --disable-shared --enable-static \
+ --without-indi \
+ --without-cxx-binding \
+ CC="$TSAN_CC" \
+ CFLAGS="${TSAN_SANITIZER_FLAGS} -fPIC -fdata-sections -ffunction-sections" \
+ LDFLAGS="${TSAN_LINK_FLAGS} -Wl,--gc-sections"
+make -j"$(nproc)"
+make install
+
+tsan_write_dependency_manifest hamlib "$prefix"