Fix pylint job
[lttng-ci.git] / scripts / babeltrace / build.sh
CommitLineData
f12f1d66 1#!/bin/sh -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
275b59d2
JRJ
18# Create build directory
19rm -rf $WORKSPACE/build
20mkdir -p $WORKSPACE/build
21
22PREFIX="$WORKSPACE/build"
23
24./bootstrap
25
26CONF_OPTS=""
27
28case "$conf" in
29static)
30 echo "Static build"
31 CONF_OPTS="--enable-static --disable-shared"
32 ;;
95654431 33python-bindings)
275b59d2
JRJ
34 echo "Build with python bindings"
35 # We only support bindings built with Python 3
36 export PYTHON="python3"
37 export PYTHON_CONFIG="/usr/bin/python3-config"
38 CONF_OPTS="--enable-python-bindings"
39 ;;
40*)
41 echo "Standard build"
42 CONF_OPTS=""
43 ;;
44esac
45
aad6ac90
JR
46# Build type
47# oot : out-of-tree build
48# dist: build via make dist
49# * : normal tree build
50#
51# Make sure to move to the build_path and configure
52# before continuing
275b59d2 53
aad6ac90 54BUILD_PATH=$WORKSPACE
28c11f27
JR
55TEST_PLAN_PATH=$WORKSPACE
56
aad6ac90
JR
57case "$build" in
58 oot)
59 echo "Out of tree build"
60 BUILD_PATH=$WORKSPACE/oot
61 mkdir -p $BUILD_PATH
62 cd $BUILD_PATH
63 $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
64 ;;
65 dist)
66 echo "Distribution out of tree build"
67 BUILD_PATH=`mktemp -d`
68
69 # Initial configure and generate tarball
70 ./configure
71 make dist
72
73 mkdir -p $BUILD_PATH
74 cp *.tar.* $BUILD_PATH/
75 cd $BUILD_PATH
76
77 # Ignore level 1 of tar
78 tar xvf *.tar.* --strip 1
79
80 $BUILD_PATH/configure --prefix=$PREFIX $CONF_OPTS
28c11f27
JR
81
82 # Set test plan to dist tar
83 TEST_PLAN_PATH=$BUILD_PATH
aad6ac90
JR
84 ;;
85 *)
aad6ac90
JR
86 echo "Standard tree build"
87 $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
88 ;;
89esac
90
d05d558c 91make
275b59d2
JRJ
92make install
93
94rm -rf $WORKSPACE/tap
95mkdir -p $WORKSPACE/tap
96
aad6ac90 97cd $BUILD_PATH/tests
275b59d2
JRJ
98
99# Run make check tests
28c11f27
JR
100if [ -e $TEST_PLAN_PATH/tests/tests ]; then
101 prove --merge --exec '' - < $TEST_PLAN_PATH/tests/tests --archive $WORKSPACE/tap/ || true
dfce032b
JR
102else
103 echo "Missing test plan"
104 exit 1
105fi
275b59d2
JRJ
106
107# TAP plugin is having a hard time with .yml files.
108rm -f $WORKSPACE/tap/meta.yml
109
110# And also with files without extension, so rename all result to *.tap
111find $WORKSPACE/tap/ -type f -exec mv {} {}.tap \;
112
113make clean
114
115# Cleanup rpath and libtool .la files
116find $WORKSPACE/build/bin -executable -type f -exec chrpath --delete {} \;
117find $WORKSPACE/build/lib -name "*.so" -exec chrpath --delete {} \;
118find $WORKSPACE/build/lib -name "*.la" -exec rm -f {} \;
aad6ac90
JR
119
120if [ $build = "dist" ]; then
121 rm -rf $BUILD_PATH
122fi
This page took 0.029782 seconds and 4 git commands to generate.