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 [ -n "$param_value" ]; then
64 echo "$bash_source:$bash_lineno: assert($param_name) had value of "$param_value"" >&2
71 local param_name
=\$
"$1"
72 local param_value
=`eval "expr \"$param_name\" "`
74 if [ -z "$param_value" ]; then
75 echo "$bash_source:$bash_lineno: assert($param_name)" >&2
82 if [ ! -f "$1" ]; then
83 echo "$BASH_SOURCE:$BASH_LINENO: assert($1) does not exist: $2" >&2
91 echo "$BASH_SOURCE:$BASH_LINENO: assert($1) file exists: $2" >&2
98 if [ ! -f "$1" ]; then
99 echo "$BASH_SOURCE:$BASH_LINENO: assert($1) does not exist: $2" >&2
103 if [ ! -x "$1" ]; then
104 echo "$BASH_SOURCE:$BASH_LINENO: assert($1) exists but is not executable: $2" >&2
111 type "$1" &> /dev
/null
;
116 HOST_OS
="${UNAME_MACHINE_ARCH}-${VENDOR}-${VENDOR_DISTRIBUTION}-${VENDOR_RELEASE}-${UNAME_KERNEL}-${UNAME_KERNEL_RELEASE}"
119 echo "HOST_OS=$HOST_OS"
124 # Valid values are: darwin,fedora,rhel,ubuntu
125 set_VENDOR_DISTRIBUTION
()
127 local dist
=`echo "$1" | tr '[A-Z]' '[a-z]'`
130 VENDOR_DISTRIBUTION
='darwin'
133 VENDOR_DISTRIBUTION
='fedora'
136 VENDOR_DISTRIBUTION
='rhel'
139 VENDOR_DISTRIBUTION
='ubuntu'
142 VENDOR_DISTRIBUTION
='opensuse'
145 die
"attempt to set an invalid VENDOR_DISTRIBUTION=$dist"
150 set_VENDOR_RELEASE
()
152 local release
=`echo "$1" | tr '[A-Z]' '[a-z]'`
153 case "$VENDOR_DISTRIBUTION" in
155 VENDOR_RELEASE
='mountain'
158 VENDOR_RELEASE
="$release"
161 VENDOR_RELEASE
="$release"
164 VENDOR_RELEASE
="$release"
167 VENDOR_RELEASE
="$release"
170 die
"attempt to set VENDOR_RELEASE without setting VENDOR_DISTRIBUTION"
173 die
"attempt to set with an invalid VENDOR_DISTRIBUTION=$VENDOR_DISTRIBUTION"
179 # Valid values are: apple, redhat, centos, canonical
182 local vendor
=`echo "$1" | tr '[A-Z]' '[a-z]'`
201 die
"An attempt was made to set an invalid VENDOR=$_vendor"
205 set_VENDOR_DISTRIBUTION
$2
206 set_VENDOR_RELEASE
$3
209 determine_target_platform
()
211 UNAME_MACHINE_ARCH
=`(uname -m) 2>/dev/null` || UNAME_MACHINE_ARCH
=unknown
212 UNAME_KERNEL
=`(uname -s) 2>/dev/null` || UNAME_SYSTEM
=unknown
213 UNAME_KERNEL_RELEASE
=`(uname -r) 2>/dev/null` || UNAME_KERNEL_RELEASE
=unknown
215 if [[ $
(uname
) == 'Darwin' ]]; then
216 set_VENDOR
'apple' 'darwin' 'mountain'
217 elif [[ -f '/etc/fedora-release' ]]; then
218 local fedora_version
=`cat /etc/fedora-release | awk ' { print $3 } '`
219 set_VENDOR
'redhat' 'fedora' $fedora_version
220 if [[ "x$VENDOR_RELEASE" == 'x17' ]]; then
221 AUTORECONF_REBUILD_HOST
=true
223 elif [[ -f '/etc/centos-release' ]]; then
224 local centos_version
=`cat /etc/centos-release | awk ' { print $7 } '`
225 set_VENDOR
'centos' 'rhel' $centos_version
226 elif [[ -f '/etc/SuSE-release' ]]; then
227 local suse_distribution
=`head -1 /etc/SuSE-release | awk ' { print $1 } '`
228 local suse_version
=`head -1 /etc/SuSE-release | awk ' { print $2 } '`
229 set_VENDOR
'suse' $suse_distribution $suse_version
230 elif [[ -f '/etc/redhat-release' ]]; then
231 local rhel_version
=`cat /etc/redhat-release | awk ' { print $7 } '`
232 set_VENDOR
'redhat' 'rhel' $rhel_version
233 elif [[ -f '/etc/lsb-release' ]]; then
234 local debian_DISTRIB_ID
=`cat /etc/lsb-release | grep DISTRIB_ID | awk -F= ' { print $2 } '`
235 local debian_version
=`cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F= ' { print $2 } '`
236 set_VENDOR
'canonical' $debian_DISTRIB_ID $debian_version
237 if [[ "x$VENDOR_RELEASE" == 'xprecise' ]]; then
238 AUTORECONF_REBUILD_HOST
=true
247 # We will run autoreconf if we are required
248 run_autoreconf_if_required
250 # We always begin at the root of our build
252 die
"Programmer error, we entered run_configure with a stacked directory"
256 if [[ -n "$BUILD_DIR" ]]; then
259 safe_pushd
$BUILD_DIR
262 # Arguments for configure
265 # Set ENV DEBUG in order to enable debugging
267 CONFIGURE_ARG
='--enable-debug'
270 # Set ENV ASSERT in order to enable assert
271 if [[ -n "$ASSERT" ]]; then
273 ASSERT_ARG
='--enable-assert'
274 CONFIGURE_ARG
="$ASSERT_ARG $CONFIGURE_ARG"
277 # If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV
280 CC
=clang CXX
=clang
++ $top_srcdir/configure
$CONFIGURE_ARG || die
"Cannot execute CC=clang CXX=clang++ configure $CONFIGURE_ARG $PREFIX_ARG"
283 command_exists gcc44 || die
"Could not locate gcc44"
284 CC
=gcc44 CXX
=gcc44
$top_srcdir/configure
$CONFIGURE_ARG $PREFIX_ARG || die
"Cannot execute CC=gcc44 CXX=gcc44 configure $CONFIGURE_ARG $PREFIX_ARG"
287 $top_srcdir/configure
$CONFIGURE_ARG $PREFIX_ARG || die
"Cannot execute configure $CONFIGURE_ARG $PREFIX_ARG"
291 if [ ! -f 'Makefile' ]; then
292 die
"Programmer error, configure was run but no Makefile existed afterward"
296 setup_gdb_command
() {
297 GDB_TMPFILE
=$
(mktemp
/tmp
/gdb.XXXXXXXXXX
)
298 echo 'set logging overwrite on' > $GDB_TMPFILE
299 echo 'set logging on' >> $GDB_TMPFILE
300 echo 'set environment LIBTEST_IN_GDB=1' >> $GDB_TMPFILE
301 echo 'run' >> $GDB_TMPFILE
302 echo 'thread apply all bt' >> $GDB_TMPFILE
303 echo 'quit' >> $GDB_TMPFILE
304 GDB_COMMAND
="gdb -f -batch -x $GDB_TMPFILE"
307 setup_valgrind_command
() {
308 VALGRIND_PROGRAM
=`type -p valgrind`
309 if [[ -n "$VALGRIND_PROGRAM" ]]; then
310 VALGRIND_COMMAND
="$VALGRIND_PROGRAM --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE"
316 if [[ -n "$PREFIX_ARG" ]]; then
317 OLD_PREFIX_ARG
=$PREFIX_ARG
321 if [[ -n "$1" ]]; then
322 PREFIX_ARG
="--prefix=$1"
328 if [[ -n "$OLD_PREFIX_ARG" ]]; then
329 PREFIX_ARG
=$OLD_TESTS_ENVIRONMENT
336 push_TESTS_ENVIRONMENT
()
338 if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
339 die
"OLD_TESTS_ENVIRONMENT was set on push, programmer error!"
342 if [[ -n "$TESTS_ENVIRONMENT" ]]; then
343 OLD_TESTS_ENVIRONMENT
=$TESTS_ENVIRONMENT
348 pop_TESTS_ENVIRONMENT
()
351 if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
352 TESTS_ENVIRONMENT
=$OLD_TESTS_ENVIRONMENT
353 OLD_TESTS_ENVIRONMENT
=
357 function safe_pushd
()
359 pushd $1 &> /dev
/null
;
361 if $VERBOSE -a test -n "$BUILD_DIR"; then
362 echo "BUILD_DIR=$BUILD_DIR"
366 function safe_popd
()
368 local directory_to_delete
=`pwd`
370 if [ $?
-eq 0 ]; then
371 if [[ "$top_srcdir" == "$directory_to_delete" ]]; then
372 die
"We almost deleted top_srcdir($top_srcdir), programmer error"
375 rm -r -f "$directory_to_delete"
379 function make_valgrind
()
381 if [[ "$VENDOR_DISTRIBUTION" == 'darwin' ]]; then
386 # If the env VALGRIND_COMMAND is set then we assume it is valid
387 local valgrind_was_set
=false
388 if [[ -z "$VALGRIND_COMMAND" ]]; then
389 setup_valgrind_command
390 if [[ -n "$VALGRIND_COMMAND" ]]; then
391 valgrind_was_set
=true
394 valgrind_was_set
=true
397 # If valgrind_was_set is set to no we bail
398 if ! $valgrind_was_set; then
399 echo 'valgrind was not present'
403 # If we are required to run configure, do so now
404 run_configure_if_required
406 push_TESTS_ENVIRONMENT
408 # If we don't have a configure, then most likely we will be missing libtool
409 assert_file
'configure'
410 if [[ -f 'libtool' ]]; then
411 TESTS_ENVIRONMENT
="./libtool --mode=execute $VALGRIND_COMMAND"
413 TESTS_ENVIRONMENT
="$VALGRIND_COMMAND"
416 make_target
'check' ||
return 1
418 pop_TESTS_ENVIRONMENT
421 function make_install_system
()
423 local INSTALL_LOCATION
=$
(mktemp
-d /tmp
/XXXXXXXXXX
)
424 push_PREFIX_ARG
$INSTALL_LOCATION
426 if [ ! -d $INSTALL_LOCATION ] ; then
427 die
"ASSERT temp directory not found '$INSTALL_LOCATION'"
430 run_configure
#install_buid_dir
432 push_TESTS_ENVIRONMENT
434 make_target
'install'
436 make_target
'installcheck'
438 make_target
'uninstall'
440 pop_TESTS_ENVIRONMENT
443 rm -r -f $INSTALL_LOCATION
446 if [ -f 'Makefile' ]; then
447 die
"ASSERT Makefile should not exist"
453 function make_darwin_malloc
()
455 run_configure_if_required
457 old_MallocGuardEdges
=$MallocGuardEdges
459 old_MallocErrorAbort
=$MallocErrorAbort
461 old_MallocScribble
=$MallocScribble
466 MallocGuardEdges
=$old_MallocGuardEdges
467 MallocErrorAbort
=$old_MallocErrorAbort
468 MallocScribble
=$old_MallocScribble
471 function snapshot_check
()
473 if [ -n "$BOOTSTRAP_SNAPSHOT_CHECK" ]; then
474 assert_file
"$BOOTSTRAP_SNAPSHOT_CHECK" 'snapshot check failed'
478 # This will reset our environment, and make sure built files are available.
479 function make_for_snapshot
()
481 # Make sure it is clean
482 make_maintainer_clean
486 make_target
'distclean'
488 # We should have a configure, but no Makefile at the end of this exercise
489 assert_no_file
'Makefile'
490 assert_exec_file
'configure'
495 function make_for_mingw32
()
497 # Make sure it is clean
498 if [ -f Makefile
-o -f configure
]; then
499 make_maintainer_clean
501 assert_no_file
'Makefile'
503 if command_exists mingw32-configure
; then
506 mingw32-configure || die
'mingw32-configure failed'
507 assert_file
'Makefile'
509 if command_exists mingw32-make
; then
510 mingw32-make || die
'mingw32-make failed'
515 # If we are locally testing, we should make sure the environment is setup correctly
516 function check_for_jenkins
()
518 if ! $jenkins_build_environment; then
519 echo "Not inside of jenkins"
521 if [ -f 'configure' ]; then
522 make_maintainer_clean
525 if $BOOTSTRAP_SNAPSHOT; then
531 function make_universe
()
542 function make_for_continuus_integration
()
544 # Setup the environment if we are local
547 # No matter then evironment, we should not have a Makefile at this point
548 assert_no_file
'Makefile'
550 # Platforms which require bootstrap should have some setup done before we hit this stage.
551 # If we are building locally, skip this step, unless we are just testing locally.
552 if $BOOTSTRAP_SNAPSHOT; then
555 # If we didn't require a snapshot, then we should not have a configure
556 assert_no_file
'configure'
561 assert_no_file
'Makefile' 'Programmer error, Makefile existed where build state should have been clean'
567 assert_exec_file
'configure'
568 assert_file
'Makefile'
570 # make rpm includes "make distcheck"
571 if [[ -f rpm.am
]]; then
573 elif [[ -d rpm
]]; then
579 assert_exec_file
'configure'
580 assert_file
'Makefile'
587 assert_exec_file
'configure'
588 assert_file
'Makefile'
592 assert_exec_file
'configure'
593 assert_file
'Makefile'
597 assert_exec_file
'configure'
598 assert_file
'Makefile'
607 make_maintainer_clean
612 # The point to this test is to test bootstrap.sh itself
613 function self_test
()
615 # We start off with a clean env
616 make_maintainer_clean
618 eval "./bootstrap.sh jenkins" || die
"failed 'jenkins'"
619 eval "./bootstrap.sh all" || die
"failed 'all'"
620 eval "./bootstrap.sh gdb" || die
"failed 'gdb'"
621 eval "./bootstrap.sh maintainer-clean" || die
"failed 'maintainer-clean'"
626 run_configure_if_required
628 if command_exists gdb
; then
630 push_TESTS_ENVIRONMENT
632 # Set ENV GDB_COMMAND
633 if [[ -z "$GDB_COMMAND" ]]; then
637 # If we don't have a configure, then most likely we will be missing libtool
638 assert_file
'configure'
639 if [[ -f 'libtool' ]]; then
640 TESTS_ENVIRONMENT
="./libtool --mode=execute $GDB_COMMAND"
642 TESTS_ENVIRONMENT
="$GDB_COMMAND"
647 if [ -f 'gdb.txt' ]; then
651 pop_TESTS_ENVIRONMENT
653 if [ -f '.gdb_history' ]; then
657 echo 'gdb was not present'
662 # $1 target to compile
663 # $2 to die, or not to die, based on contents
664 function make_target
()
666 if [[ -z "$1" ]]; then
667 die
"Programmer error, no target provided for make"
670 if [ ! -f 'Makefile' ]; then
671 die
"Programmer error, make was called before configure"
675 if [ -n "$TESTS_ENVIRONMENT" -a $VERBOSE ]; then
676 echo "TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT"
679 if [[ -z "$MAKE" ]]; then
680 die
"MAKE was not set"
683 if [[ -n "$2" ]]; then
684 run
$MAKE $1 ||
return 1
686 run
$MAKE $1 || die
"Cannot execute $MAKE $1"
690 function make_distcheck
()
692 make_target
'distcheck'
697 if [ -f 'rpm.am' -o -d 'rpm' ]; then
698 run_configure_if_required
703 function make_maintainer_clean
()
705 run_configure_if_required
706 make_target
'maintainer-clean' 'no_error'
709 function make_check
()
714 function make_jenkins_default
()
720 function make_default
()
722 run_configure_if_required
726 function run_configure_if_required
()
728 run_autoreconf_if_required
730 if [ ! -f 'Makefile' ]; then
734 assert_file
'Makefile' 'configure did not produce a Makefile'
737 function run_autoreconf_if_required
()
739 if [ ! -x 'configure' ]; then
743 assert_exec_file
'configure'
746 function run_autoreconf
()
748 if [[ -z "$AUTORECONF" ]]; then
749 die
"Programmer error, tried to call run_autoreconf () but AUTORECONF was not set"
752 run
$AUTORECONF || die
"Cannot execute $AUTORECONF"
754 eval 'bash -n configure' || die
"autoreconf generated a malformed configure"
766 parse_command_line_options
()
768 local SHORTOPTS
=':apcmt:dvh'
772 while getopts "$SHORTOPTS" opt
; do
775 AUTORECONF_OPTION
=true
776 MAKE_TARGET
='autoreconf'
779 PRINT_SETUP_OPTION
=true
782 CONFIGURE_OPTION
=true
783 MAKE_TARGET
='configure'
785 m
) # maintainer-clean
787 MAKE_TARGET
='clean_op'
791 TARGET_OPTION_ARG
="$OPTARG"
792 MAKE_TARGET
="$OPTARG"
799 echo "bootstrap.sh [options] optional_target ..."
807 echo "Option -$OPTARG requires an argument." >&2
811 echo "$0: error - unrecognized option $1" 1>&2
826 if [[ -d '.git' ]]; then
828 elif [[ -d '.bzr' ]]; then
830 elif [[ -d '.svn' ]]; then
832 elif [[ -d '.hg' ]]; then
836 if [[ -n "$VCS_CHECKOUT" ]]; then
843 # Set ENV MAKE in order to override "make"
844 if [[ -z "$MAKE" ]]; then
845 if command_exists gmake
; then
848 if command_exists
make; then
853 if [ "$VCS_CHECKOUT" ]; then
855 MAKE
="$MAKE --warn-undefined-variables"
864 if [[ -z "$GNU_BUILD_FLAGS" ]]; then
865 GNU_BUILD_FLAGS
="--install --force"
869 GNU_BUILD_FLAGS
="$GNU_BUILD_FLAGS --verbose"
872 if [ -z "$ACLOCAL_PATH" ]; then
873 ACLOCAL_PATH
="/usr/local/share/aclocal $ACLOCAL_PATH"
876 if [[ -z "$WARNINGS" ]]; then
877 if [[ -n "$VCS_CHECKOUT" ]]; then
884 if [[ -z "$LIBTOOLIZE" ]]; then
885 # If we are using OSX, we first check to see glibtoolize is available
886 if [[ "$VENDOR_DISTRIBUTION" == "darwin" ]]; then
887 LIBTOOLIZE
=`type -p glibtoolize`
889 if [[ -z "$LIBTOOLIZE" ]]; then
890 echo "Couldn't find glibtoolize, it is required on OSX"
895 # Test the ENV AUTOMAKE if it exists
896 if [[ -n "$AUTOMAKE" ]]; then
897 run
$AUTOMAKE '--help' &> /dev
/null || die
"Failed to run AUTOMAKE:$AUTOMAKE"
900 # Test the ENV AUTOCONF if it exists
901 if [[ -n "$AUTOCONF" ]]; then
902 run
$AUTOCONF '--help' &> /dev
/null || die
"Failed to run AUTOCONF:$AUTOCONF"
905 # Test the ENV AUTOHEADER if it exists
906 if [[ -n "$AUTOHEADER" ]]; then
907 run
$AUTOHEADER '--help' &> /dev
/null || die
"Failed to run AUTOHEADER:$AUTOHEADER"
910 # Test the ENV AUTOM4TE if it exists
911 if [[ -n "$AUTOM4TE" ]]; then
912 run
$AUTOM4TE '--help' &> /dev
/null || die
"Failed to run AUTOM4TE:$AUTOM4TE"
915 if [[ -z "$AUTORECONF" ]]; then
916 AUTORECONF
=`type -p autoreconf`
918 if [[ -z "$AUTORECONF" ]]; then
919 die
"Couldn't find autoreconf"
922 if [[ -n "$GNU_BUILD_FLAGS" ]]; then
923 AUTORECONF
="$AUTORECONF $GNU_BUILD_FLAGS"
927 run
$AUTORECONF '--help' &> /dev
/null || die
"Failed to run AUTORECONF:$AUTORECONF"
932 saved_debug_status
=$DEBUG
937 echo '----------------------------------------------'
939 echo "AUTORECONF=$AUTORECONF"
940 echo "HOST_OS=$HOST_OS"
943 if $AUTORECONF_OPTION; then
947 if $CLEAN_OPTION; then
951 if $CONFIGURE_OPTION; then
955 if $DEBUG_OPTION; then
959 if $PRINT_SETUP_OPTION; then
963 if $TARGET_OPTION; then
964 echo "--target=$TARGET_OPTION_ARG"
967 if $VERBOSE_OPTION; then
971 if [[ -n "$MAKE" ]]; then
975 if [[ -n "$MAKE_TARGET" ]]; then
976 echo "MAKE_TARGET=$MAKE_TARGET"
979 if [[ -n "$PREFIX" ]]; then
980 echo "PREFIX=$PREFIX"
983 if [[ -n "$TESTS_ENVIRONMENT" ]]; then
984 echo "TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT"
987 if [[ -n "$VCS_CHECKOUT" ]]; then
988 echo "VCS_CHECKOUT=$VCS_CHECKOUT"
999 if [[ -n "$WARNINGS" ]]; then
1000 echo "WARNINGS=$WARNINGS"
1002 echo '----------------------------------------------'
1004 if $saved_debug_status; then
1009 make_clean_option
()
1011 run_configure_if_required
1013 make_maintainer_clean
1015 if [[ "$VCS_CHECKOUT" == 'git' ]]; then
1016 run
"$VCS_CHECKOUT" status
--ignored
1017 elif [[ -n "$VCS_CHECKOUT" ]]; then
1018 run
"$VCS_CHECKOUT" status
1022 make_for_autoreconf
()
1024 if [ -f 'Makefile' ]; then
1025 make_maintainer_clean
1030 assert_no_file
'Makefile'
1079 die
"Unknown MAKE_TARGET option: $1"
1084 function bootstrap
()
1086 determine_target_platform
1090 # Set up whatever we need to do to use autoreconf later
1093 if [ -z "$MAKE_TARGET" ]; then
1094 MAKE_TARGET
="make_default"
1097 if $PRINT_SETUP_OPTION -o $DEBUG; then
1102 # Exit if all we were looking for were the currently used options
1103 if $PRINT_SETUP_OPTION; then
1108 # Use OLD_TESTS_ENVIRONMENT for tracking the state of the variable
1109 local OLD_TESTS_ENVIRONMENT
=
1111 # Set ENV PREFIX in order to set --prefix for ./configure
1112 if [[ -n "$PREFIX" ]]; then
1113 push_PREFIX_ARG
$PREFIX
1116 # We should always have a target by this point
1119 local MAKE_TARGET_ARRAY
=($MAKE_TARGET)
1121 for target
in "${MAKE_TARGET_ARRAY[@]}"
1123 # If we are running inside of Jenkins, we want to only run some of the possible tests
1124 if $jenkins_build_environment; then
1125 check_make_target
$target
1167 make_for_continuus_integration
1170 run_configure_if_required
1171 make_target
"$target"
1179 # Variables we export
1180 declare -x VCS_CHECKOUT
=
1182 # Variables we control globally
1185 # Options for getopt
1186 local AUTORECONF_OPTION
=false
1187 local CLEAN_OPTION
=false
1188 local CONFIGURE_OPTION
=false
1189 local DEBUG_OPTION
=false
1190 local PRINT_SETUP_OPTION
=false
1191 local TARGET_OPTION
=false
1192 local TARGET_OPTION_ARG
=
1193 local VERBOSE_OPTION
=false
1195 # If we call autoreconf on the platform or not
1196 local AUTORECONF_REBUILD_HOST
=false
1197 local AUTORECONF_REBUILD
=false
1199 local -r top_srcdir
=`pwd`
1201 # Variables for determine_target_platform () and rebuild_host_os ()
1202 # UNAME_MACHINE_ARCH= uname -m
1203 # VENDOR= apple, redhat, centos, canonical
1205 # RHEL{rhel,Tikanga,Santiago}
1206 # Ubuntu{ubuntu,Lucid,Maverick,Natty,Oneiric,Precise,Quantal}
1207 # Fedora{fedora,Verne,Beefy}
1208 # OSX{osx,lion,snow,mountain}
1209 # VENDOR_DISTRIBUTION= darwin,fedora,rhel,ubuntu
1210 # UNAME_KERNEL= Linux, Darwin,...
1211 # UNAME_KERNEL_RELEASE= Linux, Darwin,...
1212 local UNAME_MACHINE_ARCH
=unknown
1213 local VENDOR
=unknown
1214 local VENDOR_RELEASE
=unknown
1215 local VENDOR_DISTRIBUTION
=unknown
1216 local UNAME_KERNEL
=unknown
1217 local UNAME_KERNEL_RELEASE
=unknown
1220 rebuild_host_os no_output
1222 parse_command_line_options $@
1224 # If we are running under Jenkins we predetermine what tests we will run against
1225 # This MAKE_TARGET can be overridden by parse_command_line_options based MAKE_TARGET changes.
1226 # We don't want Jenkins overriding other variables, so we NULL them.
1227 if [ -z "$MAKE_TARGET" -a $jenkins_build_environment ]; then
1228 MAKE_TARGET
='jenkins'
1242 local caller_loc
=`caller`
1244 echo "$caller_loc Enabling debug: $1"
1246 echo "$caller_loc Enabling debug"
1259 # Script begins here
1261 env_debug_enabled
=false
1262 if [[ -n "$JENKINS_HOME" ]]; then
1263 declare -r jenkins_build_environment
=true
1265 declare -r jenkins_build_environment
=false
1274 export GNU_BUILD_FLAGS
1276 export TESTS_ENVIRONMENT
1282 export MallocGuardEdges
1283 export MallocErrorAbort
1284 export MallocScribble
1288 # We check for DEBUG twice, once before we source the config file, and once afterward
1289 env_debug_enabled
=false
1290 if [[ -n "$DEBUG" ]]; then
1291 env_debug_enabled
=true
1296 # Variables which only can be set by .bootstrap
1297 BOOTSTRAP_SNAPSHOT
=false
1298 BOOTSTRAP_SNAPSHOT_CHECK
=
1300 if [ -f '.bootstrap' ]; then
1304 if $env_debug_enabled; then
1307 if [[ -n "$DEBUG" ]]; then
1308 enable_debug
"Enabling DEBUG from '.bootstrap'"
1313 # We do this in order to protect the case where DEBUG
1314 if ! $env_debug_enabled; then