forked from Edgio/waflz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·71 lines (64 loc) · 1.75 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# ------------------------------------------------------------------------------
# Requirements to build...
# ------------------------------------------------------------------------------
which cmake g++ make || {
echo "Failed to find required build packages. Please install with: sudo apt-get install cmake make g++"
exit 1
}
# This is necessary in scenarios where the URL of the remote for a given submodule has changed.
git submodule sync || {
echo "FAILED TO SYNC IS2 LIB"
exit 1
}
git submodule update -f --init || {
echo "FAILED TO UPDATE TO LATEST IS2 LIB"
exit 1
}
# ------------------------------------------------------------------------------
# Build waflz
# ------------------------------------------------------------------------------
main() {
build_asan=0
while getopts ":a" opt; do
case "${opt}" in
a)
build_asan=1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit $?
;;
esac
done
if [ "$(uname)" == "Darwin" ]; then
BUILD_UBUNTU=OFF
NPROC=$(sysctl -n hw.ncpu)
else
BUILD_UBUNTU=ON
NPROC=$(nproc)
fi
mkdir -p build
pushd build
if [[ "${build_asan}" -eq 1 ]]; then
cmake ../ \
-DBUILD_ASAN=ON\
-DBUILD_SYMBOLS=ON \
-DBUILD_APPS=ON \
-DBUILD_UBUNTU=${BUILD_UBUNTU} \
-DCMAKE_INSTALL_PREFIX=/usr
else
cmake ../ \
-DBUILD_SYMBOLS=ON \
-DBUILD_APPS=ON \
-DBUILD_UBUNTU=${BUILD_UBUNTU} \
-DCMAKE_INSTALL_PREFIX=/usr
fi
make -j${NPROC} && \
make test && \
umask 0022 && chmod -R a+rX . && \
make package && \
popd && \
exit $?
}
main "${@}"