X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/86996fca101c629ef197313a1058df26e01df950..121c498280f96b31a1f90e2012751509e6358a64:/bootstrap diff --git a/bootstrap b/bootstrap index 2b3f24b3..dcd47739 100755 --- a/bootstrap +++ b/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh # Print a version string. -scriptversion=2010-10-08.16; # UTC +scriptversion=2010-11-20.03; # UTC # Bootstrap this package from checked-out sources. @@ -54,6 +54,12 @@ Options: have gnulib sources on your machine, and do not want to waste your bandwidth downloading them again. Defaults to \$GNULIB_SRCDIR. + --bootstrap-sync If this bootstrap script is not identical to + the version in the local gnulib sources, + update this script, and then restart it with + /bin/sh or the shell \$CONFIG_SHELL if + defined. + --no-bootstrap-sync Do not check whether bootstrap is out of sync. --copy Copy files instead of creating symbolic links. --force Attempt to bootstrap even if the sources seem not to have been checked out. @@ -168,6 +174,10 @@ copy=false # on which version control system (if any) is used in the source directory. vc_ignore=auto +# Set this to true in bootstrap.conf to enable --bootstrap-sync by +# default. +bootstrap_sync=false + # find_tool ENVVAR NAMES... # ------------------------- # Search for a required program. Use the value of ENVVAR, if set, @@ -239,6 +249,10 @@ do checkout_only_file=;; --copy) copy=true;; + --bootstrap-sync) + bootstrap_sync=true;; + --no-bootstrap-sync) + bootstrap_sync=false;; *) echo >&2 "$0: $option: unknown option" exit 1;; @@ -261,6 +275,21 @@ insert_sorted_if_absent() { || exit 1 } +# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with +# insert_sorted_if_absent. +insert_vc_ignore() { + vc_ignore_file="$1" + pattern="$2" + case $vc_ignore_file in + *.gitignore) + # A .gitignore entry that does not start with `/' applies + # recursively to subdirectories, so prepend `/' to every + # .gitignore entry. + pattern=`echo "$pattern" | sed s,^,/,`;; + esac + insert_sorted_if_absent "$vc_ignore_file" "$pattern" +} + # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac. found_aux_dir=no grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \ @@ -279,7 +308,7 @@ if test ! -d $build_aux; then mkdir $build_aux for dot_ig in x $vc_ignore; do test $dot_ig = x && continue - insert_sorted_if_absent $dot_ig $build_aux + insert_vc_ignore $dot_ig $build_aux done fi @@ -329,17 +358,18 @@ get_version() { $app --version >/dev/null 2>&1 || return 1 $app --version 2>&1 | - sed -n '# extract version within line - s/.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/ - t done + sed -n '# Move version to start of line. + s/.*[v ]\([0-9]\)/\1/ - # extract version at start of line - s/^\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/ - t done + # Skip lines that do not start with version. + /^[0-9]/!d - d + # Remove characters after the version. + s/[^.a-z0-9-].*// + + # The first component must be digits only. + s/^\([0-9]*\)[a-z-].*/\1/ - :done #the following essentially does s/5.005/5.5/ s/\.0*\([1-9]\)/.\1/g p @@ -485,6 +515,16 @@ case ${GNULIB_SRCDIR--} in ;; esac +if $bootstrap_sync; then + cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || { + echo "$0: updating bootstrap and restarting..." + exec sh -c \ + 'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \ + -- "$GNULIB_SRCDIR/build-aux/bootstrap" \ + "$0" "$@" --no-bootstrap-sync + } +fi + gnulib_tool=$GNULIB_SRCDIR/gnulib-tool <$gnulib_tool || exit @@ -565,7 +605,7 @@ symlink_to_dir() for dot_ig in x $vc_ignore; do test $dot_ig = x && continue ig=$parent/$dot_ig - insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'` + insert_vc_ignore $ig `echo "$dst_dir"|sed 's,.*/,,'` done fi @@ -725,7 +765,7 @@ slurp() { test $dot_ig = x && continue ig=$dir/$dot_ig if test -n "$copied"; then - insert_sorted_if_absent $ig "$copied" + insert_vc_ignore $ig "$copied" # If an ignored file name ends with .in.h, then also add # the name with just ".h". Many gnulib headers are generated, # e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc. @@ -738,12 +778,12 @@ slurp() { s/\.gperf$/.h/ ' ` - insert_sorted_if_absent $ig "$f" + insert_vc_ignore $ig "$f" # For files like sys_stat.in.h and sys_time.in.h, record as # ignorable the directory we might eventually create: sys/. f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'` - insert_sorted_if_absent $ig "$f" + insert_vc_ignore $ig "$f" fi done done