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_PKGCONFIG
="$DEPS_LIB/pkgconfig"
84 #DEPS_BIN="$WORKSPACE/deps/build/bin"
85 #DEPS_JAVA="$WORKSPACE/deps/build/share/java"
87 export LD_LIBRARY_PATH
="$DEPS_LIB:${LD_LIBRARY_PATH:-}"
88 export PKG_CONFIG_PATH
="$DEPS_PKGCONFIG"
89 export CPPFLAGS
="-I$DEPS_INC"
90 export LDFLAGS
="-L$DEPS_LIB"
92 SRCDIR
="$WORKSPACE/src/lttng-ust"
93 TMPDIR
="$WORKSPACE/tmp"
96 # Create tmp directory
101 export CFLAGS
="-g -O2"
103 # Set compiler variables
135 export CXX
=clang
++-3.9
139 export CXX
=clang
++-4.0
143 export CXX
=clang
++-5.0
147 export CXX
=clang
++-6.0
154 if [ "x$cc" != "x" ]; then
160 if [ "x${CC:-}" != "x" ]; then
161 echo "Selected compiler:"
165 # Set platform variables
171 export PYTHON
="python3"
172 export PYTHON_CONFIG
="python3-config"
176 # Enter the source directory
179 # Run bootstrap in the source directory prior to configure
182 # Get source version from configure script
183 eval "$(grep '^PACKAGE_VERSION=' ./configure)"
184 PACKAGE_VERSION
=${PACKAGE_VERSION//\-pre*/}
186 # Set configure options and environment variables for each build
188 CONF_OPTS
=("--prefix=$PREFIX")
191 echo "Static lib only configuration"
193 CONF_OPTS
+=("--enable-static" "--disable-shared")
195 # Unsupported! liblttng-ust can't pull in it's static (.a) dependencies.
200 echo "Java and Python agents configuration"
202 export CLASSPATH
='/usr/share/java/*'
203 CONF_OPTS
+=("--enable-java-agent-all" "--enable-jni-interface" "--enable-python-agent")
207 echo "Enable RCU sanity checks for debugging"
208 export CPPFLAGS
="${CPPFLAGS} -DDEBUG_RCU"
212 echo "Standard configuration"
217 # oot : out-of-tree build
218 # dist : build via make dist
219 # oot-dist: build via make dist out-of-tree
220 # * : normal tree build
222 # Make sure to move to the build directory and run configure
226 echo "Out of tree build"
228 # Create and enter a temporary build directory
229 builddir
=$
(mktemp
-d)
232 "$SRCDIR/configure" "${CONF_OPTS[@]}"
236 echo "Distribution in-tree build"
238 # Run configure and generate the tar file
239 # in the source directory
243 # Create and enter a temporary build directory
244 builddir
=$
(mktemp
-d)
247 # Extract the distribution tar in the build directory,
248 # ignore the first directory level
249 $TAR xvf
"$SRCDIR"/*.
tar.
* --strip 1
251 # Build in extracted source tree
252 .
/configure
"${CONF_OPTS[@]}"
256 echo "Distribution out of tree build"
258 # Create and enter a temporary build directory
259 builddir
=$
(mktemp
-d)
262 # Run configure out of tree and generate the tar file
266 dist_srcdir
="$(mktemp -d)"
269 # Extract the distribution tar in the new source directory,
270 # ignore the first directory level
271 $TAR xvf
"$builddir"/*.
tar.
* --strip 1
273 # Create and enter a second temporary build directory
274 builddir
="$(mktemp -d)"
277 # Run configure from the extracted distribution tar,
278 # out of the source tree
279 "$dist_srcdir/configure" "${CONF_OPTS[@]}"
283 echo "Standard in-tree build"
284 .
/configure
"${CONF_OPTS[@]}"
288 # We are now inside a configured build directory
291 $MAKE -j "$($NPROC)" V
=1
293 # Install in the workspace
294 $MAKE install DESTDIR
="$WORKSPACE"
296 # Run tests, don't fail now, we want to run the archiving steps
298 $MAKE --keep-going check || failed_tests
=1
300 # Copy tap logs for the jenkins tap parser before cleaning the build dir
301 rsync
-a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests
/ "$WORKSPACE/tap"
303 # The test suite prior to 2.8 did not produce TAP logs
304 if verlt
"$PACKAGE_VERSION" "2.8"; then
305 mkdir
-p "$WORKSPACE/tap/no-log"
306 echo "1..1" > "$WORKSPACE/tap/no-log/tests.log"
307 echo "ok 1 - Test suite doesn't support logging" >> "$WORKSPACE/tap/no-log/tests.log"
310 # Clean the build directory
313 # Cleanup rpath in executables and shared libraries
314 #find "$WORKSPACE/$PREFIX/bin" -type f -perm -0500 -exec chrpath --delete {} \;
315 find "$WORKSPACE/$PREFIX/lib" -name "*.so" -exec chrpath
--delete {} \
;
317 # Remove libtool .la files
318 find "$WORKSPACE/$PREFIX/lib" -name "*.la" -exec rm -f {} \
;
320 # Exit with failure if any of the tests failed
This page took 0.036937 seconds and 5 git commands to generate.