* top/bootstrap-funclib.sh (bootstrap_srcdirs_hook): Define a hook for user-specified submodule directory paths. * top/bootstrap: Call bootstrap_srcdirs_hook after setting up GNULIB_SRCDIR. * top/autogen.sh: Likewise. * top/autopull.sh: Likewise. * build-aux/bootstrap: Regenerate. --- Hi there,
While updating Gnulib in poke, I ran into a slight hurdle: there was no exact way to add setup for non-Gnulib SRCDIR variables (such as that of Jitter, which integrates in the poke build system similarly to how Gnulib does). The solution proposed here lets Jitter be integrated via: # Set up the Jitter path. bootstrap_srcdirs_hook () { # Pass JITTER_SRCDIR to subprocesses. export JITTER_SRCDIR # We already have something. Don't touch it. test -n "$JITTER_SRCDIR" && return 0 case "$me" in *autogen.sh*) # If we're in autogen, we want to simply default to ./jitter, since # that's the common default when just regenerating. : "${JITTER_SRCDIR:=jitter}" ;; *autopull.sh*|*bootstrap*) # However, if also pulling, we want the use_git logic. $use_git || test -n "$JITTER_SRCDIR" \ || die "Error: --no-git requires \$JITTER_SRCDIR environment variable or --jitter-srcdir option" $use_git && : "${JITTER_SRCDIR:=jitter}" # A reasonable default. test -z "$JITTER_SRCDIR" || test -d "$JITTER_SRCDIR" \ || die "Error: \$JITTER_SRCDIR environment variable or --jitter-srcdir option is specified, but does not denote a directory" ;; esac } ... and the existing post-import hooks, plus the post-pull hook that Bruno recommended here: https://lists.gnu.org/archive/html/poke-devel/2022-07/msg00098.html I'm still not sure how I feel about that default in the autogen.sh case, though. Maybe we should go with some other idiom? Or maybe I overlooked some existing way to properly add Jitter to bootstrap? I reckon it's good enough, since it should match with what autopull decides by default (and the default is use_git=true). WDYT? Thanks, have a great day. ChangeLog | 11 +++++++++++ build-aux/bootstrap | 13 ++++++++----- top/autogen.sh | 4 ++++ top/autopull.sh | 4 ++++ top/bootstrap | 3 +++ top/bootstrap-funclib.sh | 7 +++++++ 6 files changed, 37 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36825874d..58be71b45 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2022-11-27 Arsen Arsenović <ar...@aarsen.me> + + bootstrap: Provide a hook for submodule _SRCDIR setup + * top/bootstrap-funclib.sh (bootstrap_srcdirs_hook): Define a hook + for user-specified submodule directory paths. + * top/bootstrap: Call bootstrap_srcdirs_hook after setting up + GNULIB_SRCDIR. + * top/autogen.sh: Likewise. + * top/autopull.sh: Likewise. + * build-aux/bootstrap: Regenerate. + 2022-11-26 Paul Eggert <egg...@cs.ucla.edu> Prefer "kill -INT" to killing with a number diff --git a/build-aux/bootstrap b/build-aux/bootstrap index 341d05d57..31ded443d 100755 --- a/build-aux/bootstrap +++ b/build-aux/bootstrap @@ -30,7 +30,7 @@ # Please report bugs or propose patches to bug-gnulib@gnu.org. -scriptversion=2022-07-24.15; # UTC +scriptversion=2022-07-29.23; # UTC me="$0" medir=`dirname "$me"` @@ -147,6 +147,10 @@ bootstrap_post_import_hook() { :; } # Override it via your own definition in bootstrap.conf. bootstrap_epilogue() { :; } +# A function to be called after setting GNULIB_SRCDIR, but before anything +# else, so that they user may define their own *_SRCDIR variables. +bootstrap_srcdirs_hook() { :; } + # The command to download all .po files for a specified domain into a # specified directory. Fill in the first %s with the destination # directory and the second with the domain name. @@ -657,10 +661,6 @@ Options: 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 - --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 @@ -768,6 +768,9 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then die "Bootstrapping from a non-checked-out distribution is risky." fi +# Now, call the users _SRCDIR setups. +bootstrap_srcdirs_hook + check_build_prerequisites $use_git if ! test -f "$medir"/bootstrap-funclib.sh; then diff --git a/top/autogen.sh b/top/autogen.sh index 81db3fe03..49417c5bd 100755 --- a/top/autogen.sh +++ b/top/autogen.sh @@ -126,6 +126,10 @@ if $use_gnulib; then fi fi +# Let the user set up their own _SRCDIRs, in case they weren't passed down from +# bootstrap itself. +bootstrap_srcdirs_hook + version_controlled_file() { parent=$1 file=$2 diff --git a/top/autopull.sh b/top/autopull.sh index ffb4ba7cb..6df8613b6 100755 --- a/top/autopull.sh +++ b/top/autopull.sh @@ -151,6 +151,10 @@ $use_git || test -n "$GNULIB_SRCDIR" \ test -z "$GNULIB_SRCDIR" || test -d "$GNULIB_SRCDIR" \ || die "Error: \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option is specified, but does not denote a directory" +# Let the user set up their own _SRCDIRs, in case they weren't passed down from +# bootstrap itself. +bootstrap_srcdirs_hook + if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then die "Running this script from a non-checked-out distribution is risky." fi diff --git a/top/bootstrap b/top/bootstrap index cf8d007f6..747565cb3 100755 --- a/top/bootstrap +++ b/top/bootstrap @@ -166,6 +166,9 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then die "Bootstrapping from a non-checked-out distribution is risky." fi +# Now, call the users _SRCDIR setups. +bootstrap_srcdirs_hook + check_build_prerequisites $use_git if ! test -f "$medir"/bootstrap-funclib.sh; then diff --git a/top/bootstrap-funclib.sh b/top/bootstrap-funclib.sh index cfad85a31..b5d85100e 100644 --- a/top/bootstrap-funclib.sh +++ b/top/bootstrap-funclib.sh @@ -108,6 +108,13 @@ bootstrap_post_import_hook() { :; } # Override it via your own definition in bootstrap.conf. bootstrap_epilogue() { :; } +# A function to be called after setting GNULIB_SRCDIR, but before anything +# else, so that they user may define their own *_SRCDIR variables. This hook +# should only bother with setting up your _SRCDIR variables and exporting them, +# *not pulling them*. The latter should be handled by +# bootstrap_post_pull_hook. +bootstrap_srcdirs_hook() { :; } + # The command to download all .po files for a specified domain into a # specified directory. Fill in the first %s with the destination # directory and the second with the domain name. -- 2.38.1