2022-12-27 Paul Eggert <eggert@cs.ucla.edu>
+ Add --pull, --gen options to build-aux/bootstrap
+ This supports a single bootstrap script with --pull and --gen
+ options, as an alternative to separate autogen.sh and autopull.sh
+ and bootstrap-funclib.sh auxiliary files.
+ * top/bootstrap: With --version, also output library version.
+ Support update of package that has only the bootstrap script,
+ and not the other three files.
+
Support packages with just 'bootstrap'
* top/bootstrap: With --version, also output library version.
Support update of package that has only the bootstrap script,
and not the other three files.
+
* top/bootstrap-funclib.sh (scriptlibversion): Rename
from scriptversion. All uses changed. This way we
can distinguish script from script library versions.
# Bootstrap this package from checked-out sources.
-scriptversion=2022-12-27.05; # UTC
+scriptversion=2022-12-27.07; # UTC
# Copyright (C) 2003-2022 Free Software Foundation, Inc.
#
GNULIB_URL Cloneable URL of the gnulib repository.
Options:
+
+ --pull Do phase 1: pull files from network
+ --gen Do phase 2: generate from local files.
+ (The default is to do both phases.)
+
--gnulib-srcdir=DIRNAME specify the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
and history on your machine, and do not want
to waste your bandwidth downloading them again.
Defaults to \$GNULIB_REFDIR
+
--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
--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
# Parse options.
+# Whether to pull and generate.
+pull=false
+gen=false
+
# Whether to use copies instead of symlinks.
copy=false
echo "$copyright"
exit 0
;;
+ --pull)
+ pull=true;;
+ --gen)
+ gen=true;;
--gnulib-srcdir=*)
GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
--gnulib-refdir=*)
esac
done
+# Default is to do both.
+$pull || $gen || pull=true gen=true
+
$use_git || test -n "$GNULIB_SRCDIR" \
|| die "Error: --no-git requires \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option"
test -z "$GNULIB_SRCDIR" || test -d "$GNULIB_SRCDIR" \
export GNULIB_SRCDIR
export GNULIB_REFDIR
-if $use_git || test -z "$SKIP_PO"; then
+if $pull && { $use_git || test -z "$SKIP_PO"; }; then
autopull \
`if $bootstrap_sync; then echo ' --bootstrap-sync'; else echo ' --no-bootstrap-sync'; fi` \
`if test -z "$checkout_only_file"; then echo ' --force'; fi` \
|| die "could not fetch auxiliary files"
fi
-autogen \
+if $gen; then
+ autogen \
`if $copy; then echo ' --copy'; fi` \
`if test -z "$checkout_only_file"; then echo ' --force'; fi` \
|| die "could not generate auxiliary files"
+fi
# ----------------------------------------------------------------------------
In the cases (A) and (B), a ``git submodule'' is used to reference
the precise commit of the gnulib repository, so that each developer
-running @file{autopull.sh} will get the same version of all gnulib-provided
+running @samp{./bootstrap --pull} or @file{autopull.sh}
+will get the same version of all gnulib-provided
files.
The alternative is to always follow the newest Gnulib automatically.
@end smallexample
@item (B)
-In this approach, the @code{autopull.sh} program (see @ref{Developer tools})
-is used to aid a developer in using this setup. You copy this program and
-its companion files into your package and place them under version control.
-It can be customized using @file{bootstrap.conf} which you also put under
+In this approach, the @code{build-aux/bootstrap} or @code{autopull.sh}
+program (see @ref{Developer tools}) is used to aid a developer in
+using this setup. You copy this program (and if it's
+@code{autopull.sh}, its companion files) into your package and place
+the copy or copies under version control. The program can be
+customized using @file{bootstrap.conf} which you also put under
version control.
@item (C)
@node Utilities for Makefiles
@section Utilities for Makefiles
-These are a couple of programs that are often useful in Makefiles. Some
+These programs can be used in Makefiles. Some
of them are also described in
@ifinfo
@ref{Auxiliary Programs,,,automake}.
@node Developer tools
@section Programs for developing in Git checkouts
-These are a couple of programs that help when developing in a Git
+These programs can help when developing in a Git
checkout. The maintainer of the package copies these programs into the
version control of the package, so that co-developers can use these
tools right away.
@code{gnulib-tool} and @code{automake}, that generate files from other
files.
-@code{bootstrap} is a wrapper around both: It invokes @code{autopull.sh}
-and then immediately @code{autogen.sh}.@*
-Note: Because this program mixes version control management and
+@code{bootstrap} is a wrapper around both:
+@code{./bootstrap --pull} is equivalent to @code{./autopull.sh},
+@code{./bootstrap --gen} is equivalent to @code{./autogen.sh}.
+Plain @code{./bootstrap} is equivalent to @code{./autopull.sh}
+immediately followed by @code{./autogen.sh}; however, because plain
+@code{./bootstrap} mixes version control management and
generation of files in non-obvious ways, it has a number of usability
issues for the advanced developer.
All three programs make use of a configuration file, called
@code{bootstrap.conf}.
+@item build-aux/bootstrap
+This acts like @code{top/bootstrap}, except it does not
+need the companion files @code{autogen.sh},
+@code{autopull.sh}, and @code{bootstrap-funclib.sh}
+so it avoids some clutter in your project's top level directory.
+With this approach, you update via @code{./bootstrap --pull} and
+@code{./bootstrap --gen} instead of via @code{./autopull.sh} and
+@code{./autogen.sh}. Otherwise this approach acts similarly, and
+uses the same @code{bootstrap.conf} file.
+
@item build-aux/bootstrap.conf
This is the template configuration file. After copying it into the
top-level directory of your package, you need to customize it.
#! /bin/sh
# Bootstrap this package from checked-out sources.
-scriptversion=2022-12-27.05; # UTC
+scriptversion=2022-12-27.07; # UTC
# Copyright (C) 2003-2022 Free Software Foundation, Inc.
#
GNULIB_URL Cloneable URL of the gnulib repository.
Options:
+
+ --pull Do phase 1: pull files from network
+ --gen Do phase 2: generate from local files.
+ (The default is to do both phases.)
+
--gnulib-srcdir=DIRNAME specify the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
and history on your machine, and do not want
to waste your bandwidth downloading them again.
Defaults to \$GNULIB_REFDIR
+
--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
--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
# Parse options.
+# Whether to pull and generate.
+pull=false
+gen=false
+
# Whether to use copies instead of symlinks.
copy=false
echo "$copyright"
exit 0
;;
+ --pull)
+ pull=true;;
+ --gen)
+ gen=true;;
--gnulib-srcdir=*)
GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
--gnulib-refdir=*)
esac
done
+# Default is to do both.
+$pull || $gen || pull=true gen=true
+
$use_git || test -n "$GNULIB_SRCDIR" \
|| die "Error: --no-git requires \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option"
test -z "$GNULIB_SRCDIR" || test -d "$GNULIB_SRCDIR" \
export GNULIB_SRCDIR
export GNULIB_REFDIR
-if $use_git || test -z "$SKIP_PO"; then
+if $pull && { $use_git || test -z "$SKIP_PO"; }; then
autopull \
`if $bootstrap_sync; then echo ' --bootstrap-sync'; else echo ' --no-bootstrap-sync'; fi` \
`if test -z "$checkout_only_file"; then echo ' --force'; fi` \
|| die "could not fetch auxiliary files"
fi
-autogen \
+if $gen; then
+ autogen \
`if $copy; then echo ' --copy'; fi` \
`if test -z "$checkout_only_file"; then echo ' --force'; fi` \
|| die "could not generate auxiliary files"
+fi
# ----------------------------------------------------------------------------