client-root/third_party/build_unbound.sh

56 lines
1.5 KiB
Bash
Raw Normal View History

2019-10-24 14:03:13 -04:00
#!/usr/bin/env bash
2019-12-07 13:18:46 -05:00
[[ -z "${build_helper_file}" ]] && {
echo "Missing build helper file. Please define \"build_helper_file\""
exit 1
}
source ${build_helper_file}
[[ $build_helpers_defined -ne 1 ]] && {
echo "Failed to include build helpers."
exit 1
}
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
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}
2019-10-25 19:43:10 -04:00
../../configure --with-libunbound-only --with-libevent=${library_event} --enable-event-api --enable-shared=yes --enable-static=yes --with-pthreads --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}