Skip to content

Commit

Permalink
Add freebsd/amd64 platform (FreeBSD 13.2-RELEASE-p2 GENERIC amd64)
Browse files Browse the repository at this point in the history
  • Loading branch information
svenski123 authored and dmakarov committed Sep 5, 2023
1 parent 768cf39 commit 670c2b8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;;
Expand All @@ -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
Expand Down

0 comments on commit 670c2b8

Please sign in to comment.