| 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 | |
| 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 |
| 36 | |
| 37 | BUILD_PATH=$WORKSPACE |
| 38 | case "$build" in |
| 39 | oot) |
| 40 | echo "Out of tree build" |
| 41 | BUILD_PATH=$WORKSPACE/oot |
| 42 | mkdir -p $BUILD_PATH |
| 43 | cd $BUILD_PATH |
| 44 | $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS |
| 45 | ;; |
| 46 | dist) |
| 47 | echo "Distribution out of tree build" |
| 48 | BUILD_PATH=`mktemp -d` |
| 49 | |
| 50 | # Initial configure and generate tarball |
| 51 | ./configure |
| 52 | make dist |
| 53 | |
| 54 | mkdir -p $BUILD_PATH |
| 55 | cp *.tar.* $BUILD_PATH/ |
| 56 | cd $BUILD_PATH |
| 57 | |
| 58 | # Ignore level 1 of tar |
| 59 | tar xvf *.tar.* --strip 1 |
| 60 | |
| 61 | $BUILD_PATH/configure --prefix=$PREFIX $CONF_OPTS |
| 62 | ;; |
| 63 | *) |
| 64 | BUILD_PATH=$WORKSPACE |
| 65 | echo "Standard tree build" |
| 66 | $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS |
| 67 | ;; |
| 68 | esac |
| 69 | |
| 70 | make V=1 |
| 71 | make install |
| 72 | |
| 73 | rm -rf $WORKSPACE/tap |
| 74 | mkdir -p $WORKSPACE/tap |
| 75 | |
| 76 | cd $BUILD_PATH/tests |
| 77 | |
| 78 | # Run make check tests |
| 79 | prove --merge --exec '' - < $BUILD_PATH/tests/tests --archive $WORKSPACE/tap/ || true |
| 80 | |
| 81 | # TAP plugin is having a hard time with .yml files. |
| 82 | rm -f $WORKSPACE/tap/meta.yml |
| 83 | |
| 84 | # And also with files without extension, so rename all result to *.tap |
| 85 | find $WORKSPACE/tap/ -type f -exec mv {} {}.tap \; |
| 86 | |
| 87 | make clean |
| 88 | |
| 89 | # Cleanup rpath and libtool .la files |
| 90 | find $WORKSPACE/build/bin -executable -type f -exec chrpath --delete {} \; |
| 91 | find $WORKSPACE/build/lib -name "*.so" -exec chrpath --delete {} \; |
| 92 | find $WORKSPACE/build/lib -name "*.la" -exec rm -f {} \; |
| 93 | |
| 94 | if [ $build = "dist" ]; then |
| 95 | rm -rf $BUILD_PATH |
| 96 | fi |