3 # Copyright (C) 2016 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
4 # Michael Jeanson <mjeanson@efficios.com>
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # Version compare functions
22 if [[ "$1" == "$2" ]]; then
26 local i ver1
=($1) ver2
=($2)
27 # fill empty fields in ver1 with zeros
28 for ((i
=${#ver1[@]}; i
<${#ver2[@]}; i
++)); do
31 for ((i
=0; i
<${#ver1[@]}; i
++)); do
32 if [[ -z ${ver2[i]} ]]; then
33 # fill empty fields in ver2 with zeros
36 if ((10#${ver1[i]} > 10#${ver2[i]})); then
39 if ((10#${ver1[i]} < 10#${ver2[i]})); then
48 vercomp
"$1" "$2"; local res
="$?"
49 [ "$res" -eq "0" ] ||
[ "$res" -eq "2" ]
53 vercomp
"$1" "$2"; local res
="$?"
58 vercomp
"$1" "$2"; local res
="$?"
59 [ "$res" -eq "0" ] ||
[ "$res" -eq "1" ]
63 vercomp
"$1" "$2"; local res
="$?"
68 vercomp
"$1" "$2"; local res
="$?"
73 # Create build directory
74 rm -rf "$WORKSPACE/build"
75 mkdir
-p "$WORKSPACE/build"
78 URCU_INCS
="$WORKSPACE/deps/liburcu/build/include/"
79 URCU_LIBS
="$WORKSPACE/deps/liburcu/build/lib/"
82 UST_INCS
="$WORKSPACE/deps/lttng-ust/build/include/"
83 UST_LIBS
="$WORKSPACE/deps/lttng-ust/build/lib/"
84 UST_JAVA
="$WORKSPACE/deps/lttng-ust/build/share/java/"
87 BABEL_INCS
="$WORKSPACE/deps/babeltrace/build/include/"
88 BABEL_LIBS
="$WORKSPACE/deps/babeltrace/build/lib/"
89 BABEL_BINS
="$WORKSPACE/deps/babeltrace/build/bin/"
91 PREFIX
="$WORKSPACE/build"
93 # Set platform variables
101 CFLAGS
="-D_XOPEN_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__=1"
109 BISON
="/opt/csw/bin/bison"
111 CFLAGS
="-D_XOPEN_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__=1"
114 export PATH
="$PATH:/usr/perl5/bin"
120 NPROC
="getconf _NPROCESSORS_ONLN"
125 export PATH
="/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
126 export CFLAGS
="-I/opt/local/include"
127 export LDFLAGS
="-L/opt/local/lib"
142 P2_VERSION
=$
($PYTHON2 -c "import sys;print(sys.version[:3])")
143 P3_VERSION
=$
($PYTHON3 -c "import sys;print(sys.version[:3])")
145 UST_PYTHON2
="$WORKSPACE/deps/lttng-ust/build/lib/python$P2_VERSION/site-packages"
146 UST_PYTHON3
="$WORKSPACE/deps/lttng-ust/build/lib/python$P3_VERSION/site-packages"
151 # Run bootstrap prior to configure
154 # Get source version from configure script
155 eval `grep '^PACKAGE_VERSION=' ./configure`
156 PACKAGE_VERSION
=`echo "$PACKAGE_VERSION"| sed 's/\-pre$//'`
162 export CPPFLAGS
="-I$URCU_INCS"
163 export LDFLAGS
="-L$URCU_LIBS"
164 export LD_LIBRARY_PATH
="$URCU_LIBS:$BABEL_LIBS:${LD_LIBRARY_PATH:-}"
168 export CPPFLAGS
="-I$URCU_INCS -I$UST_INCS"
169 export LDFLAGS
="-L$URCU_LIBS -L$UST_LIBS"
170 export LD_LIBRARY_PATH
="$URCU_LIBS:$UST_LIBS:$BABEL_LIBS:${LD_LIBRARY_PATH:-}"
174 # The switch to build without UST changed in 2.8
175 if vergte
"$PACKAGE_VERSION" "2.8"; then
176 NO_UST
="--without-lttng-ust"
178 NO_UST
="--disable-lttng-ust"
181 # Set configure options for each build configuration
186 CONF_OPTS
="--enable-static --disable-shared"
190 echo "Build with python bindings"
191 # We only support bindings built with Python 3
192 export PYTHON
="python3"
193 export PYTHON_CONFIG
="/usr/bin/python3-config"
194 CONF_OPTS
="--enable-python-bindings"
198 echo "Build without UST support"
203 echo "Build with Java Agents"
204 export JAVA_HOME
="/usr/lib/jvm/default-java"
205 export CLASSPATH
="$UST_JAVA/*:/usr/share/java/*"
206 CONF_OPTS
="--enable-test-java-agent-all"
210 echo "Build with python agents"
211 export PYTHONPATH
="$UST_PYTHON2:$UST_PYTHON3"
212 CONF_OPTS
="--enable-test-python-agent-all"
216 echo "Build relayd only"
217 CONF_OPTS
="--disable-bin-lttng --disable-bin-lttng-consumerd --disable-bin-lttng-crash --disable-bin-lttng-sessiond --disable-extras --disable-man-pages $NO_UST"
221 echo "Standard build"
228 # oot : out-of-tree build
229 # dist: build via make dist
230 # * : normal tree build
232 # Make sure to move to the build_path and run configure
234 BUILD_PATH
=$WORKSPACE
237 echo "Out of tree build"
238 BUILD_PATH
=$WORKSPACE/oot
239 mkdir
-p "$BUILD_PATH"
241 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" "$WORKSPACE/configure" --prefix="$PREFIX" $CONF_OPTS
245 echo "Distribution out of tree build"
246 BUILD_PATH
="`mktemp -d`"
248 # Initial configure and generate tarball
249 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" .
/configure
$CONF_OPTS --enable-build-man-pages
252 mkdir
-p "$BUILD_PATH"
253 cp .
/*.
tar.
* "$BUILD_PATH/"
256 # Ignore level 1 of tar
257 $TAR xvf .
/*.
tar.
* --strip 1
259 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" "$BUILD_PATH/configure" --prefix="$PREFIX" $CONF_OPTS
263 BUILD_PATH
=$WORKSPACE
264 echo "Standard tree build"
265 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" "$WORKSPACE/configure" --prefix="$PREFIX" $CONF_OPTS
270 $MAKE -j "`$NPROC`" V
=1
274 if [ "$RUN_TESTS" = "yes" ]; then
280 # Add 'babeltrace' binary to PATH
281 chmod +x
"$BABEL_BINS/babeltrace"
282 export PATH
="$PATH:$BABEL_BINS"
284 # Prepare tap output dirs
285 rm -rf "$WORKSPACE/tap"
286 mkdir
-p "$WORKSPACE/tap"
287 mkdir
-p "$WORKSPACE/tap/unit"
288 mkdir
-p "$WORKSPACE/tap/fast_regression"
289 mkdir
-p "$WORKSPACE/tap/with_bindings_regression"
291 # Force the lttng-sessiond path to /bin/true to prevent the spawing of a
292 # lttng-sessiond --daemonize on "lttng create"
293 export LTTNG_SESSIOND_PATH
="/bin/true"
295 # Run 'unit_tests' and 'fast_regression' test suites for all configs except 'no-ust'
296 if [ "$conf" != "no-ust" ]; then
297 # Run 'unit_tests', 2.8 and up has a new test suite
298 if vergte
"$PACKAGE_VERSION" "2.8"; then
300 rsync
-a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*'" $BUILD_PATH/tests/" "$WORKSPACE/tap"
302 prove
--merge -v --exec '' - < "$BUILD_PATH/tests/unit_tests" --archive "$WORKSPACE/tap/unit/" || true
303 prove
--merge -v --exec '' - < "$BUILD_PATH/tests/fast_regression" --archive "$WORKSPACE/tap/fast_regression/" || true
306 # Regression is disabled for now, we need to adjust the testsuite for no ust builds.
307 echo "Tests disabled for 'no-ust'."
310 # Run 'with_bindings_regression' test suite for 'python-bindings' config
311 if [ "$conf" = "python-bindings" ]; then
312 prove
--merge -v --exec '' - < "$WORKSPACE/tests/with_bindings_regression" --archive "$WORKSPACE/tap/with_bindings_regression/" || true
315 # TAP plugin is having a hard time with .yml files.
316 find "$WORKSPACE/tap" -name "meta.yml" -exec rm -f {} \
;
318 # And also with files without extension, so rename all result to *.tap
319 find "$WORKSPACE/tap/" -type f
-exec mv {} {}.tap \
;
327 # Cleanup rpath in executables and shared libraries
328 find "$WORKSPACE/build/bin" -type f
-perm -0500 -exec chrpath
--delete {} \
;
329 find "$WORKSPACE/build/lib" -name "*.so" -exec chrpath
--delete {} \
;
331 # Remove libtool .la files
332 find "$WORKSPACE/build/lib" -name "*.la" -exec rm -f {} \
;
334 # Clean temp dir for dist build
335 if [ "$build" = "dist" ]; then
This page took 0.05169 seconds and 4 git commands to generate.