Initialized linux build scripts

This commit is contained in:
WolverinDEV
2019-07-01 22:32:56 +02:00
parent af7f262a1c
commit 853eb8cd40
25 changed files with 563 additions and 46 deletions
+57 -17
View File
@@ -1,31 +1,71 @@
#!/bin/bash
# Enter third_party/ directory
cd $(dirname $0)
color_green='\e[92m'
color_normal='\e[39m'
function exec_script {
function pline() {
width="120"
padding="$(printf '%0.1s' ={1..120})"
printf "%*.*s $color_green%s$color_normal %*.*s\n" 0 "$(( ($width - 2 - ${#1}) / 2))" "$padding" "$1" 0 "$(( ($width - 1 - ${#1}) / 2 ))" "$padding"
}
function format_time() {
time_needed_s=$(($1/1000000000))
time_needed_m=$(($time_needed_s/60))
time_needed_s=$(($time_needed_s - $time_needed_m * 60))
time=""
if [[ ${time_needed_m} != "0" ]]; then
[[ -z ${time} ]] && time="$time_needed_m min" || time="${time} $time_needed_m min"
fi
if [[ ${time_needed_s} != "0" ]]; then
[[ -z ${time} ]] && time="$time_needed_s sec" || time="${time} $time_needed_s sec"
fi
[[ -z ${time} ]] && time="0 sec"
}
function exec_script() {
name=$(echo "$1" | sed -n -E 's:^build_(.*)\.sh:\1:p')
echo -e "==================== $color_green$name$color_normal ===================="
time_begin=$(date +%s%N)
pline "$name"
echo -e "Building library with script $color_green${1}$color_normal"
./${1}
if [[ $? -ne 0 ]]; then
echo "Failed to build library $name. Status code: $?"
exit 1
fi
#Log the result
time_end=$(date +%s%N)
format_time $(($time_end - $time_begin))
pline "$name ($time)"
echo ""
}
#exec_script build_boringssl.sh
#exec_script build_breakpad.sh
#exec_script build_cxxterminal.sh
#exec_script build_datapipes.sh
#exec_script build_ed25519.sh
global_time_begin=$(date +%s%N)
exec_script build_boringssl.sh
exec_script build_breakpad.sh #Not required for windows TeaClient
exec_script build_event.sh
#exec_script build_jsoncpp.sh
#exec_script build_mysqlconnector.sh
#exec_script build_opus.sh
#exec_script build_protobuf.sh
#exec_script build_spdlog.sh
#exec_script build_stringvariable.sh
#exec_script build_threadpool.sh
#exec_script build_tom.sh
#exec_script build_yaml.sh
#exec_script build_jemalloc.sh
exec_script build_cxxterminal.sh #Depends on libevent; Not required for TeaClient
exec_script build_datapipes.sh
exec_script build_ed25519.sh
exec_script build_jsoncpp.sh
exec_script build_mysqlconnector.sh
exec_script build_opus.sh
exec_script build_protobuf.sh
exec_script build_spdlog.sh
exec_script build_stringvariable.sh
exec_script build_threadpool.sh
exec_script build_tom.sh
exec_script build_yaml.sh
exec_script build_jemalloc.sh #Not required for TeaClient
#Log the result
global_time_end=$(date +%s%N)
format_time $(($global_time_end - $global_time_begin))
pline "Build all libraries successfully ($time)!"
+46
View File
@@ -0,0 +1,46 @@
#!/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}
+12 -1
View File
@@ -8,11 +8,22 @@ requires_rebuild ${library_path}
cd ${library_path}
git clone https://chromium.googlesource.com/linux-syscall-support src/third_party/lss
if [[ -d build ]]; then
rm -r build
fi
mkdir build
cd build
check_err_exit ${library_path} "Failed to enter build directory!"
../configure
check_err_exit ${library_path} "Failed to configure"
make CXXFLAGS="-std=c++11 -I../../boringssl/include/ ${CXX_FLAGS}" CFLAGS="${C_FLAGS}" ${MAKE_OPTIONS}
check_err_exit ${library_path} "Failed to build"
sudo make install
cd ..
check_err_exit ${library_path} "Failed to install"
cd ../..
# cmake_build ${library_path} -DCMAKE_C_FLAGS="-fPIC -I../../boringssl/include/" -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_OPENSSL=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo
# check_err_exit ${library_path} "Failed to build libevent!"
+2 -11
View File
@@ -1,10 +1,3 @@
cd CXXTerminal/libraries/
./build_event.sh #TODO test status!
cd ../build/
cmake .. -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" -DCMAKE_C_FLAGS="${C_FLAGS}" -DCMAKE_BUILD_TYPE=RelWithDebInfo ${CMAKE_OPTIONS}
make ${CMAKE_MAKE_OPTIONS}
sudo make install
#!/usr/bin/env bash
source ../scripts/build_helper.sh
@@ -13,8 +6,6 @@ library_path="CXXTerminal"
requires_rebuild ${library_path}
[[ $? -eq 0 ]] && exit 0
#./build_event.sh
cmake_build ${library_path} -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_BUILD_TYPE=RelWithDebInfo
check_err_exit ${library_path} "Failed to build libevent!"
cmake_build ${library_path} -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_LIBEVENT=ON -DNO_EMBETTED_LIBEVENT=ON -DLibevent_DIR="`pwd`/libevent/out/${build_os_type}_${build_os_arch}/"
check_err_exit ${library_path} "Failed to build CXXTerminal!"
set_build_successful ${library_path}
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
source ../scripts/build_helper.sh
library_path="DataPipes"
requires_rebuild ${library_path}
[[ $? -eq 0 ]] && exit 0
cd DataPipes/
echo "Testing for libnice"
dpkg-query -l libnice-dev2 &>/dev/null
if [[ $? -ne 0 ]]; then
echo "Installing libnice"
sudo apt-get update
sudo apt-get install libnice-dev
else
echo "libnice already installed"
fi
./build_usrsctp.sh
check_err_exit ${library_path} "Failed to build usrsctp!"
./build_srtp.sh
check_err_exit ${library_path} "Failed to build srtp!"
./build_sdptransform.sh
check_err_exit ${library_path} "Failed to build sdptransform!"
cd ..
cmake_build ${library_path} -DCrypto_ROOT_DIR="`pwd`/boringssl/" -DCRYPTO_TYPE="boringssl" -DCMAKE_CXX_FLAGS="-fPIC -static-libgcc -static-libstdc++" -DBUILD_TESTS=OFF -DCMAKE_C_FLAGS="-fPIC"
check_err_exit ${library_path} "Failed to build DataPipes!"
set_build_successful ${library_path}
+5 -5
View File
@@ -4,8 +4,8 @@ source ../scripts/build_helper.sh
library_path="libevent"
requires_rebuild ${library_path}
if [[ $? -ne 0 ]]; then
cmake_build ${library_path} -DCMAKE_C_FLAGS="-fPIC -I../../boringssl/include/" -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_OPENSSL=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo
check_err_exit ${library_path} "Failed to build libevent!"
set_build_successful ${library_path}
fi
[[ $? -eq 0 ]] && exit 0
cmake_build ${library_path} -DCMAKE_C_FLAGS="-fPIC -I../../boringssl/include/" -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_OPENSSL=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo
check_err_exit ${library_path} "Failed to build libevent!"
set_build_successful ${library_path}
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
source ../scripts/build_helper.sh
library_path="jemalloc"
requires_rebuild ${library_path}
[[ $? -eq 0 ]] && exit 0
generate_build_path ${library_path}
cd jemalloc/
if ! [[ -f configure ]]; then
autoconf
if [[ $? -ne 0 ]]; then
echo "Failed to create configure file"
exit 1
fi
if ! [[ -f configure ]]; then
echo "Failed to create configure file"
exit 1
fi
fi
if [[ -d ${build_path} ]]; then
rm -r ${build_path}
check_err_exit ${library_path} "Failed to remove build path!"
fi
mkdir -p ${build_path}
check_err_exit ${library_path} "Failed to create build path!"
cd ${build_path}
check_err_exit ${library_path} "Failed to enter build path!"
../../configure --enable-munmap --prefix=`pwd`
if [[ $? -ne 0 ]]; then
echo "Failed to create makefile"
exit 1
fi
(cat Makefile | sed 's/.*$(CC) $(DSO_LDFLAGS) $(call RPATH,$(RPATH_EXTRA)) $(LDTARGET) $+ $(LDFLAGS) $(LIBS) $(EXTRA_LDFLAGS).*/ $(CXX) $(DSO_LDFLAGS) $(call RPATH,$(RPATH_EXTRA)) $(LDTARGET) $+ $(LDFLAGS) $(LIBS) $(EXTRA_LDFLAGS)/') > tmp
rm Makefile
mv tmp Makefile
make -j 12 LIBS="-pthread -static-libgcc -static-libstdc++ -fPIC" CFLAGS="-static-libgcc -static-libstdc++ -fPIC" CXXFLAGS="-static-libgcc -static-libstdc++ -fPIC"
#make -j 12 LIBS="-pthread -static-libgcc -static-libstdc++" CFLAGS="-fPIC" CXXFLAGS="-fPIC"
#make -j 12 LIBS="-pthread -lm -l/usr/lib/gcc/x86_64-linux-gnu/5/libstdc++.a" ${MAKE_OPTIONS} CFLAGS="-shared -static-libstdc++ -static-libgcc -fPIC" CXXFLAGS="-static-libstdc++ -static-libgcc -shared -fPIC"
if [[ $? -ne 0 ]]; then
echo "Failed to build jemalloc"
exit 1
fi
make install &>/dev/null
if [[ $? -ne 0 ]]; then #Workaround because the install fails
#exit 0
echo "" &> /dev/null
fi
cd ../../../
set_build_successful ${library_path}
+1 -1
View File
@@ -20,6 +20,6 @@ if ! [[ "${HEADER:0:34}" == "#if !defined(SSL_ERROR_WANT_ASYNC)" ]]; then
fi
cd ..
cmake_build ${library_path} -DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++ -I../../boringssl/include/" -DWITH_JDBC=ON -DWITH_SSL="`pwd`/../../boringssl/" -DOPENSSL_ROOT_DIR="`pwd`/../../boringssl/" -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake_build ${library_path} -DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++ -I`pwd`/boringssl/include/" -DWITH_JDBC=ON -DWITH_SSL="`pwd`/boringssl/" -DOPENSSL_ROOT_DIR="`pwd`/boringssl/" -DCMAKE_BUILD_TYPE=RelWithDebInfo
check_err_exit ${library_path} "Failed to build mysqlconnector!"
set_build_successful ${library_path}
+11 -6
View File
@@ -1,6 +1,11 @@
cd opus
./autogen.sh
cd build
../configure
make -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" -DCMAKE_C_FLAGS="${C_FLAGS}" ${MAKE_OPTIONS}
sudo make install
#!/usr/bin/env bash
source ../scripts/build_helper.sh
library_path="opus"
requires_rebuild ${library_path}
[[ $? -eq 0 ]] && exit 0
cmake_build ${library_path} -DOPUS_X86_PRESUME_AVX=OFF -DOPUS_X86_PRESUME_SSE4_1=OFF
check_err_exit ${library_path} "Failed to build opus!"
set_build_successful ${library_path}
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
source ../scripts/build_helper.sh
library_path="protobuf"
requires_rebuild ${library_path}
[[ $? -eq 0 ]] && exit 0
#./${library_path}/libraries/build_event.sh
#check_err_exit ${library_path} "Failed to build library libevent"
base_path_suffix="/cmake/"
cmake_build ${library_path} -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS="-std=c++11 -fPIC" -DCMAKE_BUILD_TYPE=RelWithDebInfo
check_err_exit ${library_path} "Failed to build protobuf!"
set_build_successful ${library_path}
Vendored Executable
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
source ../scripts/build_helper.sh
library_path="spdlog"
requires_rebuild ${library_path}
[[ $? -eq 0 ]] && exit 0
cmake_build ${library_path}
check_err_exit ${library_path} "Failed to build spdlog!"
set_build_successful ${library_path}
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
source ../scripts/build_helper.sh
library_path="StringVariable"
requires_rebuild ${library_path}
[[ $? -eq 0 ]] && exit 0
cmake_build ${library_path} -DCMAKE_CXX_FLAGS="-fPIC"
check_err_exit ${library_path} "Failed to build StringVariable!"
set_build_successful ${library_path}
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
source ../scripts/build_helper.sh
library_path="Thread-Pool"
requires_rebuild ${library_path}
[[ $? -eq 0 ]] && exit 0
cmake_build ${library_path}
check_err_exit ${library_path} "Failed to build Thread-Pool!"
set_build_successful ${library_path}
Vendored Executable
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
source ../scripts/build_helper.sh
library_path="tommath"
requires_rebuild ${library_path}
[[ $? -ne 0 ]] && {
cmake_build ${library_path} -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_BUILD_TYPE=RelWithDebInfo
check_err_exit ${library_path} "Failed to build tommath!"
set_build_successful ${library_path}
}
library_path="tomcrypt"
requires_rebuild ${library_path}
[[ $? -ne 0 ]] && {
export tommath_library="`pwd`/tommath/out/linux_amd64/libtommathStatic.a"
export tommath_include="`pwd`/tommath/out/linux_amd64/include/"
cd tomcrypt/
chmod +x create_build.sh && ./create_build.sh
check_err_exit ${library_path} "Failed to build tomcrypt!"
cd ..
set_build_successful ${library_path}
}
exit 0
Vendored Executable
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
source ../scripts/build_helper.sh
library_path="yaml-cpp"
requires_rebuild ${library_path}
[[ $? -eq 0 ]] && exit 0
cmake_build ${library_path} -DYAML_CPP_BUILD_TESTS=OFF -DYAML_CPP_BUILD_TOOLS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11 -fPIC"
check_err_exit ${library_path} "Failed to build yaml-cpp!"
set_build_successful ${library_path}
Vendored Submodule
+1
Submodule third_party/jemalloc added at 40a3435b8d
Vendored Submodule
+1
Submodule third_party/yaml-cpp added at 0122697561