Make scripts executable
[lttng-ci.git] / scripts / lttng-ust / build.sh
CommitLineData
2b68721a
MJ
1#!/bin/sh -exu
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
18
c3bc676b
JRJ
19# Create build directory
20rm -rf $WORKSPACE/build
21mkdir -p $WORKSPACE/build
22
23# liburcu
2b68721a
MJ
24URCU_INCS="$WORKSPACE/deps/liburcu/build/include/"
25URCU_LIBS="$WORKSPACE/deps/liburcu/build/lib/"
c3bc676b
JRJ
26
27export CPPFLAGS="-I$URCU_INCS"
28export LDFLAGS="-L$URCU_LIBS"
2b68721a 29export LD_LIBRARY_PATH="$URCU_LIBS:${LD_LIBRARY_PATH:-}"
c3bc676b
JRJ
30
31PREFIX="$WORKSPACE/build"
32
33./bootstrap
34
35CONF_OPTS=""
36
37case "$conf" in
38# Unsupported! liblttng-ust can't pull in it's static (.a) dependencies.
39#static)
40# echo "Static build"
41# CONF_OPTS="--enable-static --disable-shared"
42# ;;
43java-agent)
44 echo "Java agent build"
45 export CLASSPATH="/usr/share/java/log4j-1.2.jar"
46 CONF_OPTS="--enable-java-agent-all"
47 ;;
2b68721a
MJ
48python-agent)
49 echo "Python agent build"
50 CONF_OPTS="--enable-python-agent"
51 ;;
c3bc676b
JRJ
52*)
53 echo "Standard build"
54 CONF_OPTS=""
55 ;;
56esac
57
2b68721a
MJ
58# Build type
59# oot : out-of-tree build
60# dist: build via make dist
61# * : normal tree build
62#
63# Make sure to move to the build_path and configure
64# before continuing
65
66BUILD_PATH=$WORKSPACE
67case "$build" in
68 oot)
69 echo "Out of tree build"
70 BUILD_PATH=$WORKSPACE/oot
71 mkdir -p $BUILD_PATH
72 cd $BUILD_PATH
73 $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
74 ;;
75 dist)
76 echo "Distribution out of tree build"
77 BUILD_PATH=`mktemp -d`
78
79 # Initial configure and generate tarball
80 ./configure
81 make dist
82
83 mkdir -p $BUILD_PATH
84 cp *.tar.* $BUILD_PATH/
85 cd $BUILD_PATH
86
87 # Ignore level 1 of tar
88 tar xvf *.tar.* --strip 1
89
90 $BUILD_PATH/configure --prefix=$PREFIX $CONF_OPTS
91 ;;
92 *)
93 BUILD_PATH=$WORKSPACE
94 echo "Standard tree build"
95 $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
96 ;;
97esac
98
c3bc676b
JRJ
99make V=1
100make install
101
102# Run tests
103rm -rf $WORKSPACE/tap
104mkdir -p $WORKSPACE/tap/unit
105
2b68721a 106cd $BUILD_PATH/tests
c3bc676b 107
2b68721a 108prove --merge --exec '' - < $BUILD_PATH/tests/unit_tests --archive $WORKSPACE/tap/unit/ || true
c3bc676b
JRJ
109
110# TAP plugin is having a hard time with .yml files.
111rm -f $WORKSPACE/tap/unit/meta.yml
112
113# And also with files without extension, so rename all result to *.tap
114find $WORKSPACE/tap/unit/ -type f -exec mv {} {}.tap \;
115
116# Cleanup
117make clean
118
119# Cleanup rpath and libtool .la files
120find $WORKSPACE/build/lib -name "*.so" -exec chrpath --delete {} \;
121find $WORKSPACE/build/lib -name "*.la" -exec rm -f {} \;
2b68721a
MJ
122
123# Clean temp dir for dist build
124if [ $build = "dist" ]; then
125 rm -rf $BUILD_PATH
126fi
This page took 0.028973 seconds and 4 git commands to generate.