3 # Copyright (C) 2015 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
4 # Copyright (C) 2016-2020 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 local i ver1
=($1) ver2
=($2)
29 # fill empty fields in ver1 with zeros
30 for ((i
=${#ver1[@]}; i
<${#ver2[@]}; i
++)); do
33 for ((i
=0; i
<${#ver1[@]}; i
++)); do
34 if [[ -z ${ver2[i]} ]]; then
35 # fill empty fields in ver2 with zeros
38 if ((10#${ver1[i]} > 10#${ver2[i]})); then
41 if ((10#${ver1[i]} < 10#${ver2[i]})); then
50 vercomp
"$1" "$2"; local res
="$?"
51 [ "$res" -eq "0" ] ||
[ "$res" -eq "2" ]
55 vercomp
"$1" "$2"; local res
="$?"
60 vercomp
"$1" "$2"; local res
="$?"
61 [ "$res" -eq "0" ] ||
[ "$res" -eq "1" ]
65 vercomp
"$1" "$2"; local res
="$?"
70 vercomp
"$1" "$2"; local res
="$?"
75 # Assume we are in the configured build directory
76 echo "#################### BEGIN config.log ####################"
78 echo "#################### END config.log ####################"
80 # End the build with failure
85 WORKSPACE
=${WORKSPACE:-}
92 # Controls if the tests are run
93 USERSPACE_RCU_RUN_TESTS
="${USERSPACE_RCU_RUN_TESTS:=yes}"
95 SRCDIR
="$WORKSPACE/src/liburcu"
96 TMPDIR
="$WORKSPACE/tmp"
99 # Create tmp directory
104 export CFLAGS
="-g -O2"
106 # Set compiler variables
138 export CXX
=clang
++-3.9
142 export CXX
=clang
++-4.0
146 export CXX
=clang
++-5.0
150 export CXX
=clang
++-6.0
157 if [ "x$cc" != "x" ]; then
163 if [ "x${CC:-}" != "x" ]; then
164 echo "Selected compiler:"
168 # Set platform variables
174 export PATH
="/opt/csw/bin:/usr/ccs/bin:$PATH"
175 export CPPFLAGS
="-I/opt/csw/include"
176 export LDFLAGS
="-L/opt/csw/lib -R/opt/csw/lib"
177 export PKG_CONFIG_PATH
="/opt/csw/lib/pkgconfig"
178 export PYTHON
="python3"
179 export PYTHON_CONFIG
="python3-config"
186 export PATH
="/opt/csw/bin:$PATH:/usr/perl5/bin"
187 export LD_ALTEXEC
=/usr
/bin
/gld
188 export LD
=/usr
/bin
/gld
189 export PYTHON
="python3"
190 export PYTHON_CONFIG
="python3-config"
191 export PKG_CONFIG_PATH
="/usr/lib/pkgconfig"
197 export NPROC
="getconf _NPROCESSORS_ONLN"
198 export PATH
="/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
199 export CPPFLAGS
="-I/opt/local/include"
200 export LDFLAGS
="-L/opt/local/lib"
201 export PYTHON
="python3.9"
202 export PYTHON_CONFIG
="python3.9-config"
208 export NPROC
="getconf _NPROCESSORS_ONLN"
209 export CPPFLAGS
="-I/usr/local/include"
210 export LDFLAGS
="-L/usr/local/lib"
211 export PYTHON
="python3"
212 export PYTHON_CONFIG
="python3-config"
219 export PYTHON
="python3"
220 export PYTHON_CONFIG
="python3-config"
224 # Print build env details
226 print_tooling || true
228 # Enter the source directory
231 # Run bootstrap in the source directory prior to configure
234 # Get source version from configure script
235 eval "$(grep '^PACKAGE_VERSION=' ./configure)"
236 PACKAGE_VERSION
=${PACKAGE_VERSION//\-pre*/}
238 # Set configure options and environment variables for each build
240 CONF_OPTS
=("--prefix=$PREFIX")
243 echo "Static lib only configuration"
245 CONF_OPTS
+=("--enable-static" "--disable-shared")
249 echo "Using pthread_getspecific() to emulate TLS"
250 CONF_OPTS
+=("--disable-compiler-tls")
254 echo "Enable RCU sanity checks for debugging"
255 if vergte
"$PACKAGE_VERSION" "0.10"; then
256 CONF_OPTS
+=("--enable-rcu-debug")
258 export CFLAGS
="$CFLAGS -DDEBUG_RCU"
261 echo "Enable iterator sanity validator"
262 if vergte
"$PACKAGE_VERSION" "0.11"; then
263 CONF_OPTS
+=("--enable-cds-lfht-iter-debug")
268 echo "Standard configuration"
273 # oot : out-of-tree build
274 # dist : build via make dist
275 # oot-dist: build via make dist out-of-tree
276 # * : normal tree build
278 # Make sure to move to the build directory and run configure
282 echo "Out of tree build"
284 # Create and enter a temporary build directory
285 builddir
=$
(mktemp
-d)
288 "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
292 echo "Distribution in-tree build"
294 # Run configure and generate the tar file
295 # in the source directory
296 .
/configure || failed_configure
299 # Create and enter a temporary build directory
300 builddir
=$
(mktemp
-d)
303 # Extract the distribution tar in the build directory,
304 # ignore the first directory level
305 $TAR xvf
"$SRCDIR"/*.
tar.
* --strip 1
307 # Build in extracted source tree
308 .
/configure
"${CONF_OPTS[@]}" || failed_configure
312 echo "Distribution out of tree build"
314 # Create and enter a temporary build directory
315 builddir
=$
(mktemp
-d)
318 # Run configure out of tree and generate the tar file
319 "$SRCDIR/configure" || failed_configure
322 dist_srcdir
="$(mktemp -d)"
325 # Extract the distribution tar in the new source directory,
326 # ignore the first directory level
327 $TAR xvf
"$builddir"/*.
tar.
* --strip 1
329 # Create and enter a second temporary build directory
330 builddir
="$(mktemp -d)"
333 # Run configure from the extracted distribution tar,
334 # out of the source tree
335 "$dist_srcdir/configure" "${CONF_OPTS[@]}" || failed_configure
339 echo "Standard in-tree build"
340 .
/configure
"${CONF_OPTS[@]}" || failed_configure
344 # We are now inside a configured build directory
347 $MAKE -j "$($NPROC)" V
=1
349 # Install in the workspace
350 $MAKE install DESTDIR
="$WORKSPACE"
352 # Run tests, don't fail now, we want to run the archiving steps
354 if [ "$USERSPACE_RCU_RUN_TESTS" = "yes" ]; then
355 $MAKE --keep-going check || failed_tests
=1
356 # Only run regtest for 0.9 and up
357 if vergte
"$PACKAGE_VERSION" "0.9"; then
358 $MAKE --keep-going regtest || failed_tests
=1
361 # Copy tap logs for the jenkins tap parser before cleaning the build dir
362 rsync
-a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests
/ "$WORKSPACE/tap"
364 # The test suite prior to 0.11 did not produce TAP logs
365 if verlt
"$PACKAGE_VERSION" "0.11"; then
366 mkdir
-p "$WORKSPACE/tap/no-log"
367 echo "1..1" > "$WORKSPACE/tap/no-log/tests.log"
368 echo "ok 1 - Test suite doesn't support logging" >> "$WORKSPACE/tap/no-log/tests.log"
372 # Clean the build directory
375 # Cleanup rpath in executables and shared libraries
376 #find "$WORKSPACE/$PREFIX/bin" -type f -perm -0500 -exec chrpath --delete {} \;
377 find "$WORKSPACE/$PREFIX/lib" -name "*.so" -exec chrpath
--delete {} \
;
379 # Remove libtool .la files
380 find "$WORKSPACE/$PREFIX/lib" -name "*.la" -exec rm -f {} \
;
382 # Exit with failure if any of the tests failed