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
="$?"
77 SRCDIR
="$WORKSPACE/src/lttng-tools"
78 TMPDIR
="$WORKSPACE/tmp"
79 PREFIX
="$WORKSPACE/build"
80 TAPDIR
="$WORKSPACE/tap"
83 # Create build and tmp directories
84 rm -rf "$PREFIX" "$TMPDIR" "$TAPDIR"
85 mkdir
-p "$PREFIX" "$TMPDIR" "$TAPDIR"
90 URCU_INCS
="$WORKSPACE/deps/liburcu/build/include/"
91 URCU_LIBS
="$WORKSPACE/deps/liburcu/build/lib/"
94 UST_INCS
="$WORKSPACE/deps/lttng-ust/build/include/"
95 UST_LIBS
="$WORKSPACE/deps/lttng-ust/build/lib/"
96 UST_JAVA
="$WORKSPACE/deps/lttng-ust/build/share/java/"
99 #BABEL_INCS="$WORKSPACE/deps/babeltrace/build/include/"
100 BABEL_LIBS
="$WORKSPACE/deps/babeltrace/build/lib/"
101 BABEL_BINS
="$WORKSPACE/deps/babeltrace/build/bin/"
104 # Set platform variables
112 CFLAGS
="-D_XOPEN_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__=1"
120 BISON
="/opt/csw/bin/bison"
122 CFLAGS
="-D_XOPEN_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__=1"
125 export PATH
="$PATH:/usr/perl5/bin"
131 NPROC
="getconf _NPROCESSORS_ONLN"
136 export PATH
="/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
137 export CFLAGS
="-I/opt/local/include"
138 export LDFLAGS
="-L/opt/local/lib"
153 P2_VERSION
=$
($PYTHON2 -c "import sys;print(sys.version[:3])")
154 P3_VERSION
=$
($PYTHON3 -c "import sys;print(sys.version[:3])")
156 UST_PYTHON2
="$WORKSPACE/deps/lttng-ust/build/lib/python$P2_VERSION/site-packages"
157 UST_PYTHON3
="$WORKSPACE/deps/lttng-ust/build/lib/python$P3_VERSION/site-packages"
162 # Enter the source directory
165 # Run bootstrap in the source directory prior to configure
168 # Get source version from configure script
169 eval "$(grep '^PACKAGE_VERSION=' ./configure)"
170 PACKAGE_VERSION
=$
(echo "$PACKAGE_VERSION"|
sed 's/\-pre$//')
176 export CPPFLAGS
="-I$URCU_INCS"
177 export LDFLAGS
="-L$URCU_LIBS"
178 export LD_LIBRARY_PATH
="$URCU_LIBS:$BABEL_LIBS:${LD_LIBRARY_PATH:-}"
182 export CPPFLAGS
="-I$URCU_INCS -I$UST_INCS"
183 export LDFLAGS
="-L$URCU_LIBS -L$UST_LIBS"
184 export LD_LIBRARY_PATH
="$URCU_LIBS:$UST_LIBS:$BABEL_LIBS:${LD_LIBRARY_PATH:-}"
188 # The switch to build without UST changed in 2.8
189 if vergte
"$PACKAGE_VERSION" "2.8"; then
190 NO_UST
="--without-lttng-ust"
192 NO_UST
="--disable-lttng-ust"
195 # Set configure options for each build configuration
200 CONF_OPTS
="--enable-static --disable-shared"
204 echo "Build with python bindings"
205 # We only support bindings built with Python 3
206 export PYTHON
="python3"
207 export PYTHON_CONFIG
="/usr/bin/python3-config"
208 CONF_OPTS
="--enable-python-bindings"
212 echo "Build without UST support"
217 echo "Build with Java Agents"
218 export JAVA_HOME
="/usr/lib/jvm/default-java"
219 export CLASSPATH
="$UST_JAVA/*:/usr/share/java/*"
220 CONF_OPTS
="--enable-test-java-agent-all"
224 echo "Build with python agents"
225 export PYTHONPATH
="$UST_PYTHON2:$UST_PYTHON3"
226 CONF_OPTS
="--enable-test-python-agent-all"
230 echo "Build relayd only"
231 CONF_OPTS
="--disable-bin-lttng --disable-bin-lttng-consumerd --disable-bin-lttng-crash --disable-bin-lttng-sessiond --disable-extras --disable-man-pages $NO_UST"
235 echo "Standard build"
242 # oot : out-of-tree build
243 # dist: build via make dist
244 # * : normal tree build
246 # Make sure to move to the build_path and run configure
251 echo "Out of tree build"
252 BUILD_PATH
=$WORKSPACE/oot
253 mkdir
-p "$BUILD_PATH"
255 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" "$SRCDIR/configure" --prefix="$PREFIX" $CONF_OPTS
259 echo "Distribution out of tree build"
260 BUILD_PATH
="$(mktemp -d)"
262 # Initial configure and generate tarball
263 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" "$SRCDIR/configure" $CONF_OPTS --enable-build-man-pages
266 mkdir
-p "$BUILD_PATH"
267 cp .
/*.
tar.
* "$BUILD_PATH/"
270 # Ignore level 1 of tar
271 $TAR xvf .
/*.
tar.
* --strip 1
273 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" "$BUILD_PATH/configure" --prefix="$PREFIX" $CONF_OPTS
277 echo "Standard tree build"
278 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" "$BUILD_PATH/configure" --prefix="$PREFIX" $CONF_OPTS
283 $MAKE -j "$($NPROC)" V
=1
287 if [ "$RUN_TESTS" = "yes" ]; then
293 # Add 'babeltrace' binary to PATH
294 chmod +x
"$BABEL_BINS/babeltrace"
295 export PATH
="$PATH:$BABEL_BINS"
297 # Prepare tap output dirs
300 mkdir
-p "$TAPDIR/unit"
301 mkdir
-p "$TAPDIR/fast_regression"
302 mkdir
-p "$TAPDIR/with_bindings_regression"
304 # Force the lttng-sessiond path to /bin/true to prevent the spawing of a
305 # lttng-sessiond --daemonize on "lttng create"
306 export LTTNG_SESSIOND_PATH
="/bin/true"
308 # Run 'unit_tests' and 'fast_regression' test suites for all configs except 'no-ust'
309 if [ "$conf" != "no-ust" ]; then
310 # Run 'unit_tests', 2.8 and up has a new test suite
311 if vergte
"$PACKAGE_VERSION" "2.8"; then
313 rsync
-a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*'" $BUILD_PATH/tests/" "$TAPDIR"
315 prove
--merge -v --exec '' - < "$BUILD_PATH/tests/unit_tests" --archive "$TAPDIR/unit/" || true
316 prove
--merge -v --exec '' - < "$BUILD_PATH/tests/fast_regression" --archive "$TAPDIR/fast_regression/" || true
319 # Regression is disabled for now, we need to adjust the testsuite for no ust builds.
320 echo "Tests disabled for 'no-ust'."
323 # Run 'with_bindings_regression' test suite for 'python-bindings' config
324 if [ "$conf" = "python-bindings" ]; then
325 prove
--merge -v --exec '' - < "$BUILD_PATH/tests/with_bindings_regression" --archive "$TAPDIR/with_bindings_regression/" || true
328 # TAP plugin is having a hard time with .yml files.
329 find "$TAPDIR" -name "meta.yml" -exec rm -f {} \
;
331 # And also with files without extension, so rename all result to *.tap
332 find "$TAPDIR/" -type f
-exec mv {} {}.tap \
;
340 # Cleanup rpath in executables and shared libraries
341 find "$PREFIX/bin" -type f
-perm -0500 -exec chrpath
--delete {} \
;
342 find "$PREFIX/lib" -name "*.so" -exec chrpath
--delete {} \
;
344 # Remove libtool .la files
345 find "$PREFIX/lib" -name "*.la" -exec rm -f {} \
;
347 # Clean temp dir for dist build
348 if [ "$build" = "dist" ]; then
This page took 0.054667 seconds and 4 git commands to generate.