client-root/third_party/build_unbound.sh

46 lines
1.3 KiB
Bash
Raw Normal View History

2019-10-24 14:03:13 -04:00
#!/usr/bin/env bash
2019-10-25 18:00:32 -04:00
if [[ ${build_os_type} == "win32" ]]; then
echo "Windows does not require libunbound"
echo "Dont building library"
exit 0
fi
2019-10-24 14:03:13 -04:00
source ../scripts/build_helper.sh
library_path="unbound"
requires_rebuild ${library_path}
[[ $? -eq 0 ]] && exit 0
generate_build_path "${library_path}"
library_event=`pwd`/libevent/out/${build_os_type}_${build_os_arch}/
library_boringssl=`pwd`/boringssl/lib/
if [[ -d ${build_path} ]]; then
echo "Removing old build directory"
rm -r ${build_path}
fi
mkdir -p ${build_path}
check_err_exit ${library_path} "Failed to create build directory"
cd ${build_path}
check_err_exit ${library_path} "Failed to enter build directory"
if [[ ${build_os_type} == "linux" ]]; then
#Failed to build with BoringSSL, so we using openssl. No ABI stuff should be changed!
# --with-ssl=${library_boringssl}
../../configure --with-libunbound-only --with-libevent=${library_event} --enable-event-api --enable-shared=no --enable-static=yes --with-pthreads --enable-pic --prefix=`pwd`
2019-10-24 14:03:13 -04:00
check_err_exit ${library_path} "Failed to configure build"
2019-10-25 18:03:58 -04:00
make CXXFLAGS="${CXX_FLAGS}" CFLAGS="${C_FLAGS} -fPIC" ${MAKE_OPTIONS}
2019-10-24 14:03:13 -04:00
check_err_exit ${library_path} "Failed to build"
make install
check_err_exit ${library_path} "Failed to install"
else
echo "Invalid OS!"
exit 1
fi
cd ../../../
set_build_successful ${library_path}