forked from SELinuxProject/selinux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
local_build.sh
executable file
·42 lines (38 loc) · 1.13 KB
/
local_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
#!/bin/sh
# Build project on my local test system
set -eux
cd "$(dirname -- "$0")"
export DESTDIR=/tmp/makepkg/sel
msg_red() {
printf '\033[1;31m%s\033[m\n' "$*"
}
while [ $# -ge 2 ] ; do
case "$1" in
clean)
# Clean the build project before building
make DESTDIR="$DESTDIR" clean distclean -j
if [ -e "$DESTDIR/usr/bin/newrole" ] ; then
# newrole is not writable so "rm" fails. Fix this by making it writable before removing it.
chmod u+w "$DESTDIR/usr/bin/newrole"
fi
rm -r "$DESTDIR"
;;
debug)
# Enable debug
export DEBUG=1
;;
clang)
# Force using clang
export CC=clang
;;
esac
shift
done
if ! make DESTDIR="$DESTDIR" install -j ; then
msg_red "'make install -j' failed, rerun it without parallelism"
make DESTDIR="$DESTDIR" install
msg_red "Exiting because 'make install -j' failed even tough 'make install' succeeded"
exit 1
fi
make DESTDIR="$DESTDIR" install-pywrap -j
bash -ue ./scripts/env_use_destdir make test