71 lines
2.0 KiB
Bash
Executable File
71 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Enter third_party/ directory
|
|
cd $(dirname $0)
|
|
|
|
color_green='\e[92m'
|
|
color_normal='\e[39m'
|
|
|
|
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')
|
|
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 ""
|
|
}
|
|
|
|
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_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)!" |