babeltrace: set up tap parser for new test driver
[lttng-ci.git] / scripts / babeltrace / build.sh
CommitLineData
c56b9301 1#!/bin/bash -exu
890bff23
MJ
2#
3# Copyright (C) 2015 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
c56b9301 18
275b59d2
JRJ
19# Create build directory
20rm -rf $WORKSPACE/build
21mkdir -p $WORKSPACE/build
22
23PREFIX="$WORKSPACE/build"
24
c56b9301 25# Set platform variables
87e41bca
MJ
26case "$arch" in
27solaris10)
28 MAKE=gmake
29 TAR=gtar
30 NPROC=gnproc
31 BISON=bison
32 YACC="$BISON -y"
33 ;;
34solaris11)
35 MAKE=gmake
36 TAR=gtar
37 NPROC=nproc
38 BISON="/opt/csw/bin/bison"
39 YACC="$BISON -y"
40 export PATH="$PATH:/usr/perl5/bin"
41 ;;
221450b6
MJ
42macosx)
43 MAKE=make
44 TAR=tar
45 NPROC="getconf _NPROCESSORS_ONLN"
46 BISON="bison"
47 YACC="$BISON -y"
48 export PATH="/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
49 export CFLAGS="-I/opt/local/include"
50 export LDFLAGS="-L/opt/local/lib"
51 ;;
87e41bca
MJ
52*)
53 MAKE=make
54 TAR=tar
55 NPROC=nproc
56 BISON=bison
57 YACC="$BISON -y"
58 ;;
59esac
60
c56b9301
MJ
61# Set configure options for each build configuration
62CONF_OPTS=""
275b59d2
JRJ
63case "$conf" in
64static)
65 echo "Static build"
66 CONF_OPTS="--enable-static --disable-shared"
67 ;;
221450b6 68python-bindings)
275b59d2
JRJ
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 echo "Standard build"
77 CONF_OPTS=""
78 ;;
79esac
80
c56b9301
MJ
81
82# Run bootstrap prior to configure
83./bootstrap
84
85
aad6ac90
JR
86# Build type
87# oot : out-of-tree build
88# dist: build via make dist
89# * : normal tree build
90#
91# Make sure to move to the build_path and configure
92# before continuing
aad6ac90 93BUILD_PATH=$WORKSPACE
28c11f27 94TEST_PLAN_PATH=$WORKSPACE
aad6ac90 95case "$build" in
c56b9301
MJ
96 oot)
97 echo "Out of tree build"
98 BUILD_PATH=$WORKSPACE/oot
99 mkdir -p $BUILD_PATH
100 cd $BUILD_PATH
101 MAKE=$MAKE BISON="$BISON" YACC="$YACC" $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
102 ;;
103
104 dist)
105 echo "Distribution out of tree build"
221450b6 106 BUILD_PATH=`mktemp -d`
c56b9301
MJ
107
108 # Initial configure and generate tarball
109 MAKE=$MAKE BISON="$BISON" YACC="$YACC" ./configure
110 $MAKE dist
111
112 mkdir -p $BUILD_PATH
113 cp *.tar.* $BUILD_PATH/
114 cd $BUILD_PATH
115
116 # Ignore level 1 of tar
117 $TAR xvf *.tar.* --strip 1
118
119 MAKE=$MAKE BISON="$BISON" YACC="$YACC" $BUILD_PATH/configure --prefix=$PREFIX $CONF_OPTS
120
121 # Set test plan to dist tar
122 TEST_PLAN_PATH=$BUILD_PATH
123 ;;
124
0628a9d8
MJ
125 clang)
126 echo "LLVM clang build"
127 export CC=clang
128 clang -v
129 MAKE=$MAKE BISON="$BISON" YACC="$YACC" $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
130 ;;
131 *)
c56b9301
MJ
132 echo "Standard tree build"
133 MAKE=$MAKE BISON="$BISON" YACC="$YACC" $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
134 ;;
aad6ac90
JR
135esac
136
c56b9301 137# BUILD!
fe584a39 138$MAKE -j `$NPROC` V=1
87e41bca 139$MAKE install
c56b9301
MJ
140
141# Run tests
221450b6 142$MAKE check
c56b9301 143
1d9e7aaa
MJ
144# Remove global test suite log file, it confuses the tap parser
145rm -f tests/test-suite.log
275b59d2 146
c56b9301
MJ
147# Cleanup rpath in executables and shared libraries
148find $WORKSPACE/build/bin -type f -perm -0500 -exec chrpath --delete {} \;
275b59d2 149find $WORKSPACE/build/lib -name "*.so" -exec chrpath --delete {} \;
c56b9301
MJ
150
151# Remove libtool .la files
275b59d2 152find $WORKSPACE/build/lib -name "*.la" -exec rm -f {} \;
aad6ac90 153
c56b9301
MJ
154# Clean temp dir for dist build
155if [ "$build" = "dist" ]; then
87e41bca
MJ
156 cd $WORKSPACE
157 rm -rf $BUILD_PATH
aad6ac90 158fi
87e41bca
MJ
159
160# EOF
This page took 0.028986 seconds and 4 git commands to generate.