~brianaker/libmemcached/merge-of-1.0

« back to all changes in this revision

Viewing changes to bootstrap.sh

  • Committer: Brian Aker
  • Date: 2013-05-04 09:20:42 UTC
  • mfrom: (1079.30.26 libmemcached-1.0)
  • mto: This revision was merged to the branch mainline in revision 1103.
  • Revision ID: brian@tangent.org-20130504092042-tuaolr38te8qhwmu
Mergre 1.0 tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
188
188
function set_VENDOR_RELEASE ()
189
189
{
190
190
  local release=`echo "$1" | tr '[A-Z]' '[a-z]'`
191
 
  case "$VENDOR_DISTRIBUTION" in
 
191
 
 
192
  if $DEBUG; then 
 
193
    echo "VENDOR_DISTRIBUTION:$VENDOR_DISTRIBUTION"
 
194
    echo "VENDOR_RELEASE:$release"
 
195
  fi
 
196
 
 
197
  case $VENDOR_DISTRIBUTION in
192
198
    darwin)
193
 
      case "$VENDOR_DISTRIBUTION" in
 
199
      case $release in
194
200
        10.6*)
195
201
          VENDOR_RELEASE='snow_leopard'
196
202
          ;;
200
206
        mountain)
201
207
          VENDOR_RELEASE='mountain'
202
208
          ;;
203
 
        10.8*)
 
209
        10.8.*)
 
210
          echo "mountain_lion"
204
211
          VENDOR_RELEASE='mountain_lion'
205
212
          ;;
206
213
        *)
 
214
          echo $VENDOR_RELEASE
207
215
          VENDOR_RELEASE='unknown'
208
216
          ;;
209
217
      esac
226
234
        VENDOR_RELEASE="precise"
227
235
      elif [[ "x$VENDOR_RELEASE" == 'x12.10' ]]; then
228
236
        VENDOR_RELEASE="quantal"
 
237
      elif [[ "x$VENDOR_RELEASE" == 'x13.04' ]]; then
 
238
        VENDOR_RELEASE="raring"
229
239
      fi
230
240
      ;;
231
241
    opensuse)
375
385
  local BUILD_CONFIGURE_ARG= 
376
386
 
377
387
  # If ENV DEBUG is set we enable both debug and asssert, otherwise we see if this is a VCS checkout and if so enable assert
378
 
  # Set ENV ASSERT in order to enable assert
379
 
  if $DEBUG; then 
380
 
    BUILD_CONFIGURE_ARG+=' --enable-debug --enable-assert'
381
 
  elif [[ -n "$VCS_CHECKOUT" ]]; then
382
 
    BUILD_CONFIGURE_ARG+=' --enable-assert'
 
388
  # Set ENV ASSERT in order to enable assert.
 
389
  # If we are doing a valgrind run, we always compile with assert disabled
 
390
  if $valgrind_run; then
 
391
    BUILD_CONFIGURE_ARG+= '--enable-assert=no'
 
392
  else
 
393
    if $DEBUG; then 
 
394
      BUILD_CONFIGURE_ARG+=' --enable-debug --enable-assert'
 
395
    elif [[ -n "$VCS_CHECKOUT" ]]; then
 
396
      BUILD_CONFIGURE_ARG+=' --enable-assert'
 
397
    fi
383
398
  fi
384
399
 
385
400
  if [[ -n "$CONFIGURE_ARG" ]]; then 
431
446
function setup_valgrind_command () {
432
447
  VALGRIND_PROGRAM=`type -p valgrind`
433
448
  if [[ -n "$VALGRIND_PROGRAM" ]]; then
434
 
    VALGRIND_COMMAND="$VALGRIND_PROGRAM --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE"
 
449
    VALGRIND_COMMAND="$VALGRIND_PROGRAM --error-exitcode=1 --leak-check=yes --malloc-fill=A5 --free-fill=DE --xml=yes --xml-file=\"valgrind-%p.xml\""
435
450
  fi
436
451
}
437
452
 
531
546
 
532
547
function make_valgrind ()
533
548
{
534
 
  if [[ "$VENDOR_DISTRIBUTION" == 'darwin' ]]; then
535
 
    make_darwin_malloc
536
 
    return
537
 
  fi
538
 
 
539
549
  # If the env VALGRIND_COMMAND is set then we assume it is valid
540
550
  local valgrind_was_set=false
541
551
  if [[ -z "$VALGRIND_COMMAND" ]]; then
555
565
 
556
566
  save_BUILD
557
567
 
 
568
  valgrind_run=true
 
569
 
558
570
  # If we are required to run configure, do so now
559
 
  run_configure_if_required
 
571
  run_configure
560
572
 
561
573
  # If we don't have a configure, then most likely we will be missing libtool
562
574
  assert_file 'configure'
563
 
  if [[ -f 'libtool' ]]; then
 
575
  if [[ -x 'libtool' ]]; then
564
576
    TESTS_ENVIRONMENT="./libtool --mode=execute $VALGRIND_COMMAND"
565
577
  else
566
578
    TESTS_ENVIRONMENT="$VALGRIND_COMMAND"
567
579
  fi
568
580
 
569
 
  make_target 'check' || return 1
 
581
  make_target 'all'
 
582
  make_target 'check'
 
583
  ret=$?
 
584
 
 
585
  # If we aren't going to error, we will clean up our environment
 
586
  if [ "$ret" -eq 0 ]; then
 
587
     make 'distclean'
 
588
  fi
 
589
 
 
590
  valgrind_run=false
570
591
 
571
592
  restore_BUILD
 
593
 
 
594
  if [ "$ret" -ne 0 ]; then
 
595
    return 1
 
596
  fi
572
597
}
573
598
 
574
599
function make_install_system ()
619
644
  MallocScribble=$old_MallocScribble
620
645
}
621
646
 
622
 
function snapshot_check ()
623
 
{
624
 
  if [ ! -f "$BOOTSTRAP_SNAPSHOT_CHECK" ]; then
625
 
    make_for_snapshot
626
 
  fi
627
 
 
628
 
  if [ -n "$BOOTSTRAP_SNAPSHOT_CHECK" ]; then
629
 
    assert_file "$BOOTSTRAP_SNAPSHOT_CHECK" 'snapshot check failed'
630
 
  fi
631
 
}
632
 
 
633
647
# This will reset our environment, and make sure built files are available.
634
648
function make_for_snapshot ()
635
649
{
636
 
  # Make sure it is clean
637
 
  make_maintainer_clean
 
650
  # Lets make sure we have a clean environment
 
651
  assert_no_file 'Makefile'
 
652
  assert_no_file 'configure'
 
653
  assert_no_directory 'autom4te.cache'
638
654
 
639
655
  run_configure
640
 
  make_target 'dist'
 
656
  make_target 'all'
641
657
  make_target 'distclean'
642
658
 
643
659
  # We should have a configure, but no Makefile at the end of this exercise
644
660
  assert_no_file 'Makefile'
645
661
  assert_exec_file 'configure'
646
 
 
647
 
  snapshot_check
648
662
}
649
663
 
650
664
function check_mingw ()
813
827
function check_for_jenkins ()
814
828
{
815
829
  if ! $jenkins_build_environment; then
816
 
    echo "Not inside of jenkins"
 
830
    echo "Not inside of jenkins, simulating environment"
817
831
 
818
832
    if [ -f 'configure' ]; then
819
833
      make_maintainer_clean
842
856
  make_install_system
843
857
}
844
858
 
 
859
function check_snapshot ()
 
860
{
 
861
  if [ -n "$BOOTSTRAP_SNAPSHOT_CHECK" ]; then
 
862
    assert_file "$BOOTSTRAP_SNAPSHOT_CHECK" 'snapshot check failed'
 
863
  fi
 
864
}
 
865
 
845
866
function make_for_continuus_integration ()
846
867
{
847
868
  # Setup the environment if we are local
853
874
  # Platforms which require bootstrap should have some setup done before we hit this stage.
854
875
  # If we are building locally, skip this step, unless we are just testing locally. 
855
876
  if $BOOTSTRAP_SNAPSHOT; then
856
 
    snapshot_check
 
877
    if $BOOTSTRAP_SNAPSHOT; then
 
878
      assert_file 'configure'
 
879
    fi
 
880
 
 
881
    check_snapshot
857
882
  else
858
883
    # If we didn't require a snapshot, then we should not have a configure
859
884
    assert_no_file 'configure'
864
889
  assert_no_file 'Makefile' 'Programmer error, Makefile existed where build state should have been clean'
865
890
 
866
891
  case $HOST_OS in
867
 
    *-fedora-*)
868
 
      run_configure
869
 
 
870
 
      assert_exec_file 'configure'
871
 
      assert_file 'Makefile'
872
 
 
873
 
      make_target 'all'
874
 
 
875
 
      # make rpm includes "make distcheck"
876
 
      if [[ -f rpm.am ]]; then
877
 
        make_rpm
878
 
      elif [[ -d rpm ]]; then
879
 
        make_rpm
880
 
      else
881
 
        make_distcheck
882
 
      fi
883
 
 
884
 
      assert_exec_file 'configure'
885
 
      assert_file 'Makefile'
886
 
 
887
 
      make_install_system
888
 
      ;;
889
 
    *-precise-*)
890
 
      run_configure
891
 
 
892
 
      assert_exec_file 'configure'
893
 
      assert_file 'Makefile'
894
 
 
895
 
      make_target 'all'
896
 
 
897
 
      make_distcheck
898
 
 
899
 
      assert_exec_file 'configure'
900
 
      assert_file 'Makefile'
901
 
 
902
 
      make_valgrind
903
 
 
904
 
      assert_exec_file 'configure'
905
 
      assert_file 'Makefile'
906
 
 
907
 
      make_install_system
908
 
      ;;
909
892
    *)
910
893
      make_jenkins_default
911
894
      ;;
1102
1085
    run $BOOTSTRAP_LIBTOOLIZE '--copy' '--install' '--force' || die "Cannot execute $BOOTSTRAP_LIBTOOLIZE"
1103
1086
  fi
1104
1087
 
1105
 
  run $AUTORECONF || die "Cannot execute $AUTORECONF"
 
1088
  run $AUTORECONF $AUTORECONF_ARGS || die "Cannot execute $AUTORECONF"
1106
1089
 
1107
1090
  eval 'bash -n configure' || die "autoreconf generated a malformed configure"
1108
1091
}
1283
1266
        fi
1284
1267
      fi
1285
1268
    fi
 
1269
 
1286
1270
    if $VERBOSE; then
1287
1271
      LIBTOOLIZE_OPTIONS="--verbose $BOOTSTRAP_LIBTOOLIZE_OPTIONS"
1288
1272
    fi
 
1273
 
1289
1274
    if $DEBUG; then
1290
1275
      LIBTOOLIZE_OPTIONS="--debug $BOOTSTRAP_LIBTOOLIZE_OPTIONS"
1291
1276
    fi
 
1277
 
 
1278
    # Here we set LIBTOOLIZE to true since we are going to invoke it via BOOTSTRAP_LIBTOOLIZE
1292
1279
    LIBTOOLIZE=true
1293
1280
  fi
1294
1281
 
1326
1313
    fi
1327
1314
 
1328
1315
    if [[ -n "$GNU_BUILD_FLAGS" ]]; then
1329
 
      AUTORECONF="$AUTORECONF $GNU_BUILD_FLAGS"
 
1316
      AUTORECONF_ARGS="$GNU_BUILD_FLAGS"
1330
1317
    fi
1331
1318
  fi
1332
1319
 
1553
1540
    fi
1554
1541
 
1555
1542
    local snapshot_run=false
 
1543
    local valgrind_run=false
1556
1544
 
1557
1545
    case $target in
1558
1546
      'self')
1612
1600
      'snapshot')
1613
1601
        make_for_snapshot
1614
1602
        snapshot_run=true
 
1603
        check_snapshot
1615
1604
        ;;
1616
1605
      'rpm')
1617
1606
        make_rpm
1618
1607
        ;;
 
1608
      'darwin_malloc')
 
1609
        make_darwin_malloc
 
1610
        ;;
1619
1611
      'valgrind')
 
1612
        make_maintainer_clean 
1620
1613
        make_valgrind
1621
1614
        ;;
1622
1615
      'universe')
1711
1704
          MAKE_TARGET="$label"
1712
1705
        fi
1713
1706
      fi
 
1707
      if [[ -n "$LABEL" ]]; then
 
1708
        check_make_target $LABEL
 
1709
        if [ $? -eq 0 ]; then
 
1710
          MAKE_TARGET="$LABEL"
 
1711
        fi
 
1712
      fi
1714
1713
 
1715
1714
      if [ -z "$MAKE_TARGET" ]; then
1716
1715
        MAKE_TARGET='jenkins'