Add version check to liburcu build
[lttng-ci.git] / scripts / lttng-tools / build.sh
CommitLineData
b4005bbf
MJ
1#!/bin/sh -xue
2#
3# Copyright (C) 2015 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
4# Michael Jeanson <mjeanson@efficios.com>
5#
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.
10#
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.
15#
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/>.
18
19
20# Create build directory
21rm -rf $WORKSPACE/build
22mkdir -p $WORKSPACE/build
23
95654431
MJ
24PYTHON2=python2
25PYTHON3=python3
26
27P2_VERSION=$($PYTHON2 -c "import sys;print(sys.version[:3])")
28P3_VERSION=$($PYTHON3 -c "import sys;print(sys.version[:3])")
29
b4005bbf
MJ
30# liburcu
31URCU_INCS="$WORKSPACE/deps/liburcu/build/include/"
32URCU_LIBS="$WORKSPACE/deps/liburcu/build/lib/"
33
34# lttng-ust
35UST_INCS="$WORKSPACE/deps/lttng-ust/build/include/"
36UST_LIBS="$WORKSPACE/deps/lttng-ust/build/lib/"
95654431
MJ
37UST_JAVA="$WORKSPACE/deps/lttng-ust/build/share/java/"
38UST_PYTHON2="$WORKSPACE/deps/lttng-ust/build/lib/python$P2_VERSION/site-packages"
39UST_PYTHON3="$WORKSPACE/deps/lttng-ust/build/lib/python$P3_VERSION/site-packages"
b4005bbf
MJ
40
41# babeltrace
42BABEL_INCS="$WORKSPACE/deps/babeltrace/build/include/"
43BABEL_LIBS="$WORKSPACE/deps/babeltrace/build/lib/"
44BABEL_BINS="$WORKSPACE/deps/babeltrace/build/bin/"
45
46PREFIX="$WORKSPACE/build"
47
95654431 48if [ "$conf" = "no-ust" ]
b4005bbf
MJ
49then
50 export CPPFLAGS="-I$URCU_INCS"
51 export LDFLAGS="-L$URCU_LIBS"
52 export LD_LIBRARY_PATH="$URCU_LIBS:$BABEL_LIBS:${LD_LIBRARY_PATH:-}"
53else
54 export CPPFLAGS="-I$URCU_INCS -I$UST_INCS"
55 export LDFLAGS="-L$URCU_LIBS -L$UST_LIBS"
56 export LD_LIBRARY_PATH="$URCU_LIBS:$UST_LIBS:$BABEL_LIBS:${LD_LIBRARY_PATH:-}"
57fi
58
59./bootstrap
60
61CONF_OPTS=""
62case "$conf" in
95654431
MJ
63 static)
64 echo "Static build"
65 CONF_OPTS="--enable-static --disable-shared"
66 ;;
67
68 python-bindings)
69 echo "Build with python bindings"
70 # We only support bindings built with Python 3
71 export PYTHON="python3"
72 export PYTHON_CONFIG="/usr/bin/python3-config"
73 CONF_OPTS="--enable-python-bindings"
74 ;;
75
76 no-ust)
77 echo "Build without UST support"
78 CONF_OPTS="--disable-lttng-ust"
79 ;;
80
81 java-agent)
82 echo "Build with Java Agents"
83 export JAVA_HOME="/usr/lib/jvm/default-java"
84 export CLASSPATH="$UST_JAVA/*:/usr/share/java/*"
85 CONF_OPTS="--enable-test-java-agent-all"
86 ;;
87
88 python-agent)
89 echo "Build with python agents"
90 export PYTHONPATH="$UST_PYTHON2:$UST_PYTHON3"
91 CONF_OPTS="--enable-test-python-agent-all"
92 ;;
93
94 *)
95 echo "Standard build"
96 CONF_OPTS=""
97 ;;
b4005bbf
MJ
98esac
99
100# Build type
101# oot : out-of-tree build
102# dist: build via make dist
103# * : normal tree build
104#
105# Make sure to move to the build_path and configure
106# before continuing
107
108BUILD_PATH=$WORKSPACE
109case "$build" in
95654431
MJ
110 oot)
111 echo "Out of tree build"
112 BUILD_PATH=$WORKSPACE/oot
113 mkdir -p $BUILD_PATH
114 cd $BUILD_PATH
115 $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
116 ;;
117
118 dist)
119 echo "Distribution out of tree build"
120 BUILD_PATH=`mktemp -d`
121
122 # Initial configure and generate tarball
123 ./configure $CONF_OPTS
124 make dist
125
126 mkdir -p $BUILD_PATH
127 cp *.tar.* $BUILD_PATH/
128 cd $BUILD_PATH
129
130 # Ignore level 1 of tar
131 tar xvf *.tar.* --strip 1
132
133 $BUILD_PATH/configure --prefix=$PREFIX $CONF_OPTS
134 ;;
135
136 *)
137 BUILD_PATH=$WORKSPACE
138 echo "Standard tree build"
139 $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
140 ;;
b4005bbf
MJ
141esac
142
143
144make
145make install
146
147# Run tests
148# Allow core dumps
149ulimit -c unlimited
150
95654431 151# Add 'babeltrace' binary to PATH
b4005bbf
MJ
152chmod +x $BABEL_BINS/babeltrace
153export PATH="$PATH:$BABEL_BINS"
154
95654431 155# Prepare tap output dirs
b4005bbf
MJ
156rm -rf $WORKSPACE/tap
157mkdir -p $WORKSPACE/tap
158mkdir -p $WORKSPACE/tap/unit
159mkdir -p $WORKSPACE/tap/fast_regression
160mkdir -p $WORKSPACE/tap/with_bindings_regression
161
162cd $BUILD_PATH/tests
163
95654431
MJ
164# Run 'unit_tests' and 'fast_regression' test suites for all configs except 'no-ust'
165if [ "$conf" != "no-ust" ]; then
166 prove --merge -v --exec '' - < $BUILD_PATH/tests/unit_tests --archive $WORKSPACE/tap/unit/ || true
167 prove --merge -v --exec '' - < $BUILD_PATH/tests/fast_regression --archive $WORKSPACE/tap/fast_regression/ || true
168else
b4005bbf 169 # Regression is disabled for now, we need to adjust the testsuite for no ust builds.
95654431 170 echo "Testsuite disabled for 'no-ust'. See job configuration for more info."
b4005bbf
MJ
171fi
172
95654431
MJ
173# Run 'with_bindings_regression' test suite for 'python-bindings' config
174if [ "$conf" = "python-bindings" ]
b4005bbf 175then
95654431 176 prove --merge -v --exec '' - < $WORKSPACE/tests/with_bindings_regression --archive $WORKSPACE/tap/with_bindings_regression/ || true
b4005bbf
MJ
177fi
178
179# TAP plugin is having a hard time with .yml files.
180rm -f $WORKSPACE/tap/unit/meta.yml
181rm -f $WORKSPACE/tap/fast_regression/meta.yml
182rm -f $WORKSPACE/tap/with_bindings_regression/meta.yml
183
184# And also with files without extension, so rename all result to *.tap
185find $WORKSPACE/tap/unit/ -type f -exec mv {} {}.tap \;
186find $WORKSPACE/tap/fast_regression/ -type f -exec mv {} {}.tap \;
187find $WORKSPACE/tap/with_bindings_regression/ -type f -exec mv {} {}.tap \;
188
189# Cleanup
190make clean
191
192# Cleanup rpath and libtool .la files
193find $WORKSPACE/build/bin -executable -type f -exec chrpath --delete {} \;
194find $WORKSPACE/build/lib -name "*.so" -exec chrpath --delete {} \;
195find $WORKSPACE/build/lib -name "*.la" -exec rm -f {} \;
196
197# Clean temp dir for dist build
198if [ $build = "dist" ]; then
199 rm -rf $BUILD_PATH
200fi
95654431
MJ
201
202# EOF
This page took 0.030291 seconds and 4 git commands to generate.