mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
maint: ./bootstrap
This commit is contained in:
136
bootstrap
136
bootstrap
@@ -1,7 +1,9 @@
|
||||
#! /bin/sh
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
# Copyright (C) 2003-2022 Free Software Foundation, Inc.
|
||||
scriptversion=2024-07-04.10; # UTC
|
||||
|
||||
# Copyright (C) 2003-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -26,8 +28,6 @@
|
||||
|
||||
# Please report bugs or propose patches to bug-gnulib@gnu.org.
|
||||
|
||||
scriptversion=2022-07-29.23; # UTC
|
||||
|
||||
me="$0"
|
||||
medir=`dirname "$me"`
|
||||
|
||||
@@ -43,35 +43,55 @@ 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
|
||||
do not want to waste your bandwidth downloading
|
||||
them again.
|
||||
GNULIB_URL Cloneable URL of the gnulib repository.
|
||||
|
||||
Options:
|
||||
--gnulib-srcdir=DIRNAME specify 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 specify the local directory where a gnulib
|
||||
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.
|
||||
Defaults to \$GNULIB_REFDIR
|
||||
--bootstrap-sync if this bootstrap script is not identical to
|
||||
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
|
||||
--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
|
||||
/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
|
||||
--skip-po do not download po files
|
||||
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
|
||||
@@ -83,11 +103,11 @@ are honored.
|
||||
|
||||
Gnulib sources can be fetched in various ways:
|
||||
|
||||
* If the environment variable 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.
|
||||
* 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
|
||||
@@ -97,7 +117,8 @@ Gnulib sources can be fetched in various ways:
|
||||
|
||||
* 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.
|
||||
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.
|
||||
|
||||
@@ -118,6 +139,10 @@ EOF
|
||||
|
||||
# Parse options.
|
||||
|
||||
# Whether to pull and generate.
|
||||
pull=false
|
||||
gen=false
|
||||
|
||||
# Whether to use copies instead of symlinks.
|
||||
copy=false
|
||||
|
||||
@@ -132,10 +157,14 @@ do
|
||||
exit;;
|
||||
--version)
|
||||
set -e
|
||||
echo "bootstrap $scriptversion"
|
||||
echo "bootstrap $scriptversion lib $scriptlibversion"
|
||||
echo "$copyright"
|
||||
exit 0
|
||||
;;
|
||||
--pull)
|
||||
pull=true;;
|
||||
--gen)
|
||||
gen=true;;
|
||||
--gnulib-srcdir=*)
|
||||
GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
|
||||
--gnulib-refdir=*)
|
||||
@@ -157,10 +186,15 @@ do
|
||||
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"
|
||||
|| 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"
|
||||
|| 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."
|
||||
@@ -168,45 +202,43 @@ fi
|
||||
|
||||
check_build_prerequisites $use_git
|
||||
|
||||
if ! test -f "$medir"/bootstrap-funclib.sh; then
|
||||
# We have only completed the first phase of an upgrade from a bootstrap
|
||||
# version < 2022-07-24. Need to do the second phase now.
|
||||
bootstrap_sync=true
|
||||
fi
|
||||
|
||||
if $bootstrap_sync; then
|
||||
prepare_GNULIB_SRCDIR
|
||||
upgrade_bootstrap
|
||||
upgrade_bootstrap "$@"
|
||||
# Since we have now upgraded if needed, no need to try it a second time below.
|
||||
bootstrap_sync=false
|
||||
fi
|
||||
|
||||
echo "$0: Bootstrapping from checked-out $package sources..."
|
||||
|
||||
# Pass GNULIB_SRCDIR to autopull.sh and autogen.sh.
|
||||
# Pass GNULIB_SRCDIR and GNULIB_REFDIR to any subsidiary commands that care.
|
||||
export GNULIB_SRCDIR
|
||||
|
||||
# Pass GNULIB_REFDIR to autopull.sh.
|
||||
export GNULIB_REFDIR
|
||||
|
||||
if $use_git || test -z "$SKIP_PO"; then
|
||||
"$medir"/autopull.sh \
|
||||
`if $bootstrap_sync; then echo ' --bootstrap-sync'; else echo ' --no-bootstrap-sync'; fi` \
|
||||
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 "autopull.sh failed."
|
||||
|| die "could not fetch auxiliary files"
|
||||
fi
|
||||
|
||||
"$medir"/autogen.sh \
|
||||
`if $copy; then echo ' --copy'; fi` \
|
||||
`if test -z "$checkout_only_file"; then echo ' --force'; fi` \
|
||||
|| die "autogen.sh failed."
|
||||
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
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# Local Variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
|
||||
Reference in New Issue
Block a user