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