Skip to content

Commit 74eeae9

Browse files
committed
external_deps: add freebsd-amd64 and freebsd-i686 platforms
1 parent bc272ec commit 74eeae9

1 file changed

Lines changed: 46 additions & 5 deletions

File tree

external_deps/build.sh

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,9 @@ build_jpeg() {
685685
linux-*-*)
686686
local SYSTEM_NAME='Linux'
687687
;;
688+
freebsd-*-*)
689+
local SYSTEM_NAME='FreeBSD'
690+
;;
688691
*)
689692
# Other platforms can build but we need to explicitly
690693
# set CMAKE_SYSTEM_NAME for CMAKE_CROSSCOMPILING to be set
@@ -1142,7 +1145,7 @@ build_naclsdk() {
11421145
local NACLSDK_PLATFORM=mac
11431146
local TAR_EXT=tar
11441147
;;
1145-
linux-*-*)
1148+
linux-*-*|freebsd-*-*)
11461149
local NACLSDK_PLATFORM=linux
11471150
local TAR_EXT=tar
11481151
;;
@@ -1202,7 +1205,7 @@ build_naclsdk() {
12021205
esac
12031206

12041207
case "${PLATFORM}" in
1205-
linux-*-*)
1208+
linux-*-*|freebsd-*-*)
12061209
# Fix permissions on a few files which deny access to non-owner
12071210
chmod 644 "${PREFIX}/irt_core-${DAEMON_ARCH}.nexe"
12081211
;;
@@ -1439,7 +1442,7 @@ build_install() {
14391442
# Fix import lib paths to use MSVC-style instead of MinGW ones (see 'genlib' target)
14401443
find "${PKG_PREFIX}/lib/cmake" -name '*.cmake' -execdir sed -i -E 's@[.]dll[.]a\b@.lib@g' {} \;
14411444
;;
1442-
linux-*-*)
1445+
linux-*-*|freebsd-*-*)
14431446
find "${PKG_PREFIX}/lib" -name '*.so' -execdir rm -f -- {} \;
14441447
find "${PKG_PREFIX}/lib" -name '*.so.*' -execdir rm -f -- {} \;
14451448
find "${PKG_PREFIX}/lib" -name '*_g.a' -execdir rm -f -- {} \;
@@ -1636,6 +1639,15 @@ common_setup_linux() {
16361639
CXXFLAGS+=' -fPIC'
16371640
}
16381641

1642+
common_setup_freebsd() {
1643+
CC='clang'
1644+
CXX='clang++'
1645+
STRIP='strip'
1646+
CFLAGS+=" -target ${HOST}"
1647+
CXXFLAGS+=" -target ${HOST}"
1648+
LDFLAGS+=" -target ${HOST}"
1649+
}
1650+
16391651
common_setup_native() {
16401652
case "$(uname -s)" in
16411653
CYGWIN_NT-*|MSYS_NT-*|MINGW*_NT-*)
@@ -1777,6 +1789,18 @@ setup_linux-loong64-default() {
17771789
common_setup linux loongarch64-linux-gnu
17781790
}
17791791

1792+
# Set up environment for 32-bit i686 FreeBSD
1793+
setup_freebsd-i686-default() {
1794+
setup_default
1795+
common_setup freebsd i386-unknown-freebsd
1796+
}
1797+
1798+
# Set up environment for 64-bit amd64 FreeBSD
1799+
setup_freebsd-amd64-default() {
1800+
setup_default
1801+
common_setup freebsd x86_64-unknown-freebsd
1802+
}
1803+
17801804
# Set up environment for native host tools
17811805
setup_native() {
17821806
setup_default
@@ -1840,19 +1864,27 @@ all_linux_ppc64el_default_packages="${all_linux_arm64_default_packages}"
18401864
base_linux_loong64_default_packages="${base_linux_arm64_default_packages}"
18411865
all_linux_loong64_default_packages="${all_linux_arm64_default_packages}"
18421866

1867+
# FIXME: The naclruntime will fail to build, we need to download a prebuilt one.
1868+
base_freebsd_amd64_default_packages='sdl3 naclsdk saigosdk'
1869+
all_freebsd_amd64_default_packages='gmp nettle sdl3 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk saigosdk'
1870+
1871+
base_freebsd_i686_default_packages="${base_freebsd_amd64_default_packages}"
1872+
all_freebsd_i686_default_packages="${all_freebsd_amd64_default_packages}"
1873+
18431874
supported_linux_platforms='linux-amd64-default linux-arm64-default linux-armhf-default linux-i686-default'
18441875
supported_windows_platforms='windows-amd64-mingw windows-amd64-msvc windows-i686-mingw windows-i686-msvc'
18451876
supported_macos_platforms='macos-amd64-default macos-arm64-default'
18461877

18471878
extra_linux_platforms='linux-armel-default linux-riscv64-default linux-ppc64el-default linux-loong64-default'
1879+
extra_freebsd_platforms='freebsd-amd64-default freebsd-i686-default'
18481880

18491881
supported_platforms="${supported_linux_platforms} ${supported_windows_platforms} ${supported_macos_platforms}"
18501882

18511883
all_linux_platforms="${supported_linux_platforms} ${extra_linux_platforms}"
18521884
all_windows_platforms="${supported_windows_platforms}"
18531885
all_macos_platforms="${supported_macos_platforms}"
18541886

1855-
all_platforms="${all_linux_platforms} ${all_windows_platforms} ${all_macos_platforms}"
1887+
all_platforms="${all_linux_platforms} ${all_windows_platforms} ${all_macos_platforms} ${extra_freebsd_platforms}"
18561888

18571889
printHelp() {
18581890
# Please align to 4-space tabs.
@@ -1874,7 +1906,8 @@ printHelp() {
18741906
supported-macos ${supported_macos_platforms}
18751907
supported supported-linux supported-windows supported-macos
18761908
extra-linux ${extra_linux_platforms}
1877-
extra extra-linux
1909+
extra-freebsd ${extra_freebsd_platforms}
1910+
extra extra-linux extra-freebsd
18781911
all-linux linux extra-linux
18791912
all supported extra
18801913
@@ -1922,6 +1955,11 @@ printHelp() {
19221955
base ${base_linux_arm64_default_packages}
19231956
all ${all_linux_arm64_default_packages}
19241957
1958+
freebsd-amd64-default:
1959+
freebsd-i686-default:
1960+
base ${base_freebsd_amd64_default_packages}
1961+
all ${all_freebsd_amd64_default_packages}
1962+
19251963
EOF
19261964

19271965
exit
@@ -1998,6 +2036,9 @@ supported-linux)
19982036
extra-linux)
19992037
platform_list="${extra_linux_platforms}"
20002038
;;
2039+
extra-freebsd)
2040+
platform_list="${extra_freebsd_platforms}"
2041+
;;
20012042
all-windows)
20022043
platform_list="${all_windows_platforms}"
20032044
;;

0 commit comments

Comments
 (0)