@@ -534,6 +534,10 @@ build_glew() {
534534 glew_env+=(CFLAGS.EXTRA=" ${CFLAGS} " )
535535 glew_options+=(LIBDIR=" ${PREFIX} /lib" LD=" ${CC} " )
536536 ;;
537+ freebsd-* -* )
538+ glew_env+=(CFLAGS.EXTRA=" ${CFLAGS} " )
539+ glew_options+=(SYSTEM=freebsd LD=" ${CC} " )
540+ ;;
537541 * )
538542 log ERROR ' Unsupported platform for GLEW'
539543 ;;
@@ -605,6 +609,9 @@ build_jpeg() {
605609 linux-* -* )
606610 local SYSTEM_NAME=' Linux'
607611 ;;
612+ freebsd-* -* )
613+ local SYSTEM_NAME=' FreeBSD'
614+ ;;
608615 * )
609616 # Other platforms can build but we need to explicitly
610617 # set CMAKE_SYSTEM_NAME for CMAKE_CROSSCOMPILING to be set
@@ -942,6 +949,9 @@ build_wasisdk() {
942949 linux-* -* )
943950 local WASISDK_PLATFORM=linux
944951 ;;
952+ * )
953+ log ERROR " wasi doesn't have release for ${PLATFORM} "
954+ ;;
945955 esac
946956 case " ${PLATFORM} " in
947957 * -amd64-* )
@@ -978,6 +988,9 @@ build_wasmtime() {
978988 local WASMTIME_PLATFORM=linux
979989 local ARCHIVE_EXT=tar.xz
980990 ;;
991+ * )
992+ log ERROR " wasmtime doesn't have release for ${PLATFORM} "
993+ ;;
981994 esac
982995 case " ${PLATFORM} " in
983996 * -amd64-* )
@@ -1017,7 +1030,7 @@ build_naclsdk() {
10171030 local EXE=
10181031 local TAR_EXT=tar
10191032 ;;
1020- linux-* -* )
1033+ linux-* -* |freebsd- * - * )
10211034 local NACLSDK_PLATFORM=linux
10221035 local EXE=
10231036 local TAR_EXT=tar
@@ -1047,7 +1060,7 @@ build_naclsdk() {
10471060
10481061 cp pepper_* " /tools/irt_core_${NACLSDK_ARCH} .nexe" " ${PREFIX} /irt_core-${DAEMON_ARCH} .nexe"
10491062 case " ${PLATFORM} " in
1050- linux-amd64-* )
1063+ linux-amd64-* |freebsd-amd64- * )
10511064 ;; # Get sel_ldr from naclruntime package
10521065 * )
10531066 cp pepper_* " /tools/sel_ldr_${NACLSDK_ARCH}${EXE} " " ${PREFIX} /nacl_loader${EXE} "
@@ -1077,7 +1090,7 @@ build_naclsdk() {
10771090 cp pepper_* " /tools/sel_ldr_x86_64.exe" " ${PREFIX} /nacl_loader-amd64.exe"
10781091 cp pepper_* " /tools/irt_core_x86_64.nexe" " ${PREFIX} /irt_core-amd64.nexe"
10791092 ;;
1080- linux-amd64-* )
1093+ linux-amd64-* |freebsd-amd64- * )
10811094 # Fix permissions on a few files which deny access to non-owner
10821095 chmod 644 " ${PREFIX} /irt_core-${DAEMON_ARCH} .nexe"
10831096 ;;
@@ -1258,7 +1271,7 @@ build_install() {
12581271 # Fix import lib paths to use MSVC-style instead of MinGW ones (see 'genlib' target)
12591272 find " ${PKG_PREFIX} /lib/cmake" -name ' *.cmake' -execdir sed -i -E ' s@[.]dll[.]a\b@.lib@g' {} \;
12601273 ;;
1261- linux-* -* )
1274+ linux-* -* |freebsd- * - * )
12621275 find " ${PKG_PREFIX} /lib" -name ' *.so' -execdir rm -f -- {} \;
12631276 find " ${PKG_PREFIX} /lib" -name ' *.so.*' -execdir rm -f -- {} \;
12641277 find " ${PKG_PREFIX} /lib" -name ' *_g.a' -execdir rm -f -- {} \;
@@ -1416,6 +1429,15 @@ common_setup_linux() {
14161429 CXXFLAGS+=' -fPIC'
14171430}
14181431
1432+ common_setup_freebsd () {
1433+ CC=' clang'
1434+ CXX=' clang++'
1435+ STRIP=' strip'
1436+ CFLAGS+=" -target ${HOST} "
1437+ CXXFLAGS+=" -target ${HOST} "
1438+ LDFLAGS+=" -target ${HOST} "
1439+ }
1440+
14191441# Set up environment for 32-bit i686 Windows for Visual Studio (compile all as .dll)
14201442setup_windows-i686-msvc () {
14211443 BITNESS=32
@@ -1484,6 +1506,11 @@ setup_linux-riscv64-default() {
14841506 common_setup linux riscv64-unknown-linux-gnu
14851507}
14861508
1509+ # Set up environment for 64-bit amd64 FreeBSD
1510+ setup_freebsd-amd64-default () {
1511+ common_setup freebsd x86_64-unknown-freebsd13.3
1512+ }
1513+
14871514base_windows_amd64_msvc_packages=' zlib gmp nettle curl sdl3 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk depcheck genlib'
14881515all_windows_amd64_msvc_packages=" ${base_windows_amd64_msvc_packages} "
14891516
@@ -1517,14 +1544,19 @@ all_linux_armhf_default_packages="${all_linux_arm64_default_packages}"
15171544base_linux_riscv64_default_packages=' sdl3'
15181545all_linux_riscv64_default_packages=' zlib gmp nettle curl sdl3 glew png jpeg webp openal ogg vorbis opus opusfile ncurses'
15191546
1547+ # FIXME: The naclruntime isn't rebuilt.
1548+ base_freebsd_amd64_default_packages=' sdl3 naclsdk'
1549+ all_freebsd_amd64_default_packages=' zlib gmp nettle curl sdl3 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk'
1550+
15201551supported_linux_platforms=' linux-amd64-default linux-arm64-default linux-armhf-default linux-i686-default'
15211552supported_windows_platforms=' windows-amd64-mingw windows-amd64-msvc windows-i686-mingw windows-i686-msvc'
15221553supported_macos_platforms=' macos-amd64-default'
15231554supported_platforms=" ${supported_linux_platforms} ${supported_windows_platforms} ${supported_macos_platforms} "
15241555
15251556extra_linux_platforms=' linux-riscv64-default'
15261557extra_macos_platforms=' macos-arm64-default'
1527- extra_platforms=" ${extra_linux_platforms} ${extra_macos_platforms} "
1558+ extra_freebsd_platforms=' freebsd-amd64-default'
1559+ extra_platforms=" ${extra_linux_platforms} ${extra_macos_platforms} ${extra_freebsd_platforms} "
15281560
15291561printHelp () {
15301562 # Please align to 4-space tabs.
@@ -1596,6 +1628,10 @@ printHelp() {
15961628 base ${base_linux_riscv64_default_packages}
15971629 all ${all_linux_riscv64_default_packages}
15981630
1631+ freebsd-amd64-default:
1632+ base ${base_freebsd_amd64_default_packages}
1633+ all ${all_freebsd_amd64_default_packages}
1634+
15991635 EOF
16001636
16011637 exit
0 commit comments