client-root/third_party/build_boringssl.sh
2019-07-01 22:32:56 +02:00

46 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
source ../scripts/build_helper.sh
library_path="boringssl"
requires_rebuild ${library_path}
[[ $? -eq 0 ]] && exit 0
cd boringssl/
[[ $? -ne 0 ]] && exit 1
if [[ ! -d lib ]]; then
mkdir lib && cd lib
ln -s ../build/ssl/libssl.so .
ln -s ../build/crypto/libcrypto.so .
cd ..
fi
cat include/openssl/opensslv.h | grep "OPENSSL_VERSION_NUMBER" &> /dev/null
if [[ $? -ne 0 ]]; then
echo "#if false
# define OPENSSL_VERSION_NUMBER 0x1010008fL
#endif" > include/openssl/opensslv.h
fi
if [[ -d build ]]; then
echo "Removing old build directory"
rm -r build
fi
mkdir build
check_err_exit ${library_path} "Failed to create build directory"
cd build
check_err_exit ${library_path} "Failed to enter build directory"
sudo apt-get install golang-go
check_err_exit ${library_path} "Failed to install libraries!"
if [[ "x86" == "${build_os_arch}" ]]; then
echo "Build boring SSL in 32 bit mode!"
T32="-DCMAKE_TOOLCHAIN_FILE=../util/32-bit-toolchain.cmake"
fi
cmake .. -D -DOPENSSL_NO_ASM=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" -DCMAKE_C_FLAGS="${C_FLAGS}" -DCMAKE_BUILD_TYPE=Release ${CMAKE_OPTIONS} -DCMAKE_VERBOSE_MAKEFILE=1 ${T32}
check_err_exit ${library_path} "Failed to execute cmake!"
make ${CMAKE_MAKE_OPTIONS}
check_err_exit ${library_path} "Failed to build!"
#sudo make install
cd ../..
set_build_successful ${library_path}