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