f69d01880bc42860daef99ae45e8ddd14c4d9e5f
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/>.
21 # Version compare functions
24 if [[ "$1" == "$2" ]]; then
28 # Ignore the shellcheck warning, we want splitting to happen based on IFS.
29 # shellcheck disable=SC2206
30 local i ver1
=($1) ver2
=($2)
31 # fill empty fields in ver1 with zeros
32 for ((i
=${#ver1[@]}; i
<${#ver2[@]}; i
++)); do
35 for ((i
=0; i
<${#ver1[@]}; i
++)); do
36 if [[ -z ${ver2[i]} ]]; then
37 # fill empty fields in ver2 with zeros
40 if ((10#${ver1[i]} > 10#${ver2[i]})); then
43 if ((10#${ver1[i]} < 10#${ver2[i]})); then
52 vercomp
"$1" "$2"; local res
="$?"
53 [ "$res" -eq "0" ] ||
[ "$res" -eq "2" ]
57 vercomp
"$1" "$2"; local res
="$?"
62 vercomp
"$1" "$2"; local res
="$?"
63 [ "$res" -eq "0" ] ||
[ "$res" -eq "1" ]
67 vercomp
"$1" "$2"; local res
="$?"
72 vercomp
"$1" "$2"; local res
="$?"
77 # Assume we are in the configured build directory
78 echo "#################### BEGIN config.log ####################"
80 echo "#################### END config.log ####################"
82 # End the build with failure
87 WORKSPACE
=${WORKSPACE:-}
89 platform
=${platform:-}
94 # Controls if the tests are run
95 LTTNG_UST_RUN_TESTS
="${LTTNG_UST_RUN_TESTS:=yes}"
97 SRCDIR
="$WORKSPACE/src/lttng-ust"
98 TMPDIR
="$WORKSPACE/tmp"
102 # RHEL and SLES both use lib64 but don't bother shipping a default autoconf
103 # site config that matches this.
104 if [[ ( -f /etc
/redhat-release ||
-f /etc
/SuSE-release
) && ( "$(uname -m)" == "x86_64" ) ]]; then
105 LIBDIR_ARCH
="${LIBDIR}64"
107 LIBDIR_ARCH
="$LIBDIR"
110 DEPS_INC
="$WORKSPACE/deps/build/include"
111 DEPS_LIB
="$WORKSPACE/deps/build/$LIBDIR_ARCH"
112 DEPS_PKGCONFIG
="$DEPS_LIB/pkgconfig"
113 #DEPS_BIN="$WORKSPACE/deps/build/bin"
114 #DEPS_JAVA="$WORKSPACE/deps/build/share/java"
116 export LD_LIBRARY_PATH
="$DEPS_LIB:${LD_LIBRARY_PATH:-}"
117 export PKG_CONFIG_PATH
="$DEPS_PKGCONFIG"
118 export CPPFLAGS
="-I$DEPS_INC"
119 export LDFLAGS
="-L$DEPS_LIB"
121 # Create tmp directory
126 export CFLAGS
="-g -O2"
128 # Set compiler variables
135 export CC
=gcc-
${cc#gcc-}
136 export CXX
=g
++-${cc#gcc-}
143 export CC
=clang-
${cc#clang-}
144 export CXX
=clang
++-${cc#clang-}
147 if [ "x$cc" != "x" ]; then
153 if [ "x${CC:-}" != "x" ]; then
154 echo "Selected compiler:"
158 # Set platform variables
163 export NPROC
="getconf _NPROCESSORS_ONLN"
164 export CPPFLAGS
="-I/usr/local/include $CPPFLAGS"
165 export LDFLAGS
="-L/usr/local/lib $LDFLAGS"
166 export PYTHON
="python3"
167 export PYTHON_CONFIG
="python3-config"
168 export CLASSPATH
='/usr/local/share/java/classes/*'
169 export JAVA_HOME
='/usr/local/openjdk11'
176 export PYTHON
="python3"
177 export PYTHON_CONFIG
="python3-config"
178 export CLASSPATH
='/usr/share/java/log4j-api.jar:/usr/share/java/log4j-core.jar:/usr/share/java/log4j-1.2.jar'
182 # Print build env details
184 print_tooling || true
186 # Enter the source directory
189 # Run bootstrap in the source directory prior to configure
192 # Get source version from configure script
193 eval "$(grep '^PACKAGE_VERSION=' ./configure)"
194 PACKAGE_VERSION
=${PACKAGE_VERSION//\-pre*/}
196 # Gerrit will trigger build on FreeBSD regardless of the branch, exit
197 # successfuly when the version is < 2.13.
198 if [[ $platform == freebsd
* ]] && verlt
"$PACKAGE_VERSION" "2.13"; then
199 mkdir
-p "$WORKSPACE/tap/no-log"
200 echo "1..1" > "$WORKSPACE/tap/no-log/tests.log"
201 echo "ok 1 - FreeBSD build unsupported in < 2.13" >> "$WORKSPACE/tap/no-log/tests.log"
205 # Set configure options and environment variables for each build
207 CONF_OPTS
=("--prefix=$PREFIX" "--libdir=$PREFIX/$LIBDIR_ARCH")
210 echo "Static lib only configuration"
212 CONF_OPTS
+=("--enable-static" "--disable-shared")
214 # Unsupported! liblttng-ust can't pull in it's static (.a) dependencies.
219 echo "Java and Python agents configuration"
221 CONF_OPTS
+=("--enable-java-agent-all" "--enable-jni-interface" "--enable-python-agent")
223 # Explicitly add '--enable-java-agent-log4j2', it's not part of '-all' in stable 2.12/2.13
224 if verlt
"$PACKAGE_VERSION" "2.14"; then
225 CONF_OPTS
+=("--enable-java-agent-log4j2")
230 echo "Enable RCU sanity checks for debugging"
231 export CPPFLAGS
="${CPPFLAGS} -DDEBUG_RCU"
235 echo "Standard configuration"
240 # oot : out-of-tree build
241 # dist : build via make dist
242 # oot-dist: build via make dist out-of-tree
243 # * : normal tree build
245 # Make sure to move to the build directory and run configure
249 echo "Out of tree build"
251 # Create and enter a temporary build directory
252 builddir
=$
(mktemp
-d)
255 "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
259 echo "Distribution in-tree build"
261 # Run configure and generate the tar file
262 # in the source directory
263 .
/configure
--enable-jni-interface || failed_configure
266 # Create and enter a temporary build directory
267 builddir
=$
(mktemp
-d)
270 # Extract the distribution tar in the build directory,
271 # ignore the first directory level
272 $TAR xvf
"$SRCDIR"/*.
tar.
* --strip 1
274 # Build in extracted source tree
275 .
/configure
"${CONF_OPTS[@]}" || failed_configure
279 echo "Distribution out of tree build"
281 # Create and enter a temporary build directory
282 builddir
=$
(mktemp
-d)
285 # Run configure out of tree and generate the tar file
286 "$SRCDIR/configure" --enable-jni-interface || failed_configure
289 dist_srcdir
="$(mktemp -d)"
292 # Extract the distribution tar in the new source directory,
293 # ignore the first directory level
294 $TAR xvf
"$builddir"/*.
tar.
* --strip 1
296 # Create and enter a second temporary build directory
297 builddir
="$(mktemp -d)"
300 # Run configure from the extracted distribution tar,
301 # out of the source tree
302 "$dist_srcdir/configure" "${CONF_OPTS[@]}" || failed_configure
306 echo "Standard in-tree build"
307 .
/configure
"${CONF_OPTS[@]}" || failed_configure
311 # We are now inside a configured build directory
314 $MAKE -j "$($NPROC)" V
=1
316 # Install in the workspace
317 $MAKE install DESTDIR
="$WORKSPACE"
319 # Run tests, don't fail now, we want to run the archiving steps
321 if [ "$LTTNG_UST_RUN_TESTS" = "yes" ]; then
322 $MAKE --keep-going check || failed_tests
=1
324 # Copy tap logs for the jenkins tap parser before cleaning the build dir
325 rsync
-a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests
/ "$WORKSPACE/tap"
327 # The test suite prior to 2.8 did not produce TAP logs
328 if verlt
"$PACKAGE_VERSION" "2.8"; then
329 mkdir
-p "$WORKSPACE/tap/no-log"
330 echo "1..1" > "$WORKSPACE/tap/no-log/tests.log"
331 echo "ok 1 - Test suite doesn't support logging" >> "$WORKSPACE/tap/no-log/tests.log"
335 # Clean the build directory
338 # Cleanup rpath in executables and shared libraries
339 #find "$WORKSPACE/$PREFIX/bin" -type f -perm -0500 -exec chrpath --delete {} \;
340 find "$WORKSPACE/$PREFIX/$LIBDIR_ARCH" -name "*.so" -exec chrpath
--delete {} \
;
342 # Remove libtool .la files
343 find "$WORKSPACE/$PREFIX/$LIBDIR_ARCH" -name "*.la" -exec rm -f {} \
;
345 # Exit with failure if any of the tests failed
This page took 0.045008 seconds and 4 git commands to generate.