| 1 | # Create build directory |
| 2 | rm -rf $WORKSPACE/build |
| 3 | mkdir -p $WORKSPACE/build |
| 4 | |
| 5 | # liburcu |
| 6 | URCU_INCS="$WORKSPACE/dependencies/liburcu/build/include/" |
| 7 | URCU_LIBS="$WORKSPACE/dependencies/liburcu/build/lib/" |
| 8 | |
| 9 | # lttng-ust |
| 10 | UST_INCS="$WORKSPACE/dependencies/lttng-ust/build/include/" |
| 11 | UST_LIBS="$WORKSPACE/dependencies/lttng-ust/build/lib/" |
| 12 | UST_PREFIX="$WORKSPACE/dependencies/lttng-ust/build/" |
| 13 | |
| 14 | # babeltrace |
| 15 | BABEL_INCS="$WORKSPACE/dependencies/babeltrace/build/include/" |
| 16 | BABEL_LIBS="$WORKSPACE/dependencies/babeltrace/build/lib/" |
| 17 | |
| 18 | PREFIX="$WORKSPACE/build" |
| 19 | |
| 20 | CONF_OPT="" |
| 21 | |
| 22 | if [ "$conf" = "no_ust" ] |
| 23 | then |
| 24 | export CPPFLAGS="-I$URCU_INCS" |
| 25 | export LDFLAGS="-L$URCU_LIBS" |
| 26 | export LD_LIBRARY_PATH="$URCU_LIBS:$BABEL_LIBS:$LD_LIBRARY_PATH" |
| 27 | else |
| 28 | CONF_OPTS+=" --with-lttng-ust-prefix=$UST_PREFIX" |
| 29 | export CPPFLAGS="-I$URCU_INCS" |
| 30 | export LDFLAGS="-L$URCU_LIBS" |
| 31 | export LD_LIBRARY_PATH="$URCU_LIBS:$BABEL_LIBS:$LD_LIBRARY_PATH" |
| 32 | fi |
| 33 | |
| 34 | ./bootstrap |
| 35 | |
| 36 | CONF_OPTS="" |
| 37 | case "$conf" in |
| 38 | # Currently disabled, ust doesn't seem to be built right for static linking. |
| 39 | #static) |
| 40 | # echo "Static build" |
| 41 | # CONF_OPTS="--enable-static --disable-shared" |
| 42 | # ;; |
| 43 | python_bindings) |
| 44 | echo "Build with python bindings" |
| 45 | # We only support bindings built with Python 3 |
| 46 | export PYTHON="python3" |
| 47 | export PYTHON_CONFIG="/usr/bin/python3-config" |
| 48 | CONF_OPTS="--enable-python-bindings" |
| 49 | ;; |
| 50 | no_ust) |
| 51 | echo "Build without UST support" |
| 52 | CONF_OPTS="--disable-lttng-ust" |
| 53 | ;; |
| 54 | java_jul) |
| 55 | echo "Build with java-jul UST support" |
| 56 | CONF_OPTS+=" --enable-java-agent-tests-jul --with-java-classpath=$UST_PREFIX/share/java/*" |
| 57 | ;; |
| 58 | *) |
| 59 | echo "Standard build" |
| 60 | CONF_OPTS="" |
| 61 | ;; |
| 62 | esac |
| 63 | |
| 64 | # Build type |
| 65 | # oot : out-of-tree build |
| 66 | # dist: build via make dist |
| 67 | # * : normal tree build |
| 68 | # |
| 69 | # Make sure to move to the build_path and configure |
| 70 | # before continuing |
| 71 | |
| 72 | BUILD_PATH=$WORKSPACE |
| 73 | case "$build" in |
| 74 | oot) |
| 75 | echo "Out of tree build" |
| 76 | BUILD_PATH=$WORKSPACE/oot |
| 77 | mkdir -p $BUILD_PATH |
| 78 | cd $BUILD_PATH |
| 79 | $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS |
| 80 | ;; |
| 81 | dist) |
| 82 | echo "Distribution out of tree build" |
| 83 | BUILD_PATH=`mktemp -d` |
| 84 | |
| 85 | # Initial configure and generate tarball |
| 86 | ./configure |
| 87 | make dist |
| 88 | |
| 89 | mkdir -p $BUILD_PATH |
| 90 | cp *.tar.* $BUILD_PATH/ |
| 91 | cd $BUILD_PATH |
| 92 | |
| 93 | # Ignore level 1 of tar |
| 94 | tar xvf *.tar.* --strip 1 |
| 95 | |
| 96 | $BUILD_PATH/configure --prefix=$PREFIX $CONF_OPTS |
| 97 | ;; |
| 98 | *) |
| 99 | BUILD_PATH=$WORKSPACE |
| 100 | echo "Standard tree build" |
| 101 | $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS |
| 102 | ;; |
| 103 | esac |
| 104 | |
| 105 | |
| 106 | make |
| 107 | make install |
| 108 | |
| 109 | # Run tests |
| 110 | # Allow core dumps |
| 111 | ulimit -c unlimited |
| 112 | |
| 113 | chmod +x $WORKSPACE/dependencies/babeltrace/build/bin/babeltrace |
| 114 | export PATH="$PATH:$WORKSPACE/dependencies/babeltrace/build/bin" |
| 115 | |
| 116 | rm -rf $WORKSPACE/tap |
| 117 | mkdir -p $WORKSPACE/tap |
| 118 | mkdir -p $WORKSPACE/tap/unit |
| 119 | mkdir -p $WORKSPACE/tap/fast_regression |
| 120 | mkdir -p $WORKSPACE/tap/with_bindings_regression |
| 121 | |
| 122 | cd $BUILD_PATH/tests |
| 123 | |
| 124 | if [ "$conf" = "std" ] |
| 125 | then |
| 126 | prove --merge --exec '' - < $BUILD_PATH/tests/unit_tests --archive $WORKSPACE/tap/unit/ || true |
| 127 | prove --merge --exec '' - < $BUILD_PATH/tests/fast_regression --archive $WORKSPACE/tap/fast_regression/ || true |
| 128 | fi |
| 129 | |
| 130 | if [ "$conf" = "java_jul" ] |
| 131 | then |
| 132 | prove --merge --exec '' - < $BUILD_PATH/tests/unit_tests --archive $WORKSPACE/tap/unit/ || true |
| 133 | prove --merge --exec '' - < $BUILD_PATH/tests/fast_regression --archive $WORKSPACE/tap/fast_regression/ || true |
| 134 | fi |
| 135 | |
| 136 | if [ "$conf" = "no_ust" ] |
| 137 | then |
| 138 | # Regression is disabled for now, we need to adjust the testsuite for no ust builds. |
| 139 | echo "Testsuite disabled. See job configuration for more info." |
| 140 | fi |
| 141 | |
| 142 | if [ "$conf" = "python_bindings" ] |
| 143 | then |
| 144 | # Disabled due to race conditions in tests |
| 145 | echo "Testsuite disabled. See job configuration for more info." |
| 146 | prove --merge --exec '' - < $BUILD_PATH/tests/unit_tests --archive $WORKSPACE/tap/unit/ || true |
| 147 | prove --merge --exec '' - < $BUILD_PATH/tests/fast_regression --archive $WORKSPACE/tap/fast_regression/ || true |
| 148 | prove --merge --exec '' - < $BUILD_PATH/tests/with_bindings_regression --archive $WORKSPACE/tap/with_bindings_regression/ || true |
| 149 | fi |
| 150 | |
| 151 | # TAP plugin is having a hard time with .yml files. |
| 152 | rm -f $WORKSPACE/tap/unit/meta.yml |
| 153 | rm -f $WORKSPACE/tap/fast_regression/meta.yml |
| 154 | rm -f $WORKSPACE/tap/with_bindings_regression/meta.yml |
| 155 | |
| 156 | # And also with files without extension, so rename all result to *.tap |
| 157 | find $WORKSPACE/tap/unit/ -type f -exec mv {} {}.tap \; |
| 158 | find $WORKSPACE/tap/fast_regression/ -type f -exec mv {} {}.tap \; |
| 159 | find $WORKSPACE/tap/with_bindings_regression/ -type f -exec mv {} {}.tap \; |
| 160 | |
| 161 | # Cleanup |
| 162 | make clean |
| 163 | |
| 164 | # Cleanup rpath and libtool .la files |
| 165 | find $WORKSPACE/build/bin -executable -type f -exec chrpath --delete {} \; |
| 166 | find $WORKSPACE/build/lib -name "*.so" -exec chrpath --delete {} \; |
| 167 | find $WORKSPACE/build/lib -name "*.la" -exec rm -f {} \; |
| 168 | |
| 169 | # Clean temp dir for dist build |
| 170 | if [ $build = "dist" ]; then |
| 171 | rm -rf $BUILD_PATH |
| 172 | fi |