diff --git a/.gitignore b/.gitignore index bfa6a22..9f11b75 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -# Created by .ignore support plugin (hsz.mobi) +.idea/ diff --git a/.gitmodules b/.gitmodules index 41fe645..e86a016 100644 --- a/.gitmodules +++ b/.gitmodules @@ -58,3 +58,9 @@ [submodule "third_party/mysqlconnector"] path = third_party/mysqlconnector url = https://github.com/mysql/mysql-connector-cpp.git +[submodule "third_party/yaml-cpp"] + path = third_party/yaml-cpp + url = https://github.com/jbeder/yaml-cpp.git +[submodule "third_party/jemalloc"] + path = third_party/jemalloc + url = https://github.com/jemalloc/jemalloc.git diff --git a/client b/client index ce356fd..afd3adc 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit ce356fd6942c3c35870c2b2b698ee18a0bedca0f +Subproject commit afd3adced9ae0fdbf93292886dd8db5a4d3528b5 diff --git a/helper.txt b/helper.txt index e69de29..8cd0987 100644 --- a/helper.txt +++ b/helper.txt @@ -0,0 +1,10 @@ +Update/initialize git submodules (Using the refs given!): +#Update the module +git submodule update --init --recursive +#Resetting local made changes +git submodule foreach git reset --hard + + + + +build_event.sh updated! \ No newline at end of file diff --git a/scripts/build_helper.sh b/scripts/build_helper.sh index d5bb933..702c1fd 100644 --- a/scripts/build_helper.sh +++ b/scripts/build_helper.sh @@ -1 +1,235 @@ +#!/usr/bin/env bash # Basic functions required for library building +# Enforce library building with force_rebuild="library-a;library-b;..." + +color_green='\e[92m' +color_normal='\e[39m' + +function generate_build_path() { + base_path=$(realpath $1) + build_path="$base_path/out/${build_os_type}_${build_os_arch}/" + return 0 +} + +function requires_rebuild() { + IFS= + + if [[ -z "${build_os_type}" ]]; then + echo "Missing build os type! Rebuilding!" + return 1 + fi + if [[ -z "${build_os_arch}" ]]; then + echo "Missing build os architecture! Rebuilding!" + return 1 + fi + + base_path=$(realpath $1) + echo "Testing library build status at $1 ($base_path)" + + if echo "$force_rebuild" | grep -q -E "(^|;)$1(;|$)"; then + echo "Force rebuild for $1 is set. Rebuilding!" + return 1 + fi + + chk_file=".build_${build_os_type}_${build_os_arch}.txt" + if [[ ! -e "$base_path/$chk_file" ]]; then + echo "Build check file is missing. Rebuilding!" + return 1 + fi + + echo "Reading data from $base_path/$chk_file" + IFS=$'\n' + data=($(cat "$base_path/$chk_file")) + IFS= + #echo "RData: ${data[@]}" + + if [[ "${data[0]}" -ne 1 ]]; then + echo "Build data contains invalid version (${data[0]})! Rebuilding!" + return 1 + fi + + if [[ "${data[1]}" != "success" ]]; then + echo "Last build wasn't successful (${data[1]})! Rebuilding!" + return 1 + fi + + git_rev=$(git -C ${base_path} rev-parse HEAD) + if [[ $? -ne 0 ]]; then + echo "Could not gather current git rev tag! Rebuilding!" + return 1 + fi + + if [[ "${git_rev}" != "${data[2]}" ]]; then + echo "Git rev tags not match (Current: ${git_rev}; Builded: ${data[2]}). Rebuilding!" + return 1 + fi + + echo -en "$color_green" + echo -e "Last build at ${data[3]} was successful!$color_normal Git rev: ${data[2]}. No need to rebuild." + return 0 +} + +function set_build_successful() { + IFS= + + if [[ -z "${build_os_type}" ]]; then + echo "Failed to set flag successful because build os is undefined" + return 1 + fi + if [[ -z "${build_os_arch}" ]]; then + echo "Failed to set flag successful because build arch is undefined" + return 1 + fi + + base_path=$(realpath $1) + chk_file=".build_${build_os_type}_${build_os_arch}.txt" + git_rev=$(git -C ${base_path} rev-parse HEAD) + if [[ $? -ne 0 ]]; then + echo "Failed to gather git rev tag! Failed to set successful flag!" + return 1 + fi + echo -en "$color_green" + echo -e "Setting build @$1 ($base_path) as successful for commit $git_rev$color_normal" + + data=() + data+=("1") #Version + data+=("success") + data+=("${git_rev}") + data+=("$(date)") + + IFS=$'\n' + echo "${data[*]}" > "$base_path/$chk_file" + IFS= +} + +contains_element () { + local e match="$1" + shift + for e; do [[ "$e" == "$match" ]] && return 0; done + return 1 +} + +function cmake_build() { + if [[ -z "${build_os_type}" ]]; then + echo "Could not build cmake file because build os type has not been specified!" + return 1 + fi + if [[ -z "${build_os_arch}" ]]; then + echo "Could not build cmake file because build arch type has not been specified!" + return 1 + fi + + base_path=$(realpath $1) + build_path="$base_path/out/${build_os_type}_${build_os_arch}/" + if [[ ! -d ${base_path} ]]; then + echo "Missing target directory. CMake build failed" + return 1 + fi + + + if [[ -d ${build_path} ]]; then + echo "Deleting old build directory" + rm -r ${build_path} + [[ $? -ne 0 ]] && { + echo "Failed to delete old build directory!" + return 1 + } + fi + + echo "Creating build directory ${build_path}" + mkdir -p ${build_path} + [[ $? -ne 0 ]] && { + echo "Failed to create build directory!" + return 1 + } + + parameters=(${@:2}) + final_parms=() + declare -A final_definitions + + #Merge env variables with definitions + IFS=" " + for i in $(seq -s' ' 2 ${#@}); do + parameter="$(eval echo \${$i})" + if [[ "${parameter}" != -D* ]]; then + final_parms+=("\"${parameter}\"") + continue + fi + + def_key=$(echo "$parameter" | sed -n -E 's:^-D([A-Za-z_0-9]*)=(.*):\1:p') + def_value="$(echo "$parameter" | sed -n -E 's:^-D([A-Za-z_0-9]*)=(.*):\2:p')" + + [[ -z ${final_definitions[$def_key]} ]] && { + final_definitions[$def_key]="${def_value}" + } || { + final_definitions[$def_key]="${final_definitions[$def_key]} ${def_value}" + } + done + + #TODO: May add a warning? + #If given override the install prefix! + final_definitions["CMAKE_INSTALL_PREFIX"]="$build_path" + + #Apply general env values + #C_FLAGS; CXX_FLAGS + [[ ! -z "${C_FLAGS}" ]] && final_definitions["CMAKE_C_FLAGS"]="${final_definitions['CMAKE_C_FLAGS']} ${C_FLAGS}" + [[ ! -z "${CXX_FLAGS}" ]] && final_definitions["CMAKE_CXX_FLAGS"]="${final_definitions['CMAKE_CXX_FLAGS']} ${CXX_FLAGS}" + + definition_string="" + for i in "${!final_definitions[@]}" + do + definition_string="${definition_string} -D$i=\"${final_definitions[$i]}\"" + done + #Cut of the start space + [[ ! -z ${definition_string} ]] && definition_string=${definition_string:1} + + cmake_command="cmake $base_path$base_path_suffix ${final_parms[*]} ${definition_string} ${CMAKE_OPTIONS}" + + origin_directory=$(pwd) + cd ${build_path} + [[ $? -ne 0 ]] && { + echo "Failed to enter build directory!" + return 1 + } + + #echo "Basic parameters: ${final_parms[*]}" + #echo "Final definitions: ${definition_string}" + + echo "Executing cmake command:" + echo "> $cmake_command" + eval "${cmake_command}" + if [[ $? -ne 0 ]]; then + echo "Failed to generate build file with cmake! Status code: $?" + return 1 + fi + + make_command="make ${CMAKE_MAKE_OPTIONS}" + echo "Executing make command:" + echo "> $make_command" + eval "${make_command}" + if [[ $? -ne 0 ]]; then + echo "Failed to build project with make! Status code: $?" + return 1 + fi + + make_install_command="make install" + echo "Executing make install command:" + echo "> $make_install_command" + eval "${make_install_command}" + if [[ $? -ne 0 ]]; then + echo "Failed to install project build! Status code: $?" + return 1 + fi + + cd ${origin_directory} + return 0 +} + +function check_err_exit() { + error_code=$? + [[ ${error_code} -eq 0 || "${error_code}" == "0" ]] && return 0 + echo -e "\e[1;31mFailed to build project $1 at $(realpath $1). Status code: ${error_code}" + [[ ${#@} -gt 1 ]] && echo "${@:2}" + echo -e "Aborting build\e[0;39m" + exit 1 +} \ No newline at end of file diff --git a/third_party/CXXTerminal b/third_party/CXXTerminal index d44e435..67fc8e3 160000 --- a/third_party/CXXTerminal +++ b/third_party/CXXTerminal @@ -1 +1 @@ -Subproject commit d44e435f1ec8b130df5f9db2868e9abf94ddf9d2 +Subproject commit 67fc8e355b3393670ec7397b5225c22ab62cec8c diff --git a/third_party/DataPipes b/third_party/DataPipes index 5e27345..315f9f0 160000 --- a/third_party/DataPipes +++ b/third_party/DataPipes @@ -1 +1 @@ -Subproject commit 5e273451558ecffff56e7bcc5db158b821d6b7bc +Subproject commit 315f9f0b8cf4119abedc338cd73e3154143b6d2e diff --git a/third_party/build.sh b/third_party/build.sh index a8e52b4..8d65803 100755 --- a/third_party/build.sh +++ b/third_party/build.sh @@ -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)!" \ No newline at end of file diff --git a/third_party/build_boringssl.sh b/third_party/build_boringssl.sh new file mode 100755 index 0000000..375ed68 --- /dev/null +++ b/third_party/build_boringssl.sh @@ -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} \ No newline at end of file diff --git a/third_party/build_breakpad.sh b/third_party/build_breakpad.sh index 4cb249a..2600858 100755 --- a/third_party/build_breakpad.sh +++ b/third_party/build_breakpad.sh @@ -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!" diff --git a/third_party/build_cxxterminal.sh b/third_party/build_cxxterminal.sh index 181411b..5504621 100755 --- a/third_party/build_cxxterminal.sh +++ b/third_party/build_cxxterminal.sh @@ -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} \ No newline at end of file diff --git a/third_party/build_datapipes.sh b/third_party/build_datapipes.sh new file mode 100755 index 0000000..348af19 --- /dev/null +++ b/third_party/build_datapipes.sh @@ -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} \ No newline at end of file diff --git a/third_party/build_event.sh b/third_party/build_event.sh index 45045cf..a21a592 100755 --- a/third_party/build_event.sh +++ b/third_party/build_event.sh @@ -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 \ No newline at end of file +[[ $? -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} \ No newline at end of file diff --git a/third_party/build_jemalloc.sh b/third_party/build_jemalloc.sh new file mode 100755 index 0000000..1274c2c --- /dev/null +++ b/third_party/build_jemalloc.sh @@ -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} \ No newline at end of file diff --git a/third_party/build_mysqlconnector.sh b/third_party/build_mysqlconnector.sh index 38325fb..490c4c9 100755 --- a/third_party/build_mysqlconnector.sh +++ b/third_party/build_mysqlconnector.sh @@ -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} \ No newline at end of file diff --git a/third_party/build_opus.sh b/third_party/build_opus.sh index c3dabd6..228c2a2 100755 --- a/third_party/build_opus.sh +++ b/third_party/build_opus.sh @@ -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} \ No newline at end of file diff --git a/third_party/build_protobuf.sh b/third_party/build_protobuf.sh new file mode 100755 index 0000000..1d370a9 --- /dev/null +++ b/third_party/build_protobuf.sh @@ -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} \ No newline at end of file diff --git a/third_party/build_spdlog.sh b/third_party/build_spdlog.sh new file mode 100755 index 0000000..c5d1876 --- /dev/null +++ b/third_party/build_spdlog.sh @@ -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} \ No newline at end of file diff --git a/third_party/build_stringvariable.sh b/third_party/build_stringvariable.sh new file mode 100755 index 0000000..9592d86 --- /dev/null +++ b/third_party/build_stringvariable.sh @@ -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} \ No newline at end of file diff --git a/third_party/build_threadpool.sh b/third_party/build_threadpool.sh new file mode 100755 index 0000000..cbe6f63 --- /dev/null +++ b/third_party/build_threadpool.sh @@ -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} \ No newline at end of file diff --git a/third_party/build_tom.sh b/third_party/build_tom.sh new file mode 100755 index 0000000..81c9030 --- /dev/null +++ b/third_party/build_tom.sh @@ -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 \ No newline at end of file diff --git a/third_party/build_yaml.sh b/third_party/build_yaml.sh new file mode 100755 index 0000000..1bc52f9 --- /dev/null +++ b/third_party/build_yaml.sh @@ -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} \ No newline at end of file diff --git a/third_party/jemalloc b/third_party/jemalloc new file mode 160000 index 0000000..40a3435 --- /dev/null +++ b/third_party/jemalloc @@ -0,0 +1 @@ +Subproject commit 40a3435b8dc225ad61329aca89d9c8d0dfbc03ab diff --git a/third_party/tomcrypt b/third_party/tomcrypt index 4dd5300..4879783 160000 --- a/third_party/tomcrypt +++ b/third_party/tomcrypt @@ -1 +1 @@ -Subproject commit 4dd53007569b454b9af44d64abbf54dc75cbfa41 +Subproject commit 4879783917775339a3dcd95cd71d4e8ff27523c2 diff --git a/third_party/yaml-cpp b/third_party/yaml-cpp new file mode 160000 index 0000000..0122697 --- /dev/null +++ b/third_party/yaml-cpp @@ -0,0 +1 @@ +Subproject commit 012269756149ae99745b6dafefd415843d7420bb