-
Notifications
You must be signed in to change notification settings - Fork 178
/
Copy pathbuild.sh
executable file
·82 lines (70 loc) · 1.84 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
#!/usr/bin/env bash
set -o pipefail
function HELP {
echo "Use this command to build lbrycrd."
echo "Dependencies will be pulled and built first."
echo "Use autogen & configure directly to avoid this and use system shared libraries instead."
echo
echo "Optional arguments:"
echo "-jN: number of parallel build jobs"
echo "-q: compile the QT GUI (not working at present)"
echo "-d: force a rebuild of dependencies"
echo "-u: run the unit tests when done"
echo "-g: include debug symbols"
echo "-h: show help"
exit 1
}
REBUILD_DEPENDENCIES=false
RUN_UNIT_TESTS=false
COMPILE_WITH_DEBUG=false
DO_NOT_COMPILE_THE_GUI="NO_QT=1"
WITH_COMPILE_THE_GUI=no
if test -z $PARALLEL_JOBS; then
PARALLEL_JOBS=$(expr $(getconf _NPROCESSORS_ONLN) / 2 + 1)
fi
while getopts j:qdugh FLAG; do
case ${FLAG} in
j)
PARALLEL_JOBS=$OPTARG
;;
q)
DO_NOT_COMPILE_THE_GUI=
WITH_COMPILE_THE_GUI=qt5
;;
g)
COMPILE_WITH_DEBUG=true
;;
u)
RUN_UNIT_TESTS=true
;;
d)
REBUILD_DEPENDENCIES=true
;;
h)
HELP
;;
\?)
HELP
;;
esac
done
echo "Compiling with ${PARALLEL_JOBS} jobs in parallel."
BUILD_FLAGS=(CXXFLAGS="-O3 -march=native")
if test "$COMPILE_WITH_DEBUG" = true; then
BUILD_FLAGS=(--with-debug CXXFLAGS="-Og -g")
fi
cd depends
if test "$REBUILD_DEPENDENCIES" = true; then
make clean
fi
make -j${PARALLEL_JOBS} ${DO_NOT_COMPILE_THE_GUI} V=1
cd ..
LC_ALL=C autoreconf --install
CONFIG_SITE=$(pwd)/depends/$($(pwd)/depends/config.guess)/share/config.site ./configure --enable-reduce-exports \
--enable-static --disable-shared --with-pic --with-gui=${WITH_COMPILE_THE_GUI} "${BUILD_FLAGS[@]}"
if test $? -eq 0; then
make -j${PARALLEL_JOBS}
fi
if test $? -eq 0 && "$RUN_UNIT_TESTS" = true; then
./src/test/test_lbrycrd
fi