forked from iputils/iputils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·61 lines (47 loc) · 1.45 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
#!/bin/sh
CFLAGS="${CFLAGS:--Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=return-type -fno-common}"
CC="${CC:-gcc}"
BUILD_DIR="${BUILD_DIR:-builddir}"
PREFIX="${PREFIX:-$HOME/iputils-install}"
# ninja-build is not detected causes build failing => symlink to ninja
# needed for CentOS 7 but maybe for others
if ! which ninja > /dev/null >&2; then
if which ninja-build > /dev/null >&2; then
ln -sv $(which ninja-build) /usr/local/bin/ninja
else
echo "ninja binary not found (tried ninja and $NINJA on $PATH)" >&2
exit 1
fi
fi
which meson > /dev/null 2>&1 || { echo "meson binary not found" >&2; exit 1; }
BUILD_OPTS="-Dprefix=$PREFIX -DBUILD_RARPD=true -DBUILD_TFTPD=true -DBUILD_TRACEROUTE6=true $EXTRA_BUILD_OPTS"
[ -z "$EXTRA_BUILD_OPTS" ] && BUILD_OPTS="$BUILD_OPTS -DBUILD_HTML_MANS=true"
[ -f "meson.cross" ] && BUILD_OPTS="--cross-file $PWD/meson.cross $BUILD_OPTS"
cd `dirname $0`
echo "=== compiler version ==="
$CC --version
echo "=== meson version ==="
meson --version
echo "=== ninja version ==="
ninja --version
echo "=== build ==="
echo "Build options: $BUILD_OPTS"
echo "CFLAGS: $CFLAGS"
export CFLAGS
meson $BUILD_DIR $BUILD_OPTS && \
make -j$(getconf _NPROCESSORS_ONLN) && make install
ret=$?
cat << EOF
============
END OF BUILD
============
EOF
if [ $ret -ne 0 ]; then
log="$DIR/meson-logs/meson-log.txt"
if [ -f "$log" ]; then
echo "=== START $log ==="
cat $log
echo "=== END $log ==="
fi
fi
exit $ret