client-root/third_party/build_unbound.sh
2019-10-24 20:03:13 +02:00

52 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
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`
check_err_exit ${library_path} "Failed to configure build"
make CXXFLAGS="${CXX_FLAGS}" CFLAGS="${C_FLAGS}" ${MAKE_OPTIONS}
check_err_exit ${library_path} "Failed to build"
make install
check_err_exit ${library_path} "Failed to install"
elif [[ ${build_os_type} == "win32" ]]; then
exit 1 #TODO
cmake ../../ -G"Visual Studio 14 2015 Win64" -DOPENSSL_NO_ASM=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded"
check_err_exit ${library_path} "Failed generate build files!"
cmake --build . --target crypto --config release -j 8
#MSBuild.exe //p:Configuration=Release //p:Platform=x64 crypto/crypto.vcxproj
check_err_exit ${library_path} "Failed to build crytp!"
cmake --build . --target ssl --config release -j 8
#MSBuild.exe //p:Configuration=Release //p:Platform=x64 ssl/ssl.vcxproj
check_err_exit ${library_path} "Failed to build ssl!"
else
echo "Invalid OS!"
exit 1
fi
cd ../../../
set_build_successful ${library_path}