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