-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·58 lines (56 loc) · 1.32 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
#!/bin/bash
# ------------------------------------------------------------------------------
# Usage
# ------------------------------------------------------------------------------
usage() {
cat <<EOM
$0: [hs]
-h display some help, you know, this
-s shallow clone, useful for faster builds
-p install prefix
-s doesn't work with git prior to 2.8 (e.g. xenial)
EOM
exit 1
}
# ------------------------------------------------------------------------------
# Requirements to build...
# ------------------------------------------------------------------------------
check_req() {
which cmake g++ make || {
echo "Failed to find required build packages. Please install with: sudo apt-get install cmake make g++"
exit 1
}
}
# ------------------------------------------------------------------------------
# build...
# ------------------------------------------------------------------------------
main() {
check_req
mkdir -p build
pushd build && \
cmake ../ \
-DBUILD_SYMBOLS=ON \
-DBUILD_TLS=ON \
-DCMAKE_INSTALL_PREFIX=${install_prefix} && \
make -j${NPROC} && \
umask 0022 && chmod -R a+rX . && \
make package && \
popd && \
exit $?
}
install_prefix="/usr"
#parse options
while getopts ":hsp:" opts; do
case "${opts}" in
h)
usage
;;
p)
install_prefix="${OPTARG}"
;;
*)
usage
;;
esac
done
main