[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] bootstrap: add hooks for user-defined command-line options
From: |
Jose E. Marchesi |
Subject: |
[PATCH] bootstrap: add hooks for user-defined command-line options |
Date: |
Wed, 18 Nov 2020 18:14:56 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
This patch adds a couple of hooks to the `bootstrap' script that
allows the users to handle their own command line options in their
bootstrap.conf files.
Usage example:
bootstrap_option_hook ()
{
case $1 in
--jitter-srcdir)
JITTER_SRCDIR=${$1#--jitter-srcdir=}; return 0;;
esac
return 1;
}
bootstrap_print_option_usage_hook ()
{
cat <<EOF
--jitter-srcdir=DIRNAME specify the local directory where jitter
sources reside. Use this if you already
have jitter sources on your machine, and
do not want to waste your bandwidth downloading
them again.
EOF
}
* build-aux/bootstrap (bootstrap_print_option_usage_hook): Define
(bootstrap_option_hook): Likewise.
(usage): Call bootstrap_print_option_usage_hook.
---
ChangeLog | 6 ++++++
build-aux/bootstrap | 20 +++++++++++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d50f4d1a2..ce023761c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-11-18 Jose E. Marchesi <jemarch@gnu.org>
+
+ * build-aux/bootstrap (bootstrap_print_option_usage_hook): Define
+ (bootstrap_option_hook): Likewise.
+ (usage): Call bootstrap_print_option_usage_hook.
+
2020-11-17 Akim Demaille <akim@lrde.epita.fr>
bitset: strengthen tests
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index 8f76d6962..5f1b1b70c 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
-scriptversion=2020-04-13.15; # UTC
+scriptversion=2020-11-18.17; # UTC
# Bootstrap this package from checked-out sources.
@@ -71,7 +71,9 @@ Options:
--no-git do not use git to update gnulib. Requires that
--gnulib-srcdir point to a correct gnulib snapshot
--skip-po do not download po files
-
+EOF
+ bootstrap_print_option_usage_hook
+ cat <<EOF
If the file $me.conf exists in the same directory as this script, its
contents are read as shell variables to configure the bootstrap.
@@ -154,6 +156,18 @@ gnulib_files=
: ${AUTOPOINT=autopoint}
: ${AUTORECONF=autoreconf}
+# A function to be called for each unrecognized option. Returns 0 if
+# the option in $1 has been processed by the function. Returns 1 if
+# the option has not been processed by the function. Override it via
+# your own definition in bootstrap.conf
+
+bootstrap_option_hook() { return 1; }
+
+# A function to be called in order to print the --help information
+# corresponding to user-defined command-line options.
+
+bootstrap_print_option_usage_hook() { :; }
+
# A function to be called right after gnulib-tool is run.
# Override it via your own definition in bootstrap.conf.
bootstrap_post_import_hook() { :; }
@@ -335,7 +349,7 @@ do
--no-git)
use_git=false;;
*)
- die "$option: unknown option";;
+ bootstrap_option_hook $option || die "$option: unknown option";;
esac
done
--
2.25.0.2.g232378479e
- [PATCH] bootstrap: add hooks for user-defined command-line options,
Jose E. Marchesi <=