From 670c2b80ab38676ffd92ff3ac1981b00505f392f Mon Sep 17 00:00:00 2001 From: Kristofer Peterson Date: Mon, 4 Sep 2023 21:25:33 +0200 Subject: [PATCH] Add freebsd/amd64 platform (FreeBSD 13.2-RELEASE-p2 GENERIC amd64) --- build.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/build.sh b/build.sh index b5ce7432a2a29..ff3c2bf51a5d3 100755 --- a/build.sh +++ b/build.sh @@ -9,6 +9,7 @@ fi unameOut="$(uname -s)-$(uname -m)" case "${unameOut}" in + FreeBSD-amd64*) HOST_TRIPLE=x86_64-unknown-freebsd;; Linux-x86_64*) HOST_TRIPLE=x86_64-unknown-linux-gnu;; Linux-aarch64*) HOST_TRIPLE=aarch64-unknown-linux-gnu;; Darwin-x86_64*) HOST_TRIPLE=x86_64-apple-darwin;; @@ -17,6 +18,24 @@ case "${unameOut}" in *) HOST_TRIPLE=x86_64-unknown-linux-gnu esac +if [[ "${HOST_TRIPLE}" == *-freebsd ]]; then + if [[ "$(swig -swiglib)" == */4.1.* ]]; then + # Default swig 4.1.2 on FreeBSD 13.x doesn't work due to + # broken %nothreadallow / %clearnothreadallow directives + # Use swig40 instead + fgrep -wq 'SWIG_EXECUTABLE' config.toml || + ed config.toml <<-'EOF' + /^\[llvm\]/a + + # Custom CMake defines to set when building LLVM. + build-config = { SWIG_EXECUTABLE = '/usr/local/bin/swig40' } + . + +1,$g/^ *build-config *=/d + w + EOF + fi +fi + if [ "$1" == "--llvm" ]; then rm -f build/${HOST_TRIPLE}/llvm/llvm-finished-building; fi