Commit | Line | Data |
---|---|---|
275b59d2 JRJ |
1 | # Create build directory |
2 | rm -rf $WORKSPACE/build | |
3 | mkdir -p $WORKSPACE/build | |
4 | ||
5 | PREFIX="$WORKSPACE/build" | |
6 | ||
7 | ./bootstrap | |
8 | ||
9 | CONF_OPTS="" | |
10 | ||
11 | case "$conf" in | |
12 | static) | |
13 | echo "Static build" | |
14 | CONF_OPTS="--enable-static --disable-shared" | |
15 | ;; | |
16 | python_bindings) | |
17 | echo "Build with python bindings" | |
18 | # We only support bindings built with Python 3 | |
19 | export PYTHON="python3" | |
20 | export PYTHON_CONFIG="/usr/bin/python3-config" | |
21 | CONF_OPTS="--enable-python-bindings" | |
22 | ;; | |
23 | *) | |
24 | echo "Standard build" | |
25 | CONF_OPTS="" | |
26 | ;; | |
27 | esac | |
28 | ||
aad6ac90 JR |
29 | # Build type |
30 | # oot : out-of-tree build | |
31 | # dist: build via make dist | |
32 | # * : normal tree build | |
33 | # | |
34 | # Make sure to move to the build_path and configure | |
35 | # before continuing | |
275b59d2 | 36 | |
aad6ac90 | 37 | BUILD_PATH=$WORKSPACE |
28c11f27 JR |
38 | TEST_PLAN_PATH=$WORKSPACE |
39 | ||
aad6ac90 JR |
40 | case "$build" in |
41 | oot) | |
42 | echo "Out of tree build" | |
43 | BUILD_PATH=$WORKSPACE/oot | |
44 | mkdir -p $BUILD_PATH | |
45 | cd $BUILD_PATH | |
46 | $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS | |
47 | ;; | |
48 | dist) | |
49 | echo "Distribution out of tree build" | |
50 | BUILD_PATH=`mktemp -d` | |
51 | ||
52 | # Initial configure and generate tarball | |
53 | ./configure | |
54 | make dist | |
55 | ||
56 | mkdir -p $BUILD_PATH | |
57 | cp *.tar.* $BUILD_PATH/ | |
58 | cd $BUILD_PATH | |
59 | ||
60 | # Ignore level 1 of tar | |
61 | tar xvf *.tar.* --strip 1 | |
62 | ||
63 | $BUILD_PATH/configure --prefix=$PREFIX $CONF_OPTS | |
28c11f27 JR |
64 | |
65 | # Set test plan to dist tar | |
66 | TEST_PLAN_PATH=$BUILD_PATH | |
aad6ac90 JR |
67 | ;; |
68 | *) | |
aad6ac90 JR |
69 | echo "Standard tree build" |
70 | $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS | |
71 | ;; | |
72 | esac | |
73 | ||
d05d558c | 74 | make |
275b59d2 JRJ |
75 | make install |
76 | ||
77 | rm -rf $WORKSPACE/tap | |
78 | mkdir -p $WORKSPACE/tap | |
79 | ||
aad6ac90 | 80 | cd $BUILD_PATH/tests |
275b59d2 JRJ |
81 | |
82 | # Run make check tests | |
28c11f27 JR |
83 | if [ -e $TEST_PLAN_PATH/tests/tests ]; then |
84 | prove --merge --exec '' - < $TEST_PLAN_PATH/tests/tests --archive $WORKSPACE/tap/ || true | |
dfce032b JR |
85 | else |
86 | echo "Missing test plan" | |
87 | exit 1 | |
88 | fi | |
275b59d2 JRJ |
89 | |
90 | # TAP plugin is having a hard time with .yml files. | |
91 | rm -f $WORKSPACE/tap/meta.yml | |
92 | ||
93 | # And also with files without extension, so rename all result to *.tap | |
94 | find $WORKSPACE/tap/ -type f -exec mv {} {}.tap \; | |
95 | ||
96 | make clean | |
97 | ||
98 | # Cleanup rpath and libtool .la files | |
99 | find $WORKSPACE/build/bin -executable -type f -exec chrpath --delete {} \; | |
100 | find $WORKSPACE/build/lib -name "*.so" -exec chrpath --delete {} \; | |
101 | find $WORKSPACE/build/lib -name "*.la" -exec rm -f {} \; | |
aad6ac90 JR |
102 | |
103 | if [ $build = "dist" ]; then | |
104 | rm -rf $BUILD_PATH | |
105 | fi |