Add arm64 to babeltrace and normalize build script
[lttng-ci.git] / scripts / liburcu / build.sh
CommitLineData
f12f1d66 1#!/bin/sh -exu
e3022ad9
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
18
56162e2a
JRJ
19# Create build directory
20rm -rf $WORKSPACE/build
21mkdir -p $WORKSPACE/build
22
23PREFIX="$WORKSPACE/build"
24
25./bootstrap
26
27CONF_OPTS=""
28
7491c28d
MJ
29case "$arch" in
30solaris10)
31 MAKE=gmake
32 TAR=gtar
33 NPROC=gnproc
34 CFLAGS="-D_XOPEN_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__=1"
35 ;;
36solaris11)
37 MAKE=gmake
38 TAR=gtar
39 NPROC=nproc
40 CFLAGS="-D_XOPEN_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__=1"
41 export PATH="$PATH:/usr/perl5/bin"
42 ;;
43*)
44 MAKE=make
45 TAR=tar
46 NPROC=nproc
47 CFLAGS=""
48 ;;
49esac
50
56162e2a
JRJ
51case "$conf" in
52static)
53 echo "Static build"
54 CONF_OPTS="--enable-static --disable-shared"
55 ;;
56tls_fallback)
57 echo "Using pthread_getspecific() to emulate TLS"
58 CONF_OPTS="--disable-compiler-tls"
59 ;;
60*)
61 echo "Standard build"
62 CONF_OPTS=""
63 ;;
64esac
65
595a34c7
JR
66# Build type
67# oot : out-of-tree build
68# dist: build via make dist
69# * : normal tree build
70#
71# Make sure to move to the build_path and configure
72# before continuing
56162e2a 73
595a34c7
JR
74BUILD_PATH=$WORKSPACE
75case "$build" in
76 oot)
77 echo "Out of tree build"
78 BUILD_PATH=$WORKSPACE/oot
79 mkdir -p $BUILD_PATH
8a804acc 80 cd $BUILD_PATH
7491c28d 81 MAKE=$MAKE CFLAGS="$CFLAGS" $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
595a34c7
JR
82 ;;
83 dist)
84 echo "Distribution out of tree build"
85 BUILD_PATH=`mktemp -d`
86
87 # Initial configure and generate tarball
7491c28d
MJ
88 MAKE=$MAKE ./configure
89 $MAKE dist
595a34c7
JR
90
91 mkdir -p $BUILD_PATH
92 cp *.tar.* $BUILD_PATH/
93 cd $BUILD_PATH
94
95 # Ignore level 1 of tar
7491c28d 96 $TAR xvf *.tar.* --strip 1
595a34c7 97
7491c28d 98 MAKE=$MAKE CFLAGS="$CFLAGS" $BUILD_PATH/configure --prefix=$PREFIX $CONF_OPTS
595a34c7
JR
99 ;;
100 *)
595a34c7 101 BUILD_PATH=$WORKSPACE
8a804acc 102 echo "Standard tree build"
7491c28d 103 MAKE=$MAKE CFLAGS="$CFLAGS" $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS
8a804acc 104 ;;
595a34c7
JR
105esac
106
7491c28d
MJ
107$MAKE -j `$NPROC`
108$MAKE install
109$MAKE check
110$MAKE regtest
111$MAKE clean
56162e2a
JRJ
112
113# Cleanup rpath and libtool .la files
114find $WORKSPACE/build/lib -name "*.so" -exec chrpath --delete {} \;
115find $WORKSPACE/build/lib -name "*.la" -exec rm -f {} \;
595a34c7 116
cdcf7df4 117# Cleanup temp directory of dist build
4f686830 118if [ $build = "dist" ]; then
7491c28d 119 cd $WORKSPACE
595a34c7
JR
120 rm -rf $BUILD_PATH
121fi
7491c28d
MJ
122
123# EOF
This page took 0.03862 seconds and 4 git commands to generate.