forked from ByConity/ByConity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_bin.sh
executable file
·50 lines (40 loc) · 2 KB
/
build_bin.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
set -e
set -x
PROJECT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
export PATH=`echo $PATH | sed -e 's/:\/opt\/tiger\/typhoon-blade//'`
ENABLE_JAVA_EXTENSIONS="${ENABLE_JAVA_EXTENSIONS:-0}"
JAVA_EXTENSIONS_VERSION="${JAVA_EXTENSIONS_VERSION:-1.0.0.3}"
rm -rf output/
mkdir -p output/bin
. ./utils/release/release_lib.sh && gen_revision_author && cat ./cmake/autogenerated_versions.txt
python3 ./utils/bytedance-versions/check_scm_version.py ./utils/bytedance-versions/CDW.VERSION
export CMAKE_BUILD_TYPE=${CUSTOM_CMAKE_BUILD_TYPE:-RelWithDebInfo}
export CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../output -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DUSE_BYTEDANCE_RDKAFKA=${CUSTOM_USE_BYTEDANCE_RDKAFKA:-1} ${CMAKE_FLAGS}"
CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../output ${CMAKE_FLAGS}"
CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=${CUSTOM_CMAKE_BUILD_TYPE:-RelWithDebInfo} $CMAKE_FLAGS"
CMAKE_FLAGS="-DENABLE_BREAKPAD=ON $CMAKE_FLAGS" # enable minidump
CMAKE_FLAGS="-DENABLE_HUALLOC=OFF ${CMAKE_FLAGS}"
[[ -n "$CUSTOM_SANITIZE" ]] && CMAKE_FLAGS="-DSANITIZE=$CUSTOM_SANITIZE $CMAKE_FLAGS"
[[ -n "$CUSTOM_MAX_LINKING_JOBS" ]] && CMAKE_FLAGS="-DPARALLEL_LINK_JOBS=${CUSTOM_MAX_LINKING_JOBS} ${CMAKE_FLAGS}"
[[ -n "$CUSTOM_MAX_COMPILE_JOBS" ]] && CMAKE_FLAGS="-DPARALLEL_COMPILE_JOBS=${CUSTOM_MAX_COMPILE_JOBS} ${CMAKE_FLAGS}"
export CMAKE_FLAGS
rm -rf build && mkdir build && cd build
source /etc/os-release
set -e
if [ "$NAME" == "CentOS Linux" ] && [ "$VERSION_ID" == "7" ] && hash scl 2>/dev/null; then
echo "Found Centos 7 and scl"
scl enable devtoolset-9 "CC=clang CXX=clang++ cmake3 ${CMAKE_FLAGS} -DCMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/ninja ../"
scl enable devtoolset-9 "ninja"
scl enable devtoolset-9 "ninja install"
else
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
cmake ../ ${CMAKE_FLAGS} && ninja
fi
# create the `usr/bin` directory to keep it same with old version
mkdir -p ../output/usr
mv ../output/bin ../output/usr/
# create symlink to make CI tests happy
cd ../output
ln -s usr/bin bin