3 # Copyright (C) 2015 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
4 # 2016 - 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 bt2_mode
=${bt2_mode:-}
80 SRCDIR
="$WORKSPACE/src/babeltrace"
81 TMPDIR
="$WORKSPACE/tmp"
82 PREFIX
="$WORKSPACE/build"
84 # Create build and tmp directories
85 rm -rf "$PREFIX" "$TMPDIR"
86 mkdir
-p "$PREFIX" "$TMPDIR"
89 export CFLAGS
="-g -O2"
91 # Set compiler variables
123 export CXX
=clang
++-3.9
127 export CXX
=clang
++-4.0
131 export CXX
=clang
++-5.0
135 export CXX
=clang
++-6.0
142 if [ "x$cc" != "x" ]; then
148 if [ "x${CC:-}" != "x" ]; then
149 echo "Selected compiler:"
153 # Set platform variables
160 export YACC
="$BISON -y"
161 export PATH
="/opt/csw/bin:/usr/ccs/bin:$PATH"
162 export CPPFLAGS
="-I/opt/csw/include"
163 export LDFLAGS
="-L/opt/csw/lib -R/opt/csw/lib"
164 export PKG_CONFIG_PATH
="/opt/csw/lib/pkgconfig"
170 export PATH
="$PATH:/usr/perl5/bin"
171 export LD_ALTEXEC
=/usr
/bin
/gld
172 export LD
=/usr
/bin
/gld
177 export NPROC
="getconf _NPROCESSORS_ONLN"
179 export YACC
="$BISON -y"
180 export PATH
="/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
181 export CFLAGS
="$CFLAGS -I/opt/local/include"
182 export LDFLAGS
="-L/opt/local/lib"
191 # Enter the source directory
194 # Run bootstrap in the source directory prior to configure
197 # Get source version from configure script
198 eval "$(grep '^PACKAGE_VERSION=' ./configure)"
200 # Enable dev mode by default for BT 2.0 builds
203 echo "Developer mode"
204 export BABELTRACE_DEBUG_MODE
=1
205 export BABELTRACE_DEV_MODE
=1
206 export BABELTRACE_MINIMAL_LOG_LEVEL
=VERBOSE
209 echo "Production mode (Default)"
210 export BABELTRACE_MINIMAL_LOG_LEVEL
=INFO
214 # Set configure options for each build configuration
219 CONF_OPTS
="--enable-static --disable-shared"
220 if vergte
"$PACKAGE_VERSION" "2.0"; then
221 CONF_OPTS
="${CONF_OPTS} --enable-built-in-plugins"
225 echo "Build with python bindings"
226 # We only support bindings built with Python 3
227 export PYTHON
="python3"
228 export PYTHON_CONFIG
="/usr/bin/python3-config"
229 CONF_OPTS
="--enable-python-bindings"
231 if vergte
"$PACKAGE_VERSION" "2.0"; then
232 CONF_OPTS
="${CONF_OPTS} --enable-python-bindings-doc --enable-python-plugins"
236 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 configure
251 echo "Out of tree build"
252 BUILD_PATH
="$WORKSPACE/oot"
253 mkdir
-p "$BUILD_PATH"
255 "$SRCDIR/configure" --prefix="$PREFIX" $CONF_OPTS
259 echo "Distribution out of tree build"
260 BUILD_PATH
="$(mktemp -d)"
262 # Initial configure and generate tarball
266 mkdir
-p "$BUILD_PATH"
267 cp .
/*.
tar.
* "$BUILD_PATH/"
270 # Ignore level 1 of tar
271 $TAR xvf .
/*.
tar.
* --strip 1
273 "$BUILD_PATH/configure" --prefix="$PREFIX" $CONF_OPTS
277 echo "Standard in-tree build"
278 "$SRCDIR/configure" --prefix="$PREFIX" $CONF_OPTS
283 $MAKE -j "$($NPROC)" V
=1
287 $MAKE --keep-going check
289 # Copy tap logs for the jenkins tap parser
290 rsync
-a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests
/ "$WORKSPACE/tap"
292 # Clean the build directory
295 # Cleanup rpath in executables and shared libraries
296 find "$PREFIX/bin" -type f
-perm -0500 -exec chrpath
--delete {} \
;
297 find "$PREFIX/lib" -name "*.so" -exec chrpath
--delete {} \
;
299 # Remove libtool .la files
300 find "$PREFIX/lib" -name "*.la" -exec rm -f {} \
;
302 # Clean temp dir for dist build
303 if [ "$build" = "dist" ]; then