1- #! /usr/ bin/env bash
1+ #! /bin/sh
22# Common definitions used by SOCI build scripts in CI builds
33#
44# Copyright (c) 2013 Mateusz Loskot <mateusz@loskot.net>
55#
6+ # Note that this is a /bin/sh script because it is used from install.sh
7+ # which installs bash under FreeBSD and so we can't rely on bash being
8+ # available yet.
69
710# Stop on all errors.
811set -e
912
10- if [[ " $SOCI_CI " != " true" ] ] ; then
13+ if [ " $SOCI_CI " != " true" ] ; then
1114 echo " Running this script is only useful in the CI builds"
1215 exit 1
1316fi
1417
1518backend_settings=${SOCI_SOURCE_DIR} /scripts/ci/${SOCI_CI_BACKEND} .sh
1619if [ -f ${backend_settings} ]; then
17- source ${backend_settings}
20+ . ${backend_settings}
1821fi
1922
2023#
@@ -33,10 +36,6 @@ case `uname` in
3336 num_cpus=1
3437esac
3538
36- if [[ ${num_cpus} != 1 ]]; then
37- (( num_cpus++ ))
38- fi
39-
4039# Directory where the build happens.
4140#
4241# Note that the existing commands suppose that the build directory is an
@@ -52,7 +51,7 @@ SOCI_COMMON_CMAKE_OPTIONS='
5251 -DSOCI_TESTS=ON
5352'
5453
55- if [[ -n ${WITH_BOOST} ] ]; then
54+ if [ -n " ${WITH_BOOST} " ]; then
5655 SOCI_COMMON_CMAKE_OPTIONS=" $SOCI_COMMON_CMAKE_OPTIONS -DWITH_BOOST=${WITH_BOOST} "
5756fi
5857
@@ -77,6 +76,12 @@ tmstamp()
7776 echo -n " [$( date ' +%H:%M:%S' ) ]" ;
7877}
7978
79+ run_apt ()
80+ {
81+ # Disable some (but not all) output.
82+ sudo apt-get -q -y -o=Dpkg::Use-Pty=0 " $@ "
83+ }
84+
8085run_make ()
8186{
8287 make -j $num_cpus
@@ -86,7 +91,7 @@ run_test()
8691{
8792 # The example project doesn't have any tests, but otherwise their absence
8893 # is an error and means that something has gone wrong.
89- if [[ " $BUILD_EXAMPLES " == " YES" ] ]; then
94+ if [ " $BUILD_EXAMPLES " == " YES" ]; then
9095 no_tests_action=ignore
9196 else
9297 no_tests_action=error
0 commit comments