forked from nmap/libpcap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·89 lines (83 loc) · 2.36 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
# This script runs one build with setup environment variables: CC, CMAKE and
# REMOTE (default: CC=gcc, CMAKE=no, REMOTE=no).
set -e
# CC: gcc or clang
CC=${CC:-gcc}
# CMAKE: no or yes
CMAKE=${CMAKE:-no}
# REMOTE: no or yes
REMOTE=${REMOTE:-no}
# Install directory prefix
PREFIX=/tmp/local
travis_fold() {
local action="$1"
local name="$2"
if [ "$TRAVIS" != true ]; then return; fi
echo -ne "travis_fold:$action:$LABEL.script.$name\\r"
sleep 1
}
# Run a command after displaying it
run_after_echo() {
echo -n '$ '
echo "$@"
$@
}
# LABEL is needed to build the travis fold labels
LABEL="$CC.$CMAKE.$REMOTE"
if [ "$CMAKE" = no ]; then
echo '$ ./configure [...]'
travis_fold start configure
./configure --prefix=$PREFIX --enable-remote="$REMOTE"
travis_fold end configure
else
# Remove the leftovers from any earlier in-source builds, so this
# out-of-source build does not break because of that.
# https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#what-is-an-out-of-source-build
rm -rf CMakeFiles/ CMakeCache.txt
[ ! -d build ] && mkdir build
cd build
echo '$ cmake [...]'
travis_fold start cmake
cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_REMOTE="$REMOTE" ..
travis_fold end cmake
fi
run_after_echo "make -s clean"
run_after_echo "make -s"
run_after_echo "make -s testprogs"
echo '$ make install'
travis_fold start make_install
make install
travis_fold end make_install
if [ "$CMAKE" = no ]; then
run_after_echo "testprogs/findalldevstest"
else
run_after_echo "run/findalldevstest"
fi
if [ "$CMAKE" = no ]; then
system=$(uname -s)
if [ "$system" = Darwin ] || [ "$system" = Linux ]; then
run_after_echo "make releasetar"
fi
fi
if [ "$TRAVIS" = true ]; then
echo '$ cat Makefile [...]'
travis_fold start cat_makefile
if [ "$CMAKE" = no ]; then
sed -n '1,/DO NOT DELETE THIS LINE -- mkdep uses it/p' < Makefile
else
cat Makefile
fi
travis_fold end cat_makefile
echo '$ cat config.h'
travis_fold start cat_config_h
cat config.h
travis_fold end cat_config_h
if [ "$CMAKE" = no ]; then
echo '$ cat config.log'
travis_fold start cat_config_log
cat config.log
travis_fold end cat_config_log
fi
fi
# vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :