3 # Copyright (C) 2015 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
4 # 2016-2019 Michael Jeanson <mjeanson@efficios.com>
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # Version compare functions
22 if [[ "$1" == "$2" ]]; then
26 local i ver1
=($1) ver2
=($2)
27 # fill empty fields in ver1 with zeros
28 for ((i
=${#ver1[@]}; i
<${#ver2[@]}; i
++)); do
31 for ((i
=0; i
<${#ver1[@]}; i
++)); do
32 if [[ -z ${ver2[i]} ]]; then
33 # fill empty fields in ver2 with zeros
36 if ((10#${ver1[i]} > 10#${ver2[i]})); then
39 if ((10#${ver1[i]} < 10#${ver2[i]})); then
48 vercomp
"$1" "$2"; local res
="$?"
49 [ "$res" -eq "0" ] ||
[ "$res" -eq "2" ]
53 vercomp
"$1" "$2"; local res
="$?"
58 vercomp
"$1" "$2"; local res
="$?"
59 [ "$res" -eq "0" ] ||
[ "$res" -eq "1" ]
63 vercomp
"$1" "$2"; local res
="$?"
68 vercomp
"$1" "$2"; local res
="$?"
73 WORKSPACE
=${WORKSPACE:-}
81 DEPS_INC
="$WORKSPACE/deps/build/include"
82 DEPS_LIB
="$WORKSPACE/deps/build/lib"
83 #DEPS_BIN="$WORKSPACE/deps/build/bin"
84 #DEPS_JAVA="$WORKSPACE/deps/build/share/java"
86 export LD_LIBRARY_PATH
="$DEPS_LIB:${LD_LIBRARY_PATH:-}"
87 export CPPFLAGS
="-I$DEPS_INC"
88 export LDFLAGS
="-L$DEPS_LIB"
90 SRCDIR
="$WORKSPACE/src/lttng-ust"
91 TMPDIR
="$WORKSPACE/tmp"
94 # Create tmp directory
99 export CFLAGS
="-g -O2"
101 # Set compiler variables
133 export CXX
=clang
++-3.9
137 export CXX
=clang
++-4.0
141 export CXX
=clang
++-5.0
145 export CXX
=clang
++-6.0
152 if [ "x$cc" != "x" ]; then
158 if [ "x${CC:-}" != "x" ]; then
159 echo "Selected compiler:"
163 # Set platform variables
169 export PYTHON
="python3"
170 export PYTHON_CONFIG
="python3-config"
174 # Enter the source directory
177 # Run bootstrap in the source directory prior to configure
180 # Get source version from configure script
181 eval "$(grep '^PACKAGE_VERSION=' ./configure)"
182 PACKAGE_VERSION
=${PACKAGE_VERSION//\-pre*/}
184 # Set configure options and environment variables for each build
186 CONF_OPTS
=("--prefix=$PREFIX")
189 echo "Static lib only configuration"
191 CONF_OPTS
+=("--enable-static" "--disable-shared")
193 # Unsupported! liblttng-ust can't pull in it's static (.a) dependencies.
198 echo "Java and Python agents configuration"
200 export CLASSPATH
='/usr/share/java/*'
201 CONF_OPTS
+=("--enable-java-agent-all" "--enable-jni-interface" "--enable-python-agent")
205 echo "Enable RCU sanity checks for debugging"
206 export CPPFLAGS
="${CPPFLAGS} -DDEBUG_RCU"
210 echo "Standard configuration"
215 # oot : out-of-tree build
216 # dist : build via make dist
217 # oot-dist: build via make dist out-of-tree
218 # * : normal tree build
220 # Make sure to move to the build directory and run configure
224 echo "Out of tree build"
226 # Create and enter a temporary build directory
227 builddir
=$
(mktemp
-d)
230 "$SRCDIR/configure" "${CONF_OPTS[@]}"
234 echo "Distribution in-tree build"
236 # Run configure and generate the tar file
237 # in the source directory
241 # Create and enter a temporary build directory
242 builddir
=$
(mktemp
-d)
245 # Extract the distribution tar in the build directory,
246 # ignore the first directory level
247 $TAR xvf
"$SRCDIR"/*.
tar.
* --strip 1
249 # Build in extracted source tree
250 .
/configure
"${CONF_OPTS[@]}"
254 echo "Distribution out of tree build"
256 # Create and enter a temporary build directory
257 builddir
=$
(mktemp
-d)
260 # Run configure out of tree and generate the tar file
264 dist_srcdir
="$(mktemp -d)"
267 # Extract the distribution tar in the new source directory,
268 # ignore the first directory level
269 $TAR xvf
"$builddir"/*.
tar.
* --strip 1
271 # Create and enter a second temporary build directory
272 builddir
="$(mktemp -d)"
275 # Run configure from the extracted distribution tar,
276 # out of the source tree
277 "$dist_srcdir/configure" "${CONF_OPTS[@]}"
281 echo "Standard in-tree build"
282 .
/configure
"${CONF_OPTS[@]}"
286 # We are now inside a configured build directory
289 $MAKE -j "$($NPROC)" V
=1
291 # Install in the workspace
292 $MAKE install DESTDIR
="$WORKSPACE"
294 # Run tests, don't fail now, we want to run the archiving steps
296 $MAKE --keep-going check || failed_tests
=1
298 # Copy tap logs for the jenkins tap parser before cleaning the build dir
299 rsync
-a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests
/ "$WORKSPACE/tap"
301 # The test suite prior to 2.8 did not produce TAP logs
302 if verlt
"$PACKAGE_VERSION" "2.8"; then
303 mkdir
-p "$WORKSPACE/tap/no-log"
304 echo "1..1" > "$WORKSPACE/tap/no-log/tests.log"
305 echo "ok 1 - Test suite doesn't support logging" >> "$WORKSPACE/tap/no-log/tests.log"
308 # Clean the build directory
311 # Cleanup rpath in executables and shared libraries
312 #find "$WORKSPACE/$PREFIX/bin" -type f -perm -0500 -exec chrpath --delete {} \;
313 find "$WORKSPACE/$PREFIX/lib" -name "*.so" -exec chrpath
--delete {} \
;
315 # Remove libtool .la files
316 find "$WORKSPACE/$PREFIX/lib" -name "*.la" -exec rm -f {} \
;
318 # Exit with failure if any of the tests failed
This page took 0.039255 seconds and 4 git commands to generate.