From 51dacfb6d444a00fc31d56774a6ec88e6455ebc6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 19 Sep 2018 08:23:45 -0700 Subject: maint: update bootstrap * bootstrap: Copy from Gnulib. --- bootstrap | 257 ++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 151 insertions(+), 106 deletions(-) (limited to 'bootstrap') diff --git a/bootstrap b/bootstrap index 25920e99..fa9d7c94 100755 --- a/bootstrap +++ b/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh # Print a version string. -scriptversion=2017-09-19.08; # UTC +scriptversion=2018-07-25.07; # UTC # Bootstrap this package from checked-out sources. @@ -47,6 +47,8 @@ PERL="${PERL-perl}" me=$0 +default_gnulib_url=git://git.sv.gnu.org/gnulib + usage() { cat </dev/null; then - echo "$0: getting gnulib files..." - git submodule init -- "$gnulib_path" || exit $? - git submodule update -- "$gnulib_path" || exit $? + case ${GNULIB_SRCDIR--} in + -) + # Note that $use_git is necessarily true in this case. + if git_modules_config submodule.gnulib.url >/dev/null; then + echo "$0: getting gnulib files..." + git submodule init -- "$gnulib_path" || exit $? + git submodule update -- "$gnulib_path" || exit $? - elif [ ! -d "$gnulib_path" ]; then - echo "$0: getting gnulib files..." + elif [ ! -d "$gnulib_path" ]; then + echo "$0: getting gnulib files..." - trap cleanup_gnulib 1 2 13 15 + trap cleanup_gnulib 1 2 13 15 - shallow= - git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' - git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" || - cleanup_gnulib + shallow= + if test -z "$GNULIB_REVISION"; then + git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' + fi + git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \ + || cleanup_gnulib - trap - 1 2 13 15 - fi - GNULIB_SRCDIR=$gnulib_path - ;; -*) - # Use GNULIB_SRCDIR directly or as a reference. - if $use_git && test -d "$GNULIB_SRCDIR"/.git && \ - git_modules_config submodule.gnulib.url >/dev/null; then - echo "$0: getting gnulib files..." - if git submodule -h|grep -- --reference > /dev/null; then - # Prefer the one-liner available in git 1.6.4 or newer. - git submodule update --init --reference "$GNULIB_SRCDIR" \ - "$gnulib_path" || exit $? - else - # This fallback allows at least git 1.5.5. - if test -f "$gnulib_path"/gnulib-tool; then - # Since file already exists, assume submodule init already complete. - git submodule update -- "$gnulib_path" || exit $? + trap - 1 2 13 15 + fi + GNULIB_SRCDIR=$gnulib_path + ;; + *) + # Use GNULIB_SRCDIR directly or as a reference. + if $use_git && test -d "$GNULIB_SRCDIR"/.git && \ + git_modules_config submodule.gnulib.url >/dev/null; then + echo "$0: getting gnulib files..." + if git submodule -h|grep -- --reference > /dev/null; then + # Prefer the one-liner available in git 1.6.4 or newer. + git submodule update --init --reference "$GNULIB_SRCDIR" \ + "$gnulib_path" || exit $? else - # Older git can't clone into an empty directory. - rmdir "$gnulib_path" 2>/dev/null - git clone --reference "$GNULIB_SRCDIR" \ - "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \ - && git submodule init -- "$gnulib_path" \ - && git submodule update -- "$gnulib_path" \ - || exit $? + # This fallback allows at least git 1.5.5. + if test -f "$gnulib_path"/gnulib-tool; then + # Since file already exists, assume submodule init already complete. + git submodule update -- "$gnulib_path" || exit $? + else + # Older git can't clone into an empty directory. + rmdir "$gnulib_path" 2>/dev/null + git clone --reference "$GNULIB_SRCDIR" \ + "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \ + && git submodule init -- "$gnulib_path" \ + && git submodule update -- "$gnulib_path" \ + || exit $? + fi fi + GNULIB_SRCDIR=$gnulib_path fi - GNULIB_SRCDIR=$gnulib_path + ;; + esac + + if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \ + && ! git_modules_config submodule.gnulib.url >/dev/null; then + (cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib fi - ;; -esac -# $GNULIB_SRCDIR now points to the version of gnulib to use, and -# we no longer need to use git or $gnulib_path below here. + # $GNULIB_SRCDIR now points to the version of gnulib to use, and + # we no longer need to use git or $gnulib_path below here. + + if $bootstrap_sync; then + cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || { + echo "$0: updating bootstrap and restarting..." + case $(sh -c 'echo "$1"' -- a) in + a) ignored=--;; + *) ignored=ignored;; + esac + exec sh -c \ + 'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \ + $ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \ + "$0" "$@" --no-bootstrap-sync + } + fi -if $bootstrap_sync; then - cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || { - echo "$0: updating bootstrap and restarting..." - case $(sh -c 'echo "$1"' -- a) in - a) ignored=--;; - *) ignored=ignored;; - esac - exec sh -c \ - 'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \ - $ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \ - "$0" "$@" --no-bootstrap-sync - } + gnulib_tool=$GNULIB_SRCDIR/gnulib-tool + <$gnulib_tool || exit $? fi -gnulib_tool=$GNULIB_SRCDIR/gnulib-tool -<$gnulib_tool || exit $? - # Get translations. download_po_files() { @@ -898,32 +942,33 @@ fi # Import from gnulib. -gnulib_tool_options="\ - --import\ - --no-changelog\ - --aux-dir $build_aux\ - --doc-base $doc_base\ - --lib $gnulib_name\ - --m4-base $m4_base/\ - --source-base $source_base/\ - --tests-base $tests_base\ - --local-dir $local_gl_dir\ - $gnulib_tool_option_extras\ -" -if test $use_libtool = 1; then - case "$gnulib_tool_options " in - *' --libtool '*) ;; - *) gnulib_tool_options="$gnulib_tool_options --libtool" ;; - esac -fi -echo "$0: $gnulib_tool $gnulib_tool_options --import ..." -$gnulib_tool $gnulib_tool_options --import $gnulib_modules \ - || die "gnulib-tool failed" +if $use_gnulib; then + gnulib_tool_options="\ + --no-changelog\ + --aux-dir=$build_aux\ + --doc-base=$doc_base\ + --lib=$gnulib_name\ + --m4-base=$m4_base/\ + --source-base=$source_base/\ + --tests-base=$tests_base\ + --local-dir=$local_gl_dir\ + $gnulib_tool_option_extras\ + " + if test $use_libtool = 1; then + case "$gnulib_tool_options " in + *' --libtool '*) ;; + *) gnulib_tool_options="$gnulib_tool_options --libtool" ;; + esac + fi + echo "$0: $gnulib_tool $gnulib_tool_options --import ..." + $gnulib_tool $gnulib_tool_options --import $gnulib_modules \ + || die "gnulib-tool failed" -for file in $gnulib_files; do - symlink_to_dir "$GNULIB_SRCDIR" $file \ - || die "failed to symlink $file" -done + for file in $gnulib_files; do + symlink_to_dir "$GNULIB_SRCDIR" $file \ + || die "failed to symlink $file" + done +fi bootstrap_post_import_hook \ || die "bootstrap_post_import_hook failed" @@ -1020,7 +1065,7 @@ bootstrap_epilogue echo "$0: done. Now you can run './configure'." # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" -- cgit v1.2.1