Commit | Line | Data |
---|---|---|
c56b9301 | 1 | #!/bin/bash -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 | ||
c56b9301 | 18 | |
275b59d2 JRJ |
19 | # Create build directory |
20 | rm -rf $WORKSPACE/build | |
21 | mkdir -p $WORKSPACE/build | |
22 | ||
23 | PREFIX="$WORKSPACE/build" | |
24 | ||
c56b9301 | 25 | # Set platform variables |
87e41bca MJ |
26 | case "$arch" in |
27 | solaris10) | |
28 | MAKE=gmake | |
29 | TAR=gtar | |
30 | NPROC=gnproc | |
31 | BISON=bison | |
32 | YACC="$BISON -y" | |
33 | ;; | |
34 | solaris11) | |
35 | MAKE=gmake | |
36 | TAR=gtar | |
37 | NPROC=nproc | |
38 | BISON="/opt/csw/bin/bison" | |
39 | YACC="$BISON -y" | |
40 | export PATH="$PATH:/usr/perl5/bin" | |
41 | ;; | |
42 | *) | |
43 | MAKE=make | |
44 | TAR=tar | |
45 | NPROC=nproc | |
46 | BISON=bison | |
47 | YACC="$BISON -y" | |
48 | ;; | |
49 | esac | |
50 | ||
c56b9301 MJ |
51 | # Set configure options for each build configuration |
52 | CONF_OPTS="" | |
275b59d2 JRJ |
53 | case "$conf" in |
54 | static) | |
55 | echo "Static build" | |
56 | CONF_OPTS="--enable-static --disable-shared" | |
57 | ;; | |
95654431 | 58 | python-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 | ;; | |
69 | esac | |
70 | ||
c56b9301 MJ |
71 | |
72 | # Run bootstrap prior to configure | |
73 | ./bootstrap | |
74 | ||
75 | ||
aad6ac90 JR |
76 | # Build type |
77 | # oot : out-of-tree build | |
78 | # dist: build via make dist | |
79 | # * : normal tree build | |
80 | # | |
81 | # Make sure to move to the build_path and configure | |
82 | # before continuing | |
aad6ac90 | 83 | BUILD_PATH=$WORKSPACE |
28c11f27 | 84 | TEST_PLAN_PATH=$WORKSPACE |
aad6ac90 | 85 | case "$build" in |
c56b9301 MJ |
86 | oot) |
87 | echo "Out of tree build" | |
88 | BUILD_PATH=$WORKSPACE/oot | |
89 | mkdir -p $BUILD_PATH | |
90 | cd $BUILD_PATH | |
91 | MAKE=$MAKE BISON="$BISON" YACC="$YACC" $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS | |
92 | ;; | |
93 | ||
94 | dist) | |
95 | echo "Distribution out of tree build" | |
96 | BUILD_PATH=`mktemp -d` | |
97 | ||
98 | # Initial configure and generate tarball | |
99 | MAKE=$MAKE BISON="$BISON" YACC="$YACC" ./configure | |
100 | $MAKE dist | |
101 | ||
102 | mkdir -p $BUILD_PATH | |
103 | cp *.tar.* $BUILD_PATH/ | |
104 | cd $BUILD_PATH | |
105 | ||
106 | # Ignore level 1 of tar | |
107 | $TAR xvf *.tar.* --strip 1 | |
108 | ||
109 | MAKE=$MAKE BISON="$BISON" YACC="$YACC" $BUILD_PATH/configure --prefix=$PREFIX $CONF_OPTS | |
110 | ||
111 | # Set test plan to dist tar | |
112 | TEST_PLAN_PATH=$BUILD_PATH | |
113 | ;; | |
114 | ||
115 | *) | |
116 | echo "Standard tree build" | |
117 | MAKE=$MAKE BISON="$BISON" YACC="$YACC" $WORKSPACE/configure --prefix=$PREFIX $CONF_OPTS | |
118 | ;; | |
aad6ac90 JR |
119 | esac |
120 | ||
c56b9301 | 121 | # BUILD! |
87e41bca MJ |
122 | $MAKE -j `$NPROC` |
123 | $MAKE install | |
c56b9301 MJ |
124 | |
125 | # Run tests | |
87e41bca | 126 | $MAKE check |
c56b9301 MJ |
127 | |
128 | # Cleanup | |
87e41bca | 129 | $MAKE clean |
275b59d2 | 130 | |
c56b9301 MJ |
131 | # Cleanup rpath in executables and shared libraries |
132 | find $WORKSPACE/build/bin -type f -perm -0500 -exec chrpath --delete {} \; | |
275b59d2 | 133 | find $WORKSPACE/build/lib -name "*.so" -exec chrpath --delete {} \; |
c56b9301 MJ |
134 | |
135 | # Remove libtool .la files | |
275b59d2 | 136 | find $WORKSPACE/build/lib -name "*.la" -exec rm -f {} \; |
aad6ac90 | 137 | |
c56b9301 MJ |
138 | # Clean temp dir for dist build |
139 | if [ "$build" = "dist" ]; then | |
87e41bca MJ |
140 | cd $WORKSPACE |
141 | rm -rf $BUILD_PATH | |
aad6ac90 | 142 | fi |
87e41bca MJ |
143 | |
144 | # EOF |