124
154
# Valid values are: darwin,fedora,rhel,ubuntu
125
set_VENDOR_DISTRIBUTION ()
155
function set_VENDOR_DISTRIBUTION ()
127
157
local dist=`echo "$1" | tr '[A-Z]' '[a-z]'`
252
282
die "Programmer error, we entered run_configure with a stacked directory"
285
if ! command_exists "$CONFIGURE"; then
286
die "$CONFIGURE does not exist"
255
289
local BUILD_DIR="$1"
256
290
if [[ -n "$BUILD_DIR" ]]; then
257
291
rm -r -f $BUILD_DIR
262
296
# Arguments for configure
297
local BUILD_CONFIGURE_ARG=
265
299
# Set ENV DEBUG in order to enable debugging
267
CONFIGURE_ARG='--enable-debug'
301
BUILD_CONFIGURE_ARG='--enable-debug'
270
304
# Set ENV ASSERT in order to enable assert
271
305
if [[ -n "$ASSERT" ]]; then
272
306
local ASSERT_ARG=
273
307
ASSERT_ARG='--enable-assert'
274
CONFIGURE_ARG="$ASSERT_ARG $CONFIGURE_ARG"
308
BUILD_CONFIGURE_ARG="$ASSERT_ARG $BUILD_CONFIGURE_ARG"
311
if [[ -n "$CONFIGURE_ARG" ]]; then
312
BUILD_CONFIGURE_ARG= "$BUILD_CONFIGURE_ARG $CONFIGURE_ARG"
277
316
# 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"
319
CC=clang CXX=clang++ $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=clang CXX=clang++ configure $BUILD_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"
323
command_exists 'gcc44' || die "Could not locate gcc44"
324
CC=gcc44 CXX=gcc44 $top_srcdir/configure $BUILD_CONFIGURE_ARG $PREFIX_ARG || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG $PREFIX_ARG"
287
$top_srcdir/configure $CONFIGURE_ARG $PREFIX_ARG || die "Cannot execute configure $CONFIGURE_ARG $PREFIX_ARG"
328
$CONFIGURE $BUILD_CONFIGURE_ARG $PREFIX_ARG
333
if [ $ret -ne 0 ]; then
334
die "Could not execute $CONFIGURE $BUILD_CONFIGURE_ARG $PREFIX_ARG"
291
337
if [ ! -f 'Makefile' ]; then
292
die "Programmer error, configure was run but no Makefile existed afterward"
338
die "Programmer error, configure was run but no Makefile existed after $CONFIGURE was run"
296
setup_gdb_command () {
342
function setup_gdb_command () {
297
343
GDB_TMPFILE=$(mktemp /tmp/gdb.XXXXXXXXXX)
298
344
echo 'set logging overwrite on' > $GDB_TMPFILE
299
345
echo 'set logging on' >> $GDB_TMPFILE
304
350
GDB_COMMAND="gdb -f -batch -x $GDB_TMPFILE"
307
setup_valgrind_command () {
353
function setup_valgrind_command () {
308
354
VALGRIND_PROGRAM=`type -p valgrind`
309
355
if [[ -n "$VALGRIND_PROGRAM" ]]; then
310
356
VALGRIND_COMMAND="$VALGRIND_PROGRAM --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE"
360
function save_BUILD ()
362
if [[ -n "$OLD_CONFIGURE" ]]; then
363
die "OLD_CONFIGURE($OLD_CONFIGURE) was set on push, programmer error!"
366
if [[ -n "$OLD_CONFIGURE_ARG" ]]; then
367
die "OLD_CONFIGURE_ARG($OLD_CONFIGURE_ARG) was set on push, programmer error!"
370
if [[ -n "$OLD_MAKE" ]]; then
371
die "OLD_MAKE($OLD_MAKE) was set on push, programmer error!"
374
if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
375
die "OLD_TESTS_ENVIRONMENT($OLD_TESTS_ENVIRONMENT) was set on push, programmer error!"
378
if [[ -n "$CONFIGURE" ]]; then
379
OLD_CONFIGURE=$CONFIGURE
382
if [[ -n "$CONFIGURE_ARG" ]]; then
383
OLD_CONFIGURE_ARG=$CONFIGURE_ARG
386
if [[ -n "$MAKE" ]]; then
390
if [[ -n "$TESTS_ENVIRONMENT" ]]; then
391
OLD_TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT
395
function restore_BUILD ()
397
if [[ -n "$OLD_CONFIGURE" ]]; then
398
CONFIGURE=$OLD_CONFIGURE
401
if [[ -n "$OLD_CONFIGURE_ARG" ]]; then
402
CONFIGURE_ARG=$OLD_CONFIGURE_ARG
405
if [[ -n "$OLD_MAKE" ]]; then
409
if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
410
TESTS_ENVIRONMENT=$OLD_TESTS_ENVIRONMENT
416
OLD_TESTS_ENVIRONMENT=
417
echo "reset happened"
420
function push_PREFIX_ARG ()
422
if [[ -n "$OLD_PREFIX_ARG" ]]; then
423
die "OLD_PREFIX_ARG was set on push, programmer error!"
316
426
if [[ -n "$PREFIX_ARG" ]]; then
317
427
OLD_PREFIX_ARG=$PREFIX_ARG
436
function pop_PREFIX_ARG ()
328
438
if [[ -n "$OLD_PREFIX_ARG" ]]; then
329
PREFIX_ARG=$OLD_TESTS_ENVIRONMENT
439
PREFIX_ARG=$OLD_PREFIX_ARG
336
push_TESTS_ENVIRONMENT ()
446
function push_TESTS_ENVIRONMENT ()
338
448
if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
339
449
die "OLD_TESTS_ENVIRONMENT was set on push, programmer error!"
501
function make_for_mingw32 ()
611
function check_mingw ()
613
command_exists 'mingw64-configure'
615
if [ "$ret" -ne 0 ]; then
619
command_exists 'mingw64-make'
621
if [ "$ret" -ne 0 ]; then
628
function make_skeleton_mingw ()
633
if [ $ret -eq 0 ]; then
634
assert_file 'Makefile'
636
make_target 'all' 'warn'
638
if [ $ret -ne 0 ]; then
641
if [[ -n "$DISPLAY" ]]; then
642
if command_exists 'wine'; then
643
TESTS_ENVIRONMENT='wine'
645
elif command_exists 'wineconsole'; then
646
TESTS_ENVIRONMENT='wineconsole --backend=curses'
649
if [[ -n "$TESTS_ENVIRONMENT" ]]; then
650
make_target 'check' 'warn' || warn "$MAKE check failed"
655
if $jenkins_build_environment; then
656
make_target 'clean' 'warn'
663
function make_for_mingw ()
666
if ! check_mingw; then
667
die 'mingw64 tools were not found'
503
670
# Make sure it is clean
504
671
if [ -f Makefile -o -f configure ]; then
505
672
make_maintainer_clean
507
assert_no_file 'Makefile'
509
if command_exists mingw32-configure; then
512
mingw32-configure || die 'mingw32-configure failed'
513
assert_file 'Makefile'
515
if command_exists mingw32-make; then
516
mingw32-make || die 'mingw32-make failed'
679
CONFIGURE='mingw64-configure'
681
CONFIGURE_ARGS='--enable-static'
521
691
# If we are locally testing, we should make sure the environment is setup correctly
631
805
eval "./bootstrap.sh maintainer-clean" || die "failed 'maintainer-clean'"
808
function make_install_html ()
810
run_configure_if_required
811
assert_file 'configure'
813
make_target 'install-html'
634
816
function make_gdb ()
636
run_configure_if_required
638
if command_exists gdb; then
818
if command_exists 'gdb'; then
819
run_configure_if_required
640
821
push_TESTS_ENVIRONMENT
692
877
die "MAKE was not set"
696
run $MAKE $1 || return 1
698
run $MAKE $1 || die "Cannot execute $MAKE $1"
880
# $2 represents error or warn
884
if [ $ret -ne 0 ]; then
886
warn "Cannot execute $MAKE $1: $ret"
888
die "Cannot execute $MAKE $1: $ret"
702
895
function make_distcheck ()
707
900
function make_rpm ()
709
if [ -f 'rpm.am' -o -d 'rpm' ]; then
710
run_configure_if_required
902
if command_exists 'rpmbuild'; then
903
if [ -f 'rpm.am' -o -d 'rpm' ]; then
904
run_configure_if_required
907
if $jenkins_build_environment; then
717
917
run_configure_if_required
718
918
make_target 'maintainer-clean' 'no_error'
920
# Lets make sure we really cleaned up the environment
921
assert_no_file 'Makefile'
922
assert_no_file 'configure'
923
assert_no_directory 'autom4te.cache'
721
926
function make_check ()
869
1078
# Set ENV MAKE in order to override "make"
870
1079
if [[ -z "$MAKE" ]]; then
871
if command_exists gmake; then
1080
if command_exists 'gmake'; then
872
1081
MAKE=`type -p gmake`
874
if command_exists make; then
1083
if command_exists 'make'; then
875
1084
MAKE=`type -p make`
1249
1472
local TARGET_OPTION_ARG=
1250
1473
local VERBOSE_OPTION=false
1475
local OLD_CONFIGURE=
1476
local OLD_CONFIGURE_ARG=
1478
local OLD_TESTS_ENVIRONMENT=
1252
1480
# If we call autoreconf on the platform or not
1253
1481
local AUTORECONF_REBUILD_HOST=false
1254
1482
local AUTORECONF_REBUILD=false
1256
1484
local -r top_srcdir=`pwd`
1487
if [ -z "$CONFIGURE" ]; then
1488
CONFIGURE="$top_srcdir/configure"
1258
1492
# Variables for determine_target_platform () and rebuild_host_os ()
1259
1493
# UNAME_MACHINE_ARCH= uname -m
1260
1494
# VENDOR= apple, redhat, centos, canonical