Add babeltrace Solaris build jobs
[lttng-ci.git] / scripts / babeltrace / build.sh
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 # Create build directory
19 rm -rf $WORKSPACE/build
20 mkdir -p $WORKSPACE/build
21
22 PREFIX="$WORKSPACE/build"
23
24 ./bootstrap
25
26 CONF_OPTS=""
27
28 case "$arch" in
29 solaris10)
30 MAKE=gmake
31 TAR=gtar
32 NPROC=gnproc
33 BISON=bison
34 YACC="$BISON -y"
35 ;;
36 solaris11)
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 ;;
51 esac
52
53 case "$conf" in
54 static)
55 echo "Static build"
56 CONF_OPTS="--enable-static --disable-shared"
57 ;;
58 python-bindings)
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 ;;
69 esac
70
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
78
79 BUILD_PATH=$WORKSPACE
80 TEST_PLAN_PATH=$WORKSPACE
81
82 case "$build" in
83 oot)
84 echo "Out of tree build"
85 BUILD_PATH=$WORKSPACE/oot
86 mkdir -p $BUILD_PATH
87 cd $BUILD_PATH
88 MAKE=$MAKE BISON="$BISON" YACC="$YACC" $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
89 ;;
90 dist)
91 echo "Distribution out of tree build"
92 BUILD_PATH=`mktemp -d`
93
94 # Initial configure and generate tarball
95 MAKE=$MAKE BISON="$BISON" YACC="$YACC" ./configure
96 $MAKE dist
97
98 mkdir -p $BUILD_PATH
99 cp *.tar.* $BUILD_PATH/
100 cd $BUILD_PATH
101
102 # Ignore level 1 of tar
103 $TAR xvf *.tar.* --strip 1
104
105 MAKE=$MAKE BISON="$BISON" YACC="$YACC" $BUILD_PATH/configure --prefix=$PREFIX $CONF_OPTS
106
107 # Set test plan to dist tar
108 TEST_PLAN_PATH=$BUILD_PATH
109 ;;
110 *)
111 echo "Standard tree build"
112 MAKE=$MAKE BISON="$BISON" YACC="$YACC" $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
113 ;;
114 esac
115
116 $MAKE -j `$NPROC`
117 $MAKE install
118 $MAKE check
119 $MAKE clean
120
121 # Cleanup rpath and libtool .la files
122 #find $WORKSPACE/build/bin -executable -type f -exec chrpath --delete {} \;
123 find $WORKSPACE/build/lib -name "*.so" -exec chrpath --delete {} \;
124 find $WORKSPACE/build/lib -name "*.la" -exec rm -f {} \;
125
126 if [ $build = "dist" ]; then
127 cd $WORKSPACE
128 rm -rf $BUILD_PATH
129 fi
130
131 # EOF
This page took 0.031217 seconds and 4 git commands to generate.