-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sh
executable file
·45 lines (33 loc) · 1.2 KB
/
build.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
#!/usr/bin/env bash
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
buildstep() {
NAME=$1
shift
printf "\e[32m${NAME}\e[0m\n"
# "$@" 2>&1 | sed $'s|^|\x1b[32m['"${NAME}"$']\x1b[39m |' || exit 1
"$@"
}
# Compile llvm, and gclang.
buildstep "pull toolchain" tools/build_deps.sh
source $ROOT/opt/enable-toolchain
mkdir -p build
for config in noservice anchorage; do
mkdir -p build/alaska-${config}
pushd build/alaska-${config} 2>/dev/null
INSTALL_DIR=${ROOT}/opt/alaska-${config}
buildstep "configure ${config}" \
cmake $ROOT/alaska \
-DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_DIR} \
-DALASKA_CONFIG=$ROOT/configs/config.${config}.cmake
buildstep "build ${config}" make -j $(nproc) install
# Create an enable file which can be sourced in bash
ENABLE=$ROOT/opt/enable-alaska-${config}
echo "source ${ROOT}/opt/enable-toolchain" > $ENABLE
# Binary path
echo "export PATH=$INSTALL_DIR/bin:\$PATH" >> $ENABLE
# Library path
echo "export LD_LIBRARY_PATH=$INSTALL_DIR/lib:\$LD_LIBRARY_PATH" >> $ENABLE
# add a variable to tell where alaska is installed
echo "export ALASKA=$INSTALL_DIR" >> $ENABLE
popd 2>/dev/null
done