|
|
#! /bin/sh |
|
|
|
|
|
|
|
|
scriptversion=2025-06-10.02; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
me="$0" |
|
|
medir=`dirname "$me"` |
|
|
|
|
|
|
|
|
. "$medir"/bootstrap-funclib.sh |
|
|
|
|
|
usage() { |
|
|
cat <<EOF |
|
|
Usage: $me [OPTION]... |
|
|
Bootstrap this package from the checked-out sources. |
|
|
|
|
|
Optional environment variables: |
|
|
GNULIB_SRCDIR Specifies the local directory where gnulib |
|
|
sources reside. Use this if you already |
|
|
have gnulib sources on your machine, and |
|
|
you want to use these sources. |
|
|
GNULIB_REFDIR Specifies the local directory where a gnulib |
|
|
repository (with a .git subdirectory) resides. |
|
|
Use this if you already have gnulib sources |
|
|
and history on your machine, and do not want |
|
|
to waste your bandwidth downloading them again. |
|
|
Only used for phase 1 (--pull). |
|
|
GNULIB_URL URL of the gnulib repository. The default is |
|
|
$default_gnulib_url, |
|
|
which is Gnulib's upstream repository. |
|
|
Only used for phase 1 (--pull). |
|
|
|
|
|
Options: |
|
|
|
|
|
--pull Do phase 1: Pull files from the network. |
|
|
--gen Do phase 2: Generate files from local files |
|
|
(no network access). |
|
|
(The default is to do both phases.) |
|
|
|
|
|
--gnulib-srcdir=DIRNAME Specifies the local directory where gnulib |
|
|
sources reside. Use this if you already |
|
|
have gnulib sources on your machine, and |
|
|
you want to use these sources. Defaults |
|
|
to \$GNULIB_SRCDIR. |
|
|
--gnulib-refdir=DIRNAME Specifies the local directory where a gnulib |
|
|
repository (with a .git subdirectory) resides. |
|
|
Use this if you already have gnulib sources |
|
|
and history on your machine, and do not want |
|
|
to waste your bandwidth downloading them again. |
|
|
Defaults to \$GNULIB_REFDIR. |
|
|
Only used for phase 1 (--pull). |
|
|
|
|
|
--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. |
|
|
Only used for phase 2 (--gen). |
|
|
--force Attempt to bootstrap even if the sources seem |
|
|
not to have been checked out. |
|
|
--no-git Do not use git to update gnulib. Requires that |
|
|
\$GNULIB_SRCDIR or the --gnulib-srcdir option |
|
|
points to a gnulib repository with the correct |
|
|
revision. |
|
|
Only used for phase 1 (--pull). |
|
|
--skip-po Do not download *.po files. |
|
|
Only used for phase 1 (--pull). |
|
|
EOF |
|
|
bootstrap_print_option_usage_hook |
|
|
cat <<EOF |
|
|
If the file bootstrap.conf exists in the same directory as this script, its |
|
|
contents are read as shell variables to configure the bootstrap. |
|
|
|
|
|
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR |
|
|
are honored. |
|
|
|
|
|
Gnulib sources can be fetched in various ways: |
|
|
|
|
|
* If GNULIB_SRCDIR is set (either as an environment variable or via the |
|
|
--gnulib-srcdir option), then sources are fetched from that local |
|
|
directory. If it is a git repository and the configuration variable |
|
|
GNULIB_REVISION is set in bootstrap.conf, then that revision is |
|
|
checked out. |
|
|
|
|
|
* Otherwise, if this package is in a git repository with a 'gnulib' |
|
|
submodule configured, then that submodule is initialized and updated |
|
|
and sources are fetched from there. If GNULIB_REFDIR is set (either |
|
|
as an environment variable or via the --gnulib-refdir option) and is |
|
|
a git repository, then it is used as a reference. |
|
|
|
|
|
* Otherwise, if the 'gnulib' directory does not exist, Gnulib sources |
|
|
are cloned into that directory using git from \$GNULIB_URL, defaulting |
|
|
to $default_gnulib_url; if GNULIB_REFDIR is set and is a git repository |
|
|
its contents may be used to accelerate the process. |
|
|
If the configuration variable GNULIB_REVISION is set in bootstrap.conf, |
|
|
then that revision is checked out. |
|
|
|
|
|
* Otherwise, the existing Gnulib sources in the 'gnulib' directory are |
|
|
used. If it is a git repository and the configuration variable |
|
|
GNULIB_REVISION is set in bootstrap.conf, then that revision is |
|
|
checked out. |
|
|
|
|
|
If you maintain a package and want to pin a particular revision of the |
|
|
Gnulib sources that has been tested with your package, then there are |
|
|
two possible approaches: either configure a 'gnulib' submodule with the |
|
|
appropriate revision, or set GNULIB_REVISION (and if necessary |
|
|
GNULIB_URL) in bootstrap.conf. |
|
|
|
|
|
Running without arguments will suffice in most cases. |
|
|
EOF |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pull=false |
|
|
gen=false |
|
|
|
|
|
|
|
|
copy=false |
|
|
|
|
|
|
|
|
use_git=true |
|
|
|
|
|
for option |
|
|
do |
|
|
case $option in |
|
|
--help) |
|
|
usage |
|
|
exit;; |
|
|
--version) |
|
|
set -e |
|
|
echo "bootstrap $scriptversion lib $scriptlibversion" |
|
|
echo "$copyright" |
|
|
exit 0 |
|
|
;; |
|
|
--pull) |
|
|
pull=true;; |
|
|
--gen) |
|
|
gen=true;; |
|
|
--gnulib-srcdir=*) |
|
|
GNULIB_SRCDIR=${option#--gnulib-srcdir=};; |
|
|
--gnulib-refdir=*) |
|
|
GNULIB_REFDIR=${option#--gnulib-refdir=};; |
|
|
--skip-po) |
|
|
SKIP_PO=t;; |
|
|
--force) |
|
|
checkout_only_file=;; |
|
|
--copy) |
|
|
copy=true;; |
|
|
--bootstrap-sync) |
|
|
bootstrap_sync=true;; |
|
|
--no-bootstrap-sync) |
|
|
bootstrap_sync=false;; |
|
|
--no-git) |
|
|
use_git=false;; |
|
|
*) |
|
|
bootstrap_option_hook $option || die "$option: unknown option";; |
|
|
esac |
|
|
done |
|
|
|
|
|
|
|
|
$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" \ |
|
|
|| die "Error: \$GNULIB_SRCDIR environment variable or --gnulib-srcdir" \ |
|
|
"option is specified, but does not denote a directory" |
|
|
|
|
|
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then |
|
|
die "Bootstrapping from a non-checked-out distribution is risky." |
|
|
fi |
|
|
|
|
|
check_build_prerequisites $use_git |
|
|
|
|
|
if $bootstrap_sync; then |
|
|
prepare_GNULIB_SRCDIR |
|
|
upgrade_bootstrap "$@" |
|
|
|
|
|
bootstrap_sync=false |
|
|
fi |
|
|
|
|
|
echo "$0: Bootstrapping from checked-out $package sources..." |
|
|
|
|
|
|
|
|
export GNULIB_SRCDIR |
|
|
export GNULIB_REFDIR |
|
|
|
|
|
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` \ |
|
|
`if ! $use_git; then echo ' --no-git'; fi` \ |
|
|
`if test -n "$SKIP_PO"; then echo ' --skip-po'; fi` \ |
|
|
|| die "could not fetch auxiliary files" |
|
|
fi |
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|