diff --git a/scripts/build/internals.sh b/scripts/build/internals.sh index 18ada66a..95fb72b4 100644 --- a/scripts/build/internals.sh +++ b/scripts/build/internals.sh @@ -17,6 +17,9 @@ do_finish() { *darwin*) strip_args="" ;; + *freebsd*) + strip_args="--strip-all" + ;; *) strip_args="--strip-all -v" ;; diff --git a/scripts/build/kernel/linux.sh b/scripts/build/kernel/linux.sh index 9cfc433f..cd4a4566 100644 --- a/scripts/build/kernel/linux.sh +++ b/scripts/build/kernel/linux.sh @@ -103,24 +103,28 @@ do_kernel_headers() { esac CT_DoLog EXTRA "Installing kernel headers" - CT_DoExecLog ALL \ - make -C "${kernel_path}" \ - CROSS_COMPILE="${CT_TARGET}-" \ - O="${CT_BUILD_DIR}/build-kernel-headers" \ - ARCH=${kernel_arch} \ - INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \ - ${V_OPT} \ + CT_DoExecLog ALL \ + make -C "${kernel_path}" \ + BASH="$(which bash)" \ + HOSTCC="${CT_BUILD}-gcc" \ + CROSS_COMPILE="${CT_TARGET}-" \ + O="${CT_BUILD_DIR}/build-kernel-headers" \ + ARCH=${kernel_arch} \ + INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \ + ${V_OPT} \ headers_install if [ "${CT_KERNEL_LINUX_INSTALL_CHECK}" = "y" ]; then CT_DoLog EXTRA "Checking installed headers" - CT_DoExecLog ALL \ - make -C "${kernel_path}" \ - CROSS_COMPILE="${CT_TARGET}-" \ - O="${CT_BUILD_DIR}/build-kernel-headers" \ - ARCH=${kernel_arch} \ - INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \ - ${V_OPT} \ + CT_DoExecLog ALL \ + make -C "${kernel_path}" \ + BASH="$(which bash)" \ + HOSTCC="${CT_BUILD}-gcc" \ + CROSS_COMPILE="${CT_TARGET}-" \ + O="${CT_BUILD_DIR}/build-kernel-headers" \ + ARCH=${kernel_arch} \ + INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \ + ${V_OPT} \ headers_check fi diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index c12a5530..25687ce9 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -346,13 +346,21 @@ do_libc_backend_once() { build_ldflags="${CT_LDFLAGS_FOR_BUILD}" case "$CT_BUILD" in - *mingw*|*cygwin*|*msys*|*darwin*) + *mingw*|*cygwin*|*msys*|*darwin*|*freebsd*) # When installing headers on Cygwin, Darwin, MSYS2 and MinGW-w64 sunrpc needs # gettext for building cross-rpcgen. build_cppflags="${build_cppflags} -I${CT_BUILDTOOLS_PREFIX_DIR}/include/" build_ldflags="${build_ldflags} -lintl -liconv" + case "$CT_BUILD" in + *cygwin*|*freebsd*) + # Additionally, stat in FreeBSD, Cygwin, and possibly others + # is always 64bit, so replace struct stat64 with stat. + build_cppflags="${build_cppflags} -Dstat64=stat" + ;; + esac ;; esac + extra_make_args+=( "BUILD_CFLAGS=${build_cflags}" ) extra_make_args+=( "BUILD_CPPFLAGS=${build_cppflags}" ) extra_make_args+=( "BUILD_LDFLAGS=${build_ldflags}" )