3 # Copyright (C) 2012 Brian Aker
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are
10 # * Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
13 # * Redistributions in binary form must reproduce the above
14 # copyright notice, this list of conditions and the following disclaimer
15 # in the documentation and/or other materials provided with the
18 # * The names of its contributors may not be used to endorse or
19 # promote products derived from this software without specific prior
22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 # Environment Variables that will influence the build:
46 command_not_found_handle
()
48 echo "Command not found: '$@'"
54 echo "$BASH_SOURCE:$BASH_LINENO: $@" >&2
60 local param_name
=\$
"$1"
61 local param_value
=`eval "expr \"$param_name\" "`
63 if [ -z "$param_value" ]; then
64 echo "$BASH_SOURCE:$BASH_LINENO: assert($param_name)" >&2
71 if [ ! -f "$1" ]; then
72 echo "$BASH_SOURCE:$BASH_LINENO: assert($1) does not exist: $2" >&2
80 echo "$BASH_SOURCE:$BASH_LINENO: assert($1) file exists: $2" >&2
87 if [ ! -f "$1" ]; then
88 echo "$BASH_SOURCE:$BASH_LINENO: assert($1) does not exist: $2" >&2
92 if [ ! -x "$1" ]; then
93 echo "$BASH_SOURCE:$BASH_LINENO: assert($1) exists but is not executable: $2" >&2
100 type "$1" &> /dev
/null
;
105 HOST_OS
="${UNAME_MACHINE_ARCH}-${VENDOR}-${VENDOR_DISTRIBUTION}-${VENDOR_RELEASE}-${UNAME_KERNEL}-${UNAME_KERNEL_RELEASE}"
108 echo "HOST_OS=$HOST_OS"
113 # Valid values are: darwin,fedora,rhel,ubuntu
114 set_VENDOR_DISTRIBUTION
()
116 local dist
=`echo "$1" | tr '[A-Z]' '[a-z]'`
119 VENDOR_DISTRIBUTION
='darwin'
122 VENDOR_DISTRIBUTION
='fedora'
125 VENDOR_DISTRIBUTION
='rhel'
128 VENDOR_DISTRIBUTION
='ubuntu'
131 VENDOR_DISTRIBUTION
='opensuse'
134 die
"attempt to set an invalid VENDOR_DISTRIBUTION=$dist"
139 set_VENDOR_RELEASE
()
141 local release
=`echo "$1" | tr '[A-Z]' '[a-z]'`
142 case "$VENDOR_DISTRIBUTION" in
144 VENDOR_RELEASE
='mountain'
147 VENDOR_RELEASE
="$release"
150 VENDOR_RELEASE
="$release"
153 VENDOR_RELEASE
="$release"
156 VENDOR_RELEASE
="$release"
159 die
"attempt to set VENDOR_RELEASE without setting VENDOR_DISTRIBUTION"
162 die
"attempt to set with an invalid VENDOR_DISTRIBUTION=$VENDOR_DISTRIBUTION"
168 # Valid values are: apple, redhat, centos, canonical
171 local vendor
=`echo "$1" | tr '[A-Z]' '[a-z]'`
190 die
"An attempt was made to set an invalid VENDOR=$_vendor"
194 set_VENDOR_DISTRIBUTION
$2
195 set_VENDOR_RELEASE
$3
198 determine_target_platform
()
200 UNAME_MACHINE_ARCH
=`(uname -m) 2>/dev/null` || UNAME_MACHINE_ARCH
=unknown
201 UNAME_KERNEL
=`(uname -s) 2>/dev/null` || UNAME_SYSTEM
=unknown
202 UNAME_KERNEL_RELEASE
=`(uname -r) 2>/dev/null` || UNAME_KERNEL_RELEASE
=unknown
204 if [[ $
(uname
) == 'Darwin' ]]; then
205 set_VENDOR
'apple' 'darwin' 'mountain'
206 elif [[ -f '/etc/fedora-release' ]]; then
207 local fedora_version
=`cat /etc/fedora-release | awk ' { print $3 } '`
208 set_VENDOR
'redhat' 'fedora' $fedora_version
209 if [[ "x$VENDOR_RELEASE" == 'x17' ]]; then
210 AUTORECONF_REBUILD_HOST
=true
212 elif [[ -f '/etc/centos-release' ]]; then
213 local centos_version
=`cat /etc/centos-release | awk ' { print $7 } '`
214 set_VENDOR
'centos' 'rhel' $centos_version
215 elif [[ -f '/etc/SuSE-release' ]]; then
216 local suse_distribution
=`head -1 /etc/SuSE-release | awk ' { print $1 } '`
217 local suse_version
=`head -1 /etc/SuSE-release | awk ' { print $2 } '`
218 set_VENDOR
'suse' $suse_distribution $suse_version
219 elif [[ -f '/etc/redhat-release' ]]; then
220 local rhel_version
=`cat /etc/redhat-release | awk ' { print $7 } '`
221 set_VENDOR
'redhat' 'rhel' $rhel_version
222 elif [[ -f '/etc/lsb-release' ]]; then
223 local debian_DISTRIB_ID
=`cat /etc/lsb-release | grep DISTRIB_ID | awk -F= ' { print $2 } '`
224 local debian_version
=`cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F= ' { print $2 } '`
225 set_VENDOR
'canonical' $debian_DISTRIB_ID $debian_version
226 if [[ "x$VENDOR_RELEASE" == 'xprecise' ]]; then
227 AUTORECONF_REBUILD_HOST
=true
236 # We will run autoreconf if we are required
237 run_autoreconf_if_required
239 # We always begin at the root of our build
241 die
"Programmer error, we entered run_configure with a stacked directory"
245 if [[ -n "$BUILD_DIR" ]]; then
248 safe_pushd
$BUILD_DIR
251 # Arguments for configure
254 # Set ENV DEBUG in order to enable debugging
256 CONFIGURE_ARG
='--enable-debug'
259 # Set ENV ASSERT in order to enable assert
260 if [[ -n "$ASSERT" ]]; then
262 ASSERT_ARG
='--enable-assert'
263 CONFIGURE_ARG
="$ASSERT_ARG $CONFIGURE_ARG"
266 # If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV
269 CC
=clang CXX
=clang
++ $top_srcdir/configure
$CONFIGURE_ARG || die
"Cannot execute CC=clang CXX=clang++ configure $CONFIGURE_ARG $PREFIX_ARG"
272 command_exists gcc44 || die
"Could not locate gcc44"
273 CC
=gcc44 CXX
=gcc44
$top_srcdir/configure
$CONFIGURE_ARG $PREFIX_ARG || die
"Cannot execute CC=gcc44 CXX=gcc44 configure $CONFIGURE_ARG $PREFIX_ARG"
276 $top_srcdir/configure
$CONFIGURE_ARG $PREFIX_ARG || die
"Cannot execute configure $CONFIGURE_ARG $PREFIX_ARG"
280 if [ ! -f 'Makefile' ]; then
281 die
"Programmer error, configure was run but no Makefile existed afterward"
285 setup_gdb_command
() {
286 GDB_TMPFILE
=$
(mktemp
/tmp
/gdb.XXXXXXXXXX
)
287 echo 'set logging overwrite on' > $GDB_TMPFILE
288 echo 'set logging on' >> $GDB_TMPFILE
289 echo 'set environment LIBTEST_IN_GDB=1' >> $GDB_TMPFILE
290 echo 'run' >> $GDB_TMPFILE
291 echo 'thread apply all bt' >> $GDB_TMPFILE
292 echo 'quit' >> $GDB_TMPFILE
293 GDB_COMMAND
="gdb -f -batch -x $GDB_TMPFILE"
296 setup_valgrind_command
() {
297 VALGRIND_PROGRAM
=`type -p valgrind`
298 if [[ -n "$VALGRIND_PROGRAM" ]]; then
299 VALGRIND_COMMAND
="$VALGRIND_PROGRAM --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE"
305 if [[ -n "$PREFIX_ARG" ]]; then
306 OLD_PREFIX_ARG
=$PREFIX_ARG
310 if [[ -n "$1" ]]; then
311 PREFIX_ARG
="--prefix=$1"
317 if [[ -n "$OLD_PREFIX_ARG" ]]; then
318 PREFIX_ARG
=$OLD_TESTS_ENVIRONMENT
325 push_TESTS_ENVIRONMENT
()
327 if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
328 die
"OLD_TESTS_ENVIRONMENT was set on push, programmer error!"
331 if [[ -n "$TESTS_ENVIRONMENT" ]]; then
332 OLD_TESTS_ENVIRONMENT
=$TESTS_ENVIRONMENT
337 pop_TESTS_ENVIRONMENT
()
340 if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
341 TESTS_ENVIRONMENT
=$OLD_TESTS_ENVIRONMENT
342 OLD_TESTS_ENVIRONMENT
=
348 pushd $1 &> /dev
/null
;
350 if $VERBOSE -a test -n "$BUILD_DIR"; then
351 echo "BUILD_DIR=$BUILD_DIR"
357 local directory_to_delete
=`pwd`
359 if [ $?
-eq 0 ]; then
360 if [[ "$top_srcdir" == "$directory_to_delete" ]]; then
361 die
"We almost deleted top_srcdir($top_srcdir), programmer error"
364 rm -r -f "$directory_to_delete"
370 if [[ "$VENDOR_DISTRIBUTION" == 'darwin' ]]; then
375 # If the env VALGRIND_COMMAND is set then we assume it is valid
376 local valgrind_was_set
=false
377 if [[ -z "$VALGRIND_COMMAND" ]]; then
378 setup_valgrind_command
379 if [[ -n "$VALGRIND_COMMAND" ]]; then
380 valgrind_was_set
=true
383 valgrind_was_set
=true
386 # If valgrind_was_set is set to no we bail
387 if ! $valgrind_was_set; then
388 echo 'valgrind was not present'
392 # If we are required to run configure, do so now
393 run_configure_if_required
395 push_TESTS_ENVIRONMENT
397 if [[ -f 'libtool' ]]; then
398 TESTS_ENVIRONMENT
="$LIBTOOL_COMMAND $VALGRIND_COMMAND"
400 TESTS_ENVIRONMENT
="$VALGRIND_COMMAND"
403 make_target
'check' ||
return 1
405 pop_TESTS_ENVIRONMENT
408 make_install_system
()
410 local INSTALL_LOCATION
=$
(mktemp
-d /tmp
/XXXXXXXXXX
)
411 push_PREFIX_ARG
$INSTALL_LOCATION
413 if [ ! -d $INSTALL_LOCATION ] ; then
414 die
"ASSERT temp directory not found '$INSTALL_LOCATION'"
417 run_configure
#install_buid_dir
419 push_TESTS_ENVIRONMENT
421 make_target
'install'
423 make_target
'installcheck'
425 make_target
'uninstall'
427 pop_TESTS_ENVIRONMENT
430 rm -r -f $INSTALL_LOCATION
433 if [ -f 'Makefile' ]; then
434 die
"ASSERT Makefile should not exist"
440 make_darwin_malloc
()
442 run_configure_if_required
444 old_MallocGuardEdges
=$MallocGuardEdges
446 old_MallocErrorAbort
=$MallocErrorAbort
448 old_MallocScribble
=$MallocScribble
453 MallocGuardEdges
=$old_MallocGuardEdges
454 MallocErrorAbort
=$old_MallocErrorAbort
455 MallocScribble
=$old_MallocScribble
460 if [ -n "$BOOTSTRAP_SNAPSHOT_CHECK" ]; then
461 assert_file
"$BOOTSTRAP_SNAPSHOT_CHECK" 'snapshot check failed'
465 # This will reset our environment, and make sure built files are available.
468 # Make sure it is clean
469 make_maintainer_clean
473 make_target
'distclean'
475 # We should have a configure, but no Makefile at the end of this exercise
476 assert_no_file
'Makefile'
477 assert_exec_file
'configure'
482 # If we are locally testing, we should make sure the environment is setup correctly
485 if ! $jenkins_build_environment; then
486 echo "Not inside of jenkins"
488 if [ -f 'configure' ]; then
489 make_maintainer_clean
492 if $BOOTSTRAP_SNAPSHOT; then
498 make_for_continuus_integration
()
500 # Setup the environment if we are local
503 # No matter then evironment, we should not have a Makefile at this point
504 assert_no_file
'Makefile'
506 # Platforms which require bootstrap should have some setup done before we hit this stage.
507 # If we are building locally, skip this step, unless we are just testing locally.
508 if $BOOTSTRAP_SNAPSHOT; then
511 # If we didn't require a snapshot, then we should not have a configure
512 assert_no_file
'configure'
517 assert_no_file
'Makefile' 'Programmer error, Makefile existed where build state should have been clean'
523 assert_exec_file
'configure'
524 assert_file
'Makefile'
526 # make rpm includes "make distcheck"
527 if [[ -f rpm.am
]]; then
529 elif [[ -d rpm
]]; then
535 assert_exec_file
'configure'
536 assert_file
'Makefile'
543 assert_exec_file
'configure'
544 assert_file
'Makefile'
548 assert_exec_file
'configure'
549 assert_file
'Makefile'
553 assert_exec_file
'configure'
554 assert_file
'Makefile'
564 make_maintainer_clean
571 run_configure_if_required
573 if command_exists gdb
; then
575 push_TESTS_ENVIRONMENT
577 # Set ENV GDB_COMMAND
578 if [[ -z "$GDB_COMMAND" ]]; then
582 if [ -f 'libtool' ]; then
583 TESTS_ENVIRONMENT
="$LIBTOOL_COMMAND $GDB_COMMAND"
585 TESTS_ENVIRONMENT
="$GDB_COMMAND"
590 if [ -f 'gdb.txt' ]; then
594 pop_TESTS_ENVIRONMENT
596 if [ -f '.gdb_history' ]; then
600 echo 'gdb was not present'
605 # $1 target to compile
606 # $2 to die, or not to die, based on contents
609 if [[ -z "$1" ]]; then
610 die
"Programmer error, no target provided for make"
613 if [ ! -f 'Makefile' ]; then
614 die
"Programmer error, make was called before configure"
618 if test -n "$TESTS_ENVIRONMENT" -a $VERBOSE; then
619 echo "TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT"
622 if [[ -z "$MAKE" ]]; then
623 die
"MAKE was not set"
626 if [[ -n "$2" ]]; then
627 run
$MAKE $1 ||
return 1
629 run
$MAKE $1 || die
"Cannot execute $MAKE $1"
635 make_target
'distcheck'
640 run_configure_if_required
644 make_maintainer_clean
()
646 run_configure_if_required
647 make_target
'maintainer-clean' 'no_error'
660 run_configure_if_required
()
662 run_autoreconf_if_required
664 if [ ! -f 'Makefile' ]; then
668 assert_file
'Makefile' 'configure did not produce a Makefile'
671 run_autoreconf_if_required
()
673 if [ ! -x 'configure' ]; then
677 assert_exec_file
'configure'
682 if [[ -z "$AUTORECONF" ]]; then
683 die
"Programmer error, tried to call run_autoreconf () but AUTORECONF was not set"
686 run
$AUTORECONF || die
"Cannot execute $AUTORECONF"
688 eval 'bash -n configure' || die
"autoreconf generated a malformed configure"
700 parse_command_line_options
()
702 local SHORTOPTS
=':apcmt:dv'
704 while getopts "$SHORTOPTS" opt
; do
707 AUTORECONF_OPTION
=true
708 MAKE_TARGET
='autoreconf'
711 PRINT_SETUP_OPTION
=true
714 CONFIGURE_OPTION
=true
715 MAKE_TARGET
='configure'
717 m
) # maintainer-clean
719 MAKE_TARGET
='clean_op'
723 TARGET_OPTION_ARG
="$OPTARG"
724 MAKE_TARGET
="$OPTARG"
735 echo "Option -$OPTARG requires an argument." >&2
739 echo "$0: error - unrecognized option $1" 1>&2
752 if [[ -d '.git' ]]; then
754 elif [[ -d '.bzr' ]]; then
756 elif [[ -d '.svn' ]]; then
758 elif [[ -d '.hg' ]]; then
762 if [[ -n "$VCS_CHECKOUT" ]]; then
769 # Set ENV MAKE in order to override "make"
770 if [[ -z "$MAKE" ]]; then
771 if command_exists gmake
; then
774 if command_exists
make; then
780 MAKE
="$MAKE --warn-undefined-variables"
784 if [[ -z "$GNU_BUILD_FLAGS" ]]; then
785 GNU_BUILD_FLAGS
="--install --force"
789 GNU_BUILD_FLAGS
="$GNU_BUILD_FLAGS --verbose"
792 if [[ -z "$WARNINGS" ]]; then
793 if [[ -n "$VCS_CHECKOUT" ]]; then
800 if [[ -z "$LIBTOOLIZE" ]]; then
801 # If we are using OSX, we first check to see glibtoolize is available
802 if [[ "$VENDOR_DISTRIBUTION" == "darwin" ]]; then
803 LIBTOOLIZE
=`type -p glibtoolize`
805 if [[ -z "$LIBTOOLIZE" ]]; then
806 echo "Couldn't find glibtoolize, it is required on OSX"
811 # Test the ENV AUTOMAKE if it exists
812 if [[ -n "$AUTOMAKE" ]]; then
813 run
$AUTOMAKE '--help' &> /dev
/null || die
"Failed to run AUTOMAKE:$AUTOMAKE"
816 # Test the ENV AUTOCONF if it exists
817 if [[ -n "$AUTOCONF" ]]; then
818 run
$AUTOCONF '--help' &> /dev
/null || die
"Failed to run AUTOCONF:$AUTOCONF"
821 # Test the ENV AUTOHEADER if it exists
822 if [[ -n "$AUTOHEADER" ]]; then
823 run
$AUTOHEADER '--help' &> /dev
/null || die
"Failed to run AUTOHEADER:$AUTOHEADER"
826 # Test the ENV AUTOM4TE if it exists
827 if [[ -n "$AUTOM4TE" ]]; then
828 run
$AUTOM4TE '--help' &> /dev
/null || die
"Failed to run AUTOM4TE:$AUTOM4TE"
831 if [[ -z "$AUTORECONF" ]]; then
832 AUTORECONF
=`type -p autoreconf`
834 if [[ -z "$AUTORECONF" ]]; then
835 die
"Couldn't find autoreconf"
838 if [[ -n "$GNU_BUILD_FLAGS" ]]; then
839 AUTORECONF
="$AUTORECONF $GNU_BUILD_FLAGS"
843 run
$AUTORECONF '--help' &> /dev
/null || die
"Failed to run AUTORECONF:$AUTORECONF"
848 saved_debug_status
=$DEBUG
853 echo '----------------------------------------------'
855 echo "AUTORECONF=$AUTORECONF"
856 echo "HOST_OS=$HOST_OS"
859 if $AUTORECONF_OPTION; then
863 if $CLEAN_OPTION; then
867 if $CONFIGURE_OPTION; then
871 if $DEBUG_OPTION; then
875 if $PRINT_SETUP_OPTION; then
879 if $TARGET_OPTION; then
880 echo "--target=$TARGET_OPTION_ARG"
883 if $VERBOSE_OPTION; then
887 if [[ -n "$MAKE" ]]; then
891 if [[ -n "$MAKE_TARGET" ]]; then
892 echo "MAKE_TARGET=$MAKE_TARGET"
895 if [[ -n "$PREFIX" ]]; then
896 echo "PREFIX=$PREFIX"
899 if [[ -n "$TESTS_ENVIRONMENT" ]]; then
900 echo "TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT"
903 if [[ -n "$VCS_CHECKOUT" ]]; then
904 echo "VCS_CHECKOUT=$VCS_CHECKOUT"
915 if [[ -n "$WARNINGS" ]]; then
916 echo "WARNINGS=$WARNINGS"
918 echo '----------------------------------------------'
920 if $saved_debug_status; then
927 run_configure_if_required
929 make_maintainer_clean
931 if [[ "$VCS_CHECKOUT" == 'git' ]]; then
932 run
"$VCS_CHECKOUT" status
--ignored
933 elif [[ -n "$VCS_CHECKOUT" ]]; then
934 run
"$VCS_CHECKOUT" status
938 make_for_autoreconf
()
940 if [ -f 'Makefile' ]; then
941 make_maintainer_clean
946 assert_no_file
'Makefile'
981 die
"Unknown MAKE_TARGET option: $1"
988 determine_target_platform
992 # Set up whatever we need to do to use autoreconf later
995 if $PRINT_SETUP_OPTION -o $DEBUG; then
1000 # Exit if all we were looking for were the currently used options
1001 if $PRINT_SETUP_OPTION; then
1006 # Setup LIBTOOL_COMMAND if we need it
1007 if [ -f 'libtool' ]; then
1008 LIBTOOL_COMMAND
='./libtool --mode=execute'
1011 # Use OLD_TESTS_ENVIRONMENT for tracking the state of the variable
1012 local OLD_TESTS_ENVIRONMENT
=
1014 # Set ENV PREFIX in order to set --prefix for ./configure
1015 if [[ -n "$PREFIX" ]]; then
1016 push_PREFIX_ARG
$PREFIX
1019 # Either we run a known target (or error), or we default to "all"
1020 if [[ -n "$MAKE_TARGET" ]]; then
1022 # If we are running inside of Jenkins, we want to only run some of the possible tests
1023 if $jenkins_build_environment; then
1024 check_make_target
$MAKE_TARGET
1027 case $MAKE_TARGET in
1053 make_for_continuus_integration
1056 run_configure_if_required
1057 make_target
$MAKE_TARGET
1061 run_configure_if_required
1068 # Variables we export
1069 declare -x VCS_CHECKOUT
=
1071 # Variables we control globally
1074 # Options for getopt
1075 local AUTORECONF_OPTION
=false
1076 local CLEAN_OPTION
=false
1077 local CONFIGURE_OPTION
=false
1078 local DEBUG_OPTION
=false
1079 local PRINT_SETUP_OPTION
=false
1080 local TARGET_OPTION
=false
1081 local TARGET_OPTION_ARG
=
1082 local VERBOSE_OPTION
=false
1084 # If we call autoreconf on the platform or not
1085 local AUTORECONF_REBUILD_HOST
=false
1086 local AUTORECONF_REBUILD
=false
1088 local -r top_srcdir
=`pwd`
1090 # Variables for determine_target_platform () and rebuild_host_os ()
1091 # UNAME_MACHINE_ARCH= uname -m
1092 # VENDOR= apple, redhat, centos, canonical
1094 # RHEL{rhel,Tikanga,Santiago}
1095 # Ubuntu{ubuntu,Lucid,Maverick,Natty,Oneiric,Precise,Quantal}
1096 # Fedora{fedora,Verne,Beefy}
1097 # OSX{osx,lion,snow,mountain}
1098 # VENDOR_DISTRIBUTION= darwin,fedora,rhel,ubuntu
1099 # UNAME_KERNEL= Linux, Darwin,...
1100 # UNAME_KERNEL_RELEASE= Linux, Darwin,...
1101 local UNAME_MACHINE_ARCH
=unknown
1102 local VENDOR
=unknown
1103 local VENDOR_RELEASE
=unknown
1104 local VENDOR_DISTRIBUTION
=unknown
1105 local UNAME_KERNEL
=unknown
1106 local UNAME_KERNEL_RELEASE
=unknown
1109 rebuild_host_os no_output
1111 # If we are running under Jenkins we predetermine what tests we will run against
1112 # This MAKE_TARGET can be overridden by parse_command_line_options based MAKE_TARGET changes.
1113 # We don't want Jenkins overriding other variables, so we NULL them.
1114 if $jenkins_build_environment; then
1115 MAKE_TARGET
='jenkins'
1118 parse_command_line_options $@
1131 local caller_loc
=`caller`
1133 echo "$caller_loc Enabling debug: $1"
1135 echo "$caller_loc Enabling debug"
1148 # Script begins here
1150 env_debug_enabled
=false
1151 if [[ -n "$JENKINS_HOME" ]]; then
1152 declare -r jenkins_build_environment
=true
1154 declare -r jenkins_build_environment
=false
1163 export GNU_BUILD_FLAGS
1165 export TESTS_ENVIRONMENT
1171 export MallocGuardEdges
1172 export MallocErrorAbort
1173 export MallocScribble
1177 # We check for DEBUG twice, once before we source the config file, and once afterward
1178 env_debug_enabled
=false
1179 if [[ -n "$DEBUG" ]]; then
1180 env_debug_enabled
=true
1185 # Variables which only can be set by .bootstrap
1186 BOOTSTRAP_SNAPSHOT
=false
1187 BOOTSTRAP_SNAPSHOT_CHECK
=
1189 if [ -f '.bootstrap' ]; then
1193 if $env_debug_enabled; then
1196 if [[ -n "$DEBUG" ]]; then
1197 enable_debug
"Enabling DEBUG from '.bootstrap'"
1202 # We do this in order to protect the case where DEBUG
1203 if ! $env_debug_enabled; then