depends: move FreeBSD SDK handling to CI
What changed, and why it matters
This commit is a build-system cleanup. It moves the handling of the FreeBSD software development kit (SDK) out of the shared dependency build files and into the continuous integration (CI) configuration. The actual compiler flags and download logic remain essentially the same; they are just placed in a more appropriate file. There is no user-facing change and no security fix or vulnerability introduced.
No security action required. Treat as ordinary build-system maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors FreeBSD cross-compilation setup. Previously, depends/hosts/freebsd.mk hardcoded clang/llvm tool selection, sysroot paths, and linker flags. Now those settings are passed via DEP_OPTS in ci/test/00_setup_env_freebsd_cross.sh, while depends/hosts/freebsd.mk is reduced to architecture-specific compiler flags and CMake system name. The SDK download/extraction logic in ci/test/01_base_install.sh is slightly adjusted to use a basename exported from the CI env file. No cryptographic, network, consensus, or memory-safety code is touched.
Changed components
depends/hosts/freebsd.mkci/test/00_setup_env_freebsd_cross.shci/test/01_base_install.shInspect captured patch +37 / −26
diff --git a/ci/test/00_setup_env_freebsd_cross.sh b/ci/test/00_setup_env_freebsd_cross.sh
index 1be28a22..2a0ba92e 100755
--- a/ci/test/00_setup_env_freebsd_cross.sh
+++ b/ci/test/00_setup_env_freebsd_cross.sh
@@ -9,13 +9,25 @@ export LC_ALL=C.UTF-8
export CONTAINER_NAME=ci_freebsd_cross
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04"
export APT_LLVM_V="22"
-export FREEBSD_VERSION=15.0
-export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} lld"
export HOST=x86_64-unknown-freebsd
-export DEP_OPTS="build_CC=clang build_CXX=clang++ AR=llvm-ar-${APT_LLVM_V} STRIP=llvm-strip-${APT_LLVM_V} NM=llvm-nm-${APT_LLVM_V} RANLIB=llvm-ranlib-${APT_LLVM_V}"
+export FREEBSD_VERSION=15.0
+export FREEBSD_SDK_BASENAME="freebsd-${HOST}-${FREEBSD_VERSION}"
+export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} lld-${APT_LLVM_V}"
+export SYSROOT="--sysroot=${DEPENDS_DIR}/SDKs/${FREEBSD_SDK_BASENAME}"
+export DEP_OPTS="build_CC=clang build_CXX=clang++ \
+ CC='clang --target=${HOST} ${SYSROOT}' \
+ CXX='clang++ --target=${HOST} ${SYSROOT} -stdlib=libc++' \
+ LDFLAGS='-Wc,-fuse-ld=lld -fuse-ld=lld' \
+ AR=llvm-ar-${APT_LLVM_V} \
+ NM=llvm-nm-${APT_LLVM_V} \
+ OBJCOPY=llvm-objcopy-${APT_LLVM_V} \
+ OBJDUMP=llvm-objdump-${APT_LLVM_V} \
+ RANLIB=llvm-ranlib-${APT_LLVM_V} \
+ STRIP=llvm-strip-${APT_LLVM_V}"
export GOAL="install"
export BITCOIN_CONFIG="\
--preset=dev-mode \
+ -DCMAKE_LINKER_TYPE=LLD \
-DREDUCE_EXPORTS=ON \
-DWITH_USDT=OFF \
"
diff --git a/ci/test/01_base_install.sh b/ci/test/01_base_install.sh
index 466d2e3b..652416b9 100755
--- a/ci/test/01_base_install.sh
+++ b/ci/test/01_base_install.sh
@@ -118,8 +118,6 @@ if [ -n "$XCODE_VERSION" ] && [ ! -d "${DEPENDS_DIR}/SDKs/${OSX_SDK_BASENAME}" ]
tar -C "${DEPENDS_DIR}/SDKs" -xf "$OSX_SDK_PATH"
fi
-FREEBSD_SDK_BASENAME="freebsd-${HOST}-${FREEBSD_VERSION}"
-
if [ -n "$FREEBSD_VERSION" ] && [ ! -d "${DEPENDS_DIR}/SDKs/${FREEBSD_SDK_BASENAME}" ]; then
FREEBSD_SDK_FILENAME="base-${FREEBSD_VERSION}.txz"
FREEBSD_SDK_PATH="${DEPENDS_DIR}/sdk-sources/${FREEBSD_SDK_FILENAME}"
diff --git a/depends/hosts/freebsd.mk b/depends/hosts/freebsd.mk
index 240180f2..ada5a449 100644
--- a/depends/hosts/freebsd.mk
+++ b/depends/hosts/freebsd.mk
@@ -1,26 +1,6 @@
-FREEBSD_VERSION ?= 15.0
-FREEBSD_SDK=$(SDK_PATH)/freebsd-$(host)-$(FREEBSD_VERSION)/
-
-clang_prog=$(shell command -v clang)
-clangxx_prog=$(shell command -v clang++)
-
-freebsd_AR=$(shell command -v llvm-ar)
-freebsd_NM=$(shell command -v llvm-nm)
-freebsd_OBJCOPY=$(shell command -v llvm-objcopy)
-freebsd_OBJDUMP=$(shell command -v llvm-objdump)
-freebsd_RANLIB=$(shell command -v llvm-ranlib)
-freebsd_STRIP=$(shell command -v llvm-strip)
-
-
-freebsd_CC=$(clang_prog) --target=$(host) \
- --sysroot=$(FREEBSD_SDK)
-
-freebsd_CXX=$(clangxx_prog) --target=$(host) \
- --sysroot=$(FREEBSD_SDK) -stdlib=libc++
-
freebsd_CFLAGS=
freebsd_CXXFLAGS=
-freebsd_LDFLAGS=-fuse-ld=lld
+freebsd_LDFLAGS=
freebsd_release_CFLAGS=-O2
freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS)
@@ -28,4 +8,25 @@ freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS)
freebsd_debug_CFLAGS=-O1 -g
freebsd_debug_CXXFLAGS=$(freebsd_debug_CFLAGS)
+ifeq (86,$(findstring 86,$(build_arch)))
+i686_freebsd_CC=clang -m32
+i686_freebsd_CXX=clang++ -m32
+i686_freebsd_AR=ar
+i686_freebsd_RANLIB=ranlib
+i686_freebsd_NM=nm
+i686_freebsd_STRIP=strip
+
+x86_64_freebsd_CC=clang -m64
+x86_64_freebsd_CXX=clang++ -m64
+x86_64_freebsd_AR=ar
+x86_64_freebsd_RANLIB=ranlib
+x86_64_freebsd_NM=nm
+x86_64_freebsd_STRIP=strip
+else
+i686_freebsd_CC=$(default_host_CC) -m32
+i686_freebsd_CXX=$(default_host_CXX) -m32
+x86_64_freebsd_CC=$(default_host_CC) -m64
+x86_64_freebsd_CXX=$(default_host_CXX) -m64
+endif
+
freebsd_cmake_system_name=FreeBSD
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.