Update lttng-analyses jobs
[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
87e41bca
MJ
28case "$arch" in
29solaris10)
30 MAKE=gmake
31 TAR=gtar
32 NPROC=gnproc
33 BISON=bison
34 YACC="$BISON -y"
35 ;;
36solaris11)
37 MAKE=gmake
38 TAR=gtar
39 NPROC=nproc
40 BISON="/opt/csw/bin/bison"
41 YACC="$BISON -y"
42 export PATH="$PATH:/usr/perl5/bin"
43 ;;
44*)
45 MAKE=make
46 TAR=tar
47 NPROC=nproc
48 BISON=bison
49 YACC="$BISON -y"
50 ;;
51esac
52
275b59d2
JRJ
53case "$conf" in
54static)
55 echo "Static build"
56 CONF_OPTS="--enable-static --disable-shared"
57 ;;
95654431 58python-bindings)
275b59d2
JRJ
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 ;;
65*)
66 echo "Standard build"
67 CONF_OPTS=""
68 ;;
69esac
70
aad6ac90
JR
71# Build type
72# oot : out-of-tree build
73# dist: build via make dist
74# * : normal tree build
75#
76# Make sure to move to the build_path and configure
77# before continuing
275b59d2 78
aad6ac90 79BUILD_PATH=$WORKSPACE
28c11f27
JR
80TEST_PLAN_PATH=$WORKSPACE
81
aad6ac90
JR
82case "$build" in
83 oot)
84 echo "Out of tree build"
85 BUILD_PATH=$WORKSPACE/oot
86 mkdir -p $BUILD_PATH
87 cd $BUILD_PATH
87e41bca 88 MAKE=$MAKE BISON="$BISON" YACC="$YACC" $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
aad6ac90
JR
89 ;;
90 dist)
91 echo "Distribution out of tree build"
92 BUILD_PATH=`mktemp -d`
93
94 # Initial configure and generate tarball
87e41bca
MJ
95 MAKE=$MAKE BISON="$BISON" YACC="$YACC" ./configure
96 $MAKE dist
aad6ac90
JR
97
98 mkdir -p $BUILD_PATH
99 cp *.tar.* $BUILD_PATH/
100 cd $BUILD_PATH
101
102 # Ignore level 1 of tar
87e41bca 103 $TAR xvf *.tar.* --strip 1
aad6ac90 104
87e41bca 105 MAKE=$MAKE BISON="$BISON" YACC="$YACC" $BUILD_PATH/configure --prefix=$PREFIX $CONF_OPTS
28c11f27
JR
106
107 # Set test plan to dist tar
108 TEST_PLAN_PATH=$BUILD_PATH
aad6ac90
JR
109 ;;
110 *)
aad6ac90 111 echo "Standard tree build"
87e41bca 112 MAKE=$MAKE BISON="$BISON" YACC="$YACC" $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
aad6ac90
JR
113 ;;
114esac
115
87e41bca
MJ
116$MAKE -j `$NPROC`
117$MAKE install
118$MAKE check
119$MAKE clean
275b59d2
JRJ
120
121# Cleanup rpath and libtool .la files
87e41bca 122#find $WORKSPACE/build/bin -executable -type f -exec chrpath --delete {} \;
275b59d2
JRJ
123find $WORKSPACE/build/lib -name "*.so" -exec chrpath --delete {} \;
124find $WORKSPACE/build/lib -name "*.la" -exec rm -f {} \;
aad6ac90
JR
125
126if [ $build = "dist" ]; then
87e41bca
MJ
127 cd $WORKSPACE
128 rm -rf $BUILD_PATH
aad6ac90 129fi
87e41bca
MJ
130
131# EOF
This page took 0.027906 seconds and 4 git commands to generate.