|
|
5593c8 |
#! /bin/sh
|
|
|
5593c8 |
# Print a version string.
|
|
|
5593c8 |
scriptversion=2019-01-04.17; # UTC
|
|
|
5593c8 |
|
|
|
5593c8 |
# Bootstrap this package from checked-out sources.
|
|
|
5593c8 |
|
|
|
5593c8 |
# Copyright (C) 2003-2019 Free Software Foundation, Inc.
|
|
|
5593c8 |
|
|
|
5593c8 |
# This program is free software: you can redistribute it and/or modify
|
|
|
5593c8 |
# it under the terms of the GNU General Public License as published by
|
|
|
5593c8 |
# the Free Software Foundation, either version 3 of the License, or
|
|
|
5593c8 |
# (at your option) any later version.
|
|
|
5593c8 |
|
|
|
5593c8 |
# This program is distributed in the hope that it will be useful,
|
|
|
5593c8 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
5593c8 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
5593c8 |
# GNU General Public License for more details.
|
|
|
5593c8 |
|
|
|
5593c8 |
# You should have received a copy of the GNU General Public License
|
|
|
5593c8 |
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
5593c8 |
|
|
|
5593c8 |
# Originally written by Paul Eggert. The canonical version of this
|
|
|
5593c8 |
# script is maintained as build-aux/bootstrap in gnulib, however, to
|
|
|
5593c8 |
# be useful to your project, you should place a copy of it under
|
|
|
5593c8 |
# version control in the top-level directory of your project. The
|
|
|
5593c8 |
# intent is that all customization can be done with a bootstrap.conf
|
|
|
5593c8 |
# file also maintained in your version control; gnulib comes with a
|
|
|
5593c8 |
# template build-aux/bootstrap.conf to get you started.
|
|
|
5593c8 |
|
|
|
5593c8 |
# Please report bugs or propose patches to bug-gnulib@gnu.org.
|
|
|
5593c8 |
|
|
|
5593c8 |
nl='
|
|
|
5593c8 |
'
|
|
|
5593c8 |
|
|
|
5593c8 |
# Ensure file names are sorted consistently across platforms.
|
|
|
5593c8 |
LC_ALL=C
|
|
|
5593c8 |
export LC_ALL
|
|
|
5593c8 |
|
|
|
5593c8 |
# Ensure that CDPATH is not set. Otherwise, the output from cd
|
|
|
5593c8 |
# would cause trouble in at least one use below.
|
|
|
5593c8 |
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
|
|
5593c8 |
|
|
|
5593c8 |
local_gl_dir=gl
|
|
|
5593c8 |
|
|
|
5593c8 |
# Honor $PERL, but work even if there is none.
|
|
|
5593c8 |
PERL="${PERL-perl}"
|
|
|
5593c8 |
|
|
|
5593c8 |
me=$0
|
|
|
5593c8 |
|
|
|
5593c8 |
default_gnulib_url=git://git.sv.gnu.org/gnulib
|
|
|
5593c8 |
|
|
|
5593c8 |
usage() {
|
|
|
5593c8 |
cat <
|
|
|
5593c8 |
Usage: $me [OPTION]...
|
|
|
5593c8 |
Bootstrap this package from the checked-out sources.
|
|
|
5593c8 |
|
|
|
5593c8 |
Options:
|
|
|
5593c8 |
--gnulib-srcdir=DIRNAME specify the local directory where gnulib
|
|
|
5593c8 |
sources reside. Use this if you already
|
|
|
5593c8 |
have gnulib sources on your machine, and
|
|
|
5593c8 |
do not want to waste your bandwidth downloading
|
|
|
5593c8 |
them again. Defaults to \$GNULIB_SRCDIR
|
|
|
5593c8 |
--bootstrap-sync if this bootstrap script is not identical to
|
|
|
5593c8 |
the version in the local gnulib sources,
|
|
|
5593c8 |
update this script, and then restart it with
|
|
|
5593c8 |
/bin/sh or the shell \$CONFIG_SHELL
|
|
|
5593c8 |
--no-bootstrap-sync do not check whether bootstrap is out of sync
|
|
|
5593c8 |
--copy copy files instead of creating symbolic links
|
|
|
5593c8 |
--force attempt to bootstrap even if the sources seem
|
|
|
5593c8 |
not to have been checked out
|
|
|
5593c8 |
--no-git do not use git to update gnulib. Requires that
|
|
|
5593c8 |
--gnulib-srcdir point to a correct gnulib snapshot
|
|
|
5593c8 |
--skip-po do not download po files
|
|
|
5593c8 |
|
|
|
5593c8 |
If the file $me.conf exists in the same directory as this script, its
|
|
|
5593c8 |
contents are read as shell variables to configure the bootstrap.
|
|
|
5593c8 |
|
|
|
5593c8 |
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
|
|
|
5593c8 |
are honored.
|
|
|
5593c8 |
|
|
|
5593c8 |
Gnulib sources can be fetched in various ways:
|
|
|
5593c8 |
|
|
|
5593c8 |
* If this package is in a git repository with a 'gnulib' submodule
|
|
|
5593c8 |
configured, then that submodule is initialized and updated and sources
|
|
|
5593c8 |
are fetched from there. If \$GNULIB_SRCDIR is set (directly or via
|
|
|
5593c8 |
--gnulib-srcdir) and is a git repository, then it is used as a reference.
|
|
|
5593c8 |
|
|
|
5593c8 |
* Otherwise, if \$GNULIB_SRCDIR is set (directly or via --gnulib-srcdir),
|
|
|
5593c8 |
then sources are fetched from that local directory. If it is a git
|
|
|
5593c8 |
repository and \$GNULIB_REVISION is set, then that revision is checked
|
|
|
5593c8 |
out.
|
|
|
5593c8 |
|
|
|
5593c8 |
* Otherwise, if this package is in a git repository with a 'gnulib'
|
|
|
5593c8 |
submodule configured, then that submodule is initialized and updated and
|
|
|
5593c8 |
sources are fetched from there.
|
|
|
5593c8 |
|
|
|
5593c8 |
* Otherwise, if the 'gnulib' directory does not exist, Gnulib sources are
|
|
|
5593c8 |
cloned into that directory using git from \$GNULIB_URL, defaulting to
|
|
|
5593c8 |
$default_gnulib_url.
|
|
|
5593c8 |
If \$GNULIB_REVISION is set, then that revision is checked out.
|
|
|
5593c8 |
|
|
|
5593c8 |
* Otherwise, the existing Gnulib sources in the 'gnulib' directory are
|
|
|
5593c8 |
used. If it is a git repository and \$GNULIB_REVISION is set, then that
|
|
|
5593c8 |
revision is checked out.
|
|
|
5593c8 |
|
|
|
5593c8 |
If you maintain a package and want to pin a particular revision of the
|
|
|
5593c8 |
Gnulib sources that has been tested with your package, then there are two
|
|
|
5593c8 |
possible approaches: either configure a 'gnulib' submodule with the
|
|
|
5593c8 |
appropriate revision, or set \$GNULIB_REVISION (and if necessary
|
|
|
5593c8 |
\$GNULIB_URL) in $me.conf.
|
|
|
5593c8 |
|
|
|
5593c8 |
Running without arguments will suffice in most cases.
|
|
|
5593c8 |
EOF
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
# warnf_ FORMAT-STRING ARG1...
|
|
|
5593c8 |
warnf_ ()
|
|
|
5593c8 |
{
|
|
|
5593c8 |
warnf_format_=$1
|
|
|
5593c8 |
shift
|
|
|
5593c8 |
nl='
|
|
|
5593c8 |
'
|
|
|
5593c8 |
case $* in
|
|
|
5593c8 |
*$nl*) me_=$(printf "$me"|tr "$nl|" '??')
|
|
|
5593c8 |
printf "$warnf_format_" "$@" | sed "s|^|$me_: |" ;;
|
|
|
5593c8 |
*) printf "$me: $warnf_format_" "$@" ;;
|
|
|
5593c8 |
esac >&2
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
# warn_ WORD1...
|
|
|
5593c8 |
warn_ ()
|
|
|
5593c8 |
{
|
|
|
5593c8 |
# If IFS does not start with ' ', set it and emit the warning in a subshell.
|
|
|
5593c8 |
case $IFS in
|
|
|
5593c8 |
' '*) warnf_ '%s\n' "$*";;
|
|
|
5593c8 |
*) (IFS=' '; warn_ "$@");;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
# die WORD1...
|
|
|
5593c8 |
die() { warn_ "$@"; exit 1; }
|
|
|
5593c8 |
|
|
|
5593c8 |
# Configuration.
|
|
|
5593c8 |
|
|
|
5593c8 |
# Name of the Makefile.am
|
|
|
5593c8 |
gnulib_mk=gnulib.mk
|
|
|
5593c8 |
|
|
|
5593c8 |
# List of gnulib modules needed.
|
|
|
5593c8 |
gnulib_modules=
|
|
|
5593c8 |
|
|
|
5593c8 |
# Any gnulib files needed that are not in modules.
|
|
|
5593c8 |
gnulib_files=
|
|
|
5593c8 |
|
|
|
5593c8 |
: ${AUTOPOINT=autopoint}
|
|
|
5593c8 |
: ${AUTORECONF=autoreconf}
|
|
|
5593c8 |
|
|
|
5593c8 |
# A function to be called right after gnulib-tool is run.
|
|
|
5593c8 |
# Override it via your own definition in bootstrap.conf.
|
|
|
5593c8 |
bootstrap_post_import_hook() { :; }
|
|
|
5593c8 |
|
|
|
5593c8 |
# A function to be called after everything else in this script.
|
|
|
5593c8 |
# Override it via your own definition in bootstrap.conf.
|
|
|
5593c8 |
bootstrap_epilogue() { :; }
|
|
|
5593c8 |
|
|
|
5593c8 |
# The command to download all .po files for a specified domain into a
|
|
|
5593c8 |
# specified directory. Fill in the first %s with the destination
|
|
|
5593c8 |
# directory and the second with the domain name.
|
|
|
5593c8 |
po_download_command_format=\
|
|
|
5593c8 |
"wget --mirror --level=1 -nd -q -A.po -P '%s' \
|
|
|
5593c8 |
https://translationproject.org/latest/%s/"
|
|
|
5593c8 |
|
|
|
5593c8 |
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
|
|
|
5593c8 |
# fall back to the package name (1st argument with munging)
|
|
|
5593c8 |
extract_package_name='
|
|
|
5593c8 |
/^AC_INIT(\[*/{
|
|
|
5593c8 |
s///
|
|
|
5593c8 |
/^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{
|
|
|
5593c8 |
s//\1/
|
|
|
5593c8 |
s/[],)].*//
|
|
|
5593c8 |
p
|
|
|
5593c8 |
q
|
|
|
5593c8 |
}
|
|
|
5593c8 |
s/[],)].*//
|
|
|
5593c8 |
s/^GNU //
|
|
|
5593c8 |
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
|
|
5593c8 |
s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g
|
|
|
5593c8 |
p
|
|
|
5593c8 |
}
|
|
|
5593c8 |
'
|
|
|
5593c8 |
package=$(sed -n "$extract_package_name" configure.ac) \
|
|
|
5593c8 |
|| die 'cannot find package name in configure.ac'
|
|
|
5593c8 |
gnulib_name=lib$package
|
|
|
5593c8 |
|
|
|
5593c8 |
build_aux=build-aux
|
|
|
5593c8 |
source_base=lib
|
|
|
5593c8 |
m4_base=m4
|
|
|
5593c8 |
doc_base=doc
|
|
|
5593c8 |
tests_base=tests
|
|
|
5593c8 |
gnulib_extra_files="
|
|
|
5593c8 |
build-aux/install-sh
|
|
|
5593c8 |
build-aux/mdate-sh
|
|
|
5593c8 |
build-aux/texinfo.tex
|
|
|
5593c8 |
build-aux/depcomp
|
|
|
5593c8 |
build-aux/config.guess
|
|
|
5593c8 |
build-aux/config.sub
|
|
|
5593c8 |
doc/INSTALL
|
|
|
5593c8 |
"
|
|
|
5593c8 |
|
|
|
5593c8 |
# Additional gnulib-tool options to use. Use "\newline" to break lines.
|
|
|
5593c8 |
gnulib_tool_option_extras=
|
|
|
5593c8 |
|
|
|
5593c8 |
# Other locale categories that need message catalogs.
|
|
|
5593c8 |
EXTRA_LOCALE_CATEGORIES=
|
|
|
5593c8 |
|
|
|
5593c8 |
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
|
|
5593c8 |
XGETTEXT_OPTIONS='\\\
|
|
|
5593c8 |
--flag=_:1:pass-c-format\\\
|
|
|
5593c8 |
--flag=N_:1:pass-c-format\\\
|
|
|
5593c8 |
--flag=error:3:c-format --flag=error_at_line:5:c-format\\\
|
|
|
5593c8 |
'
|
|
|
5593c8 |
|
|
|
5593c8 |
# Package bug report address and copyright holder for gettext files
|
|
|
5593c8 |
COPYRIGHT_HOLDER='Free Software Foundation, Inc.'
|
|
|
5593c8 |
MSGID_BUGS_ADDRESS=bug-$package@gnu.org
|
|
|
5593c8 |
|
|
|
5593c8 |
# Files we don't want to import.
|
|
|
5593c8 |
excluded_files=
|
|
|
5593c8 |
|
|
|
5593c8 |
# File that should exist in the top directory of a checked out hierarchy,
|
|
|
5593c8 |
# but not in a distribution tarball.
|
|
|
5593c8 |
checkout_only_file=README-hacking
|
|
|
5593c8 |
|
|
|
5593c8 |
# Whether to use copies instead of symlinks.
|
|
|
5593c8 |
copy=false
|
|
|
5593c8 |
|
|
|
5593c8 |
# Set this to '.cvsignore .gitignore' in bootstrap.conf if you want
|
|
|
5593c8 |
# those files to be generated in directories like lib/, m4/, and po/.
|
|
|
5593c8 |
# Or set it to 'auto' to make this script select which to use based
|
|
|
5593c8 |
# on which version control system (if any) is used in the source directory.
|
|
|
5593c8 |
vc_ignore=auto
|
|
|
5593c8 |
|
|
|
5593c8 |
# Set this to true in bootstrap.conf to enable --bootstrap-sync by
|
|
|
5593c8 |
# default.
|
|
|
5593c8 |
bootstrap_sync=false
|
|
|
5593c8 |
|
|
|
5593c8 |
# Use git to update gnulib sources
|
|
|
5593c8 |
use_git=true
|
|
|
5593c8 |
|
|
|
5593c8 |
check_exists() {
|
|
|
5593c8 |
if test "$1" = "--verbose"; then
|
|
|
5593c8 |
($2 --version </dev/null) >/dev/null 2>&1
|
|
|
5593c8 |
if test $? -ge 126; then
|
|
|
5593c8 |
# If not found, run with diagnostics as one may be
|
|
|
5593c8 |
# presented with env variables to set to find the right version
|
|
|
5593c8 |
($2 --version
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
else
|
|
|
5593c8 |
($1 --version </dev/null) >/dev/null 2>&1
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
test $? -lt 126
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
# find_tool ENVVAR NAMES...
|
|
|
5593c8 |
# -------------------------
|
|
|
5593c8 |
# Search for a required program. Use the value of ENVVAR, if set,
|
|
|
5593c8 |
# otherwise find the first of the NAMES that can be run.
|
|
|
5593c8 |
# If found, set ENVVAR to the program name, die otherwise.
|
|
|
5593c8 |
#
|
|
|
5593c8 |
# FIXME: code duplication, see also gnu-web-doc-update.
|
|
|
5593c8 |
find_tool ()
|
|
|
5593c8 |
{
|
|
|
5593c8 |
find_tool_envvar=$1
|
|
|
5593c8 |
shift
|
|
|
5593c8 |
find_tool_names=$@
|
|
|
5593c8 |
eval "find_tool_res=\$$find_tool_envvar"
|
|
|
5593c8 |
if test x"$find_tool_res" = x; then
|
|
|
5593c8 |
for i; do
|
|
|
5593c8 |
if check_exists $i; then
|
|
|
5593c8 |
find_tool_res=$i
|
|
|
5593c8 |
break
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
done
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
if test x"$find_tool_res" = x; then
|
|
|
5593c8 |
warn_ "one of these is required: $find_tool_names;"
|
|
|
5593c8 |
die "alternatively set $find_tool_envvar to a compatible tool"
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
eval "$find_tool_envvar=\$find_tool_res"
|
|
|
5593c8 |
eval "export $find_tool_envvar"
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
# Override the default configuration, if necessary.
|
|
|
5593c8 |
# Make sure that bootstrap.conf is sourced from the current directory
|
|
|
5593c8 |
# if we were invoked as "sh bootstrap".
|
|
|
5593c8 |
case "$0" in
|
|
|
5593c8 |
*/*) test -r "$0.conf" && . "$0.conf" ;;
|
|
|
5593c8 |
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
|
|
|
5593c8 |
if test "$vc_ignore" = auto; then
|
|
|
5593c8 |
vc_ignore=
|
|
|
5593c8 |
test -d .git && vc_ignore=.gitignore
|
|
|
5593c8 |
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
|
|
|
5593c8 |
use_gnulib=false
|
|
|
5593c8 |
else
|
|
|
5593c8 |
use_gnulib=true
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
# Translate configuration into internal form.
|
|
|
5593c8 |
|
|
|
5593c8 |
# Parse options.
|
|
|
5593c8 |
|
|
|
5593c8 |
for option
|
|
|
5593c8 |
do
|
|
|
5593c8 |
case $option in
|
|
|
5593c8 |
--help)
|
|
|
5593c8 |
usage
|
|
|
5593c8 |
exit;;
|
|
|
5593c8 |
--gnulib-srcdir=*)
|
|
|
5593c8 |
GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
|
|
|
5593c8 |
--skip-po)
|
|
|
5593c8 |
SKIP_PO=t;;
|
|
|
5593c8 |
--force)
|
|
|
5593c8 |
checkout_only_file=;;
|
|
|
5593c8 |
--copy)
|
|
|
5593c8 |
copy=true;;
|
|
|
5593c8 |
--bootstrap-sync)
|
|
|
5593c8 |
bootstrap_sync=true;;
|
|
|
5593c8 |
--no-bootstrap-sync)
|
|
|
5593c8 |
bootstrap_sync=false;;
|
|
|
5593c8 |
--no-git)
|
|
|
5593c8 |
use_git=false;;
|
|
|
5593c8 |
*)
|
|
|
5593c8 |
die "$option: unknown option";;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
done
|
|
|
5593c8 |
|
|
|
5593c8 |
$use_git || test -d "$GNULIB_SRCDIR" \
|
|
|
5593c8 |
|| die "Error: --no-git requires --gnulib-srcdir"
|
|
|
5593c8 |
|
|
|
5593c8 |
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
|
|
|
5593c8 |
die "Bootstrapping from a non-checked-out distribution is risky."
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
# Strip blank and comment lines to leave significant entries.
|
|
|
5593c8 |
gitignore_entries() {
|
|
|
5593c8 |
sed '/^#/d; /^$/d' "$@"
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
# If $STR is not already on a line by itself in $FILE, insert it at the start.
|
|
|
5593c8 |
# Entries are inserted at the start of the ignore list to ensure existing
|
|
|
5593c8 |
# entries starting with ! are not overridden. Such entries support
|
|
|
5593c8 |
# whitelisting exceptions after a more generic blacklist pattern.
|
|
|
5593c8 |
insert_if_absent() {
|
|
|
5593c8 |
file=$1
|
|
|
5593c8 |
str=$2
|
|
|
5593c8 |
test -f $file || touch $file
|
|
|
5593c8 |
test -r $file || die "Error: failed to read ignore file: $file"
|
|
|
5593c8 |
duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
|
|
|
5593c8 |
if [ "$duplicate_entries" ] ; then
|
|
|
5593c8 |
die "Error: Duplicate entries in $file: " $duplicate_entries
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
linesold=$(gitignore_entries $file | wc -l)
|
|
|
5593c8 |
linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
|
|
|
5593c8 |
if [ $linesold != $linesnew ] ; then
|
|
|
5593c8 |
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|
|
|
5593c8 |
|| die "insert_if_absent $file $str: failed"
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
|
|
5593c8 |
# insert_if_absent.
|
|
|
5593c8 |
insert_vc_ignore() {
|
|
|
5593c8 |
vc_ignore_file="$1"
|
|
|
5593c8 |
pattern="$2"
|
|
|
5593c8 |
case $vc_ignore_file in
|
|
|
5593c8 |
*.gitignore)
|
|
|
5593c8 |
# A .gitignore entry that does not start with '/' applies
|
|
|
5593c8 |
# recursively to subdirectories, so prepend '/' to every
|
|
|
5593c8 |
# .gitignore entry.
|
|
|
5593c8 |
pattern=$(echo "$pattern" | sed s,^,/,);;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
insert_if_absent "$vc_ignore_file" "$pattern"
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
|
|
|
5593c8 |
found_aux_dir=no
|
|
|
5593c8 |
grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
|
|
|
5593c8 |
>/dev/null && found_aux_dir=yes
|
|
|
5593c8 |
grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
|
|
|
5593c8 |
>/dev/null && found_aux_dir=yes
|
|
|
5593c8 |
test $found_aux_dir = yes \
|
|
|
5593c8 |
|| die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it"
|
|
|
5593c8 |
|
|
|
5593c8 |
# If $build_aux doesn't exist, create it now, otherwise some bits
|
|
|
5593c8 |
# below will malfunction. If creating it, also mark it as ignored.
|
|
|
5593c8 |
if test ! -d $build_aux; then
|
|
|
5593c8 |
mkdir $build_aux
|
|
|
5593c8 |
for dot_ig in x $vc_ignore; do
|
|
|
5593c8 |
test $dot_ig = x && continue
|
|
|
5593c8 |
insert_vc_ignore $dot_ig $build_aux
|
|
|
5593c8 |
done
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
# Note this deviates from the version comparison in automake
|
|
|
5593c8 |
# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
|
|
|
5593c8 |
# but this should suffice as we won't be specifying old
|
|
|
5593c8 |
# version formats or redundant trailing .0 in bootstrap.conf.
|
|
|
5593c8 |
# If we did want full compatibility then we should probably
|
|
|
5593c8 |
# use m4_version_compare from autoconf.
|
|
|
5593c8 |
sort_ver() { # sort -V is not generally available
|
|
|
5593c8 |
ver1="$1"
|
|
|
5593c8 |
ver2="$2"
|
|
|
5593c8 |
|
|
|
5593c8 |
# split on '.' and compare each component
|
|
|
5593c8 |
i=1
|
|
|
5593c8 |
while : ; do
|
|
|
5593c8 |
p1=$(echo "$ver1" | cut -d. -f$i)
|
|
|
5593c8 |
p2=$(echo "$ver2" | cut -d. -f$i)
|
|
|
5593c8 |
if [ ! "$p1" ]; then
|
|
|
5593c8 |
echo "$1 $2"
|
|
|
5593c8 |
break
|
|
|
5593c8 |
elif [ ! "$p2" ]; then
|
|
|
5593c8 |
echo "$2 $1"
|
|
|
5593c8 |
break
|
|
|
5593c8 |
elif [ ! "$p1" = "$p2" ]; then
|
|
|
5593c8 |
if [ "$p1" -gt "$p2" ] 2>/dev/null; then # numeric comparison
|
|
|
5593c8 |
echo "$2 $1"
|
|
|
5593c8 |
elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison
|
|
|
5593c8 |
echo "$1 $2"
|
|
|
5593c8 |
else # numeric, then lexicographic comparison
|
|
|
5593c8 |
lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1)
|
|
|
5593c8 |
if [ "$lp" = "$p2" ]; then
|
|
|
5593c8 |
echo "$1 $2"
|
|
|
5593c8 |
else
|
|
|
5593c8 |
echo "$2 $1"
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
break
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
i=$(($i+1))
|
|
|
5593c8 |
done
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
get_version_sed='
|
|
|
5593c8 |
# Move version to start of line.
|
|
|
5593c8 |
s/.*[v ]\([0-9]\)/\1/
|
|
|
5593c8 |
|
|
|
5593c8 |
# Skip lines that do not start with version.
|
|
|
5593c8 |
/^[0-9]/!d
|
|
|
5593c8 |
|
|
|
5593c8 |
# Remove characters after the version.
|
|
|
5593c8 |
s/[^.a-z0-9-].*//
|
|
|
5593c8 |
|
|
|
5593c8 |
# The first component must be digits only.
|
|
|
5593c8 |
s/^\([0-9]*\)[a-z-].*/\1/
|
|
|
5593c8 |
|
|
|
5593c8 |
#the following essentially does s/5.005/5.5/
|
|
|
5593c8 |
s/\.0*\([1-9]\)/.\1/g
|
|
|
5593c8 |
p
|
|
|
5593c8 |
q'
|
|
|
5593c8 |
|
|
|
5593c8 |
get_version() {
|
|
|
5593c8 |
app=$1
|
|
|
5593c8 |
|
|
|
5593c8 |
$app --version >/dev/null 2>&1 || { $app --version; return 1; }
|
|
|
5593c8 |
|
|
|
5593c8 |
$app --version 2>&1 | sed -n "$get_version_sed"
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
check_versions() {
|
|
|
5593c8 |
ret=0
|
|
|
5593c8 |
|
|
|
5593c8 |
while read app req_ver; do
|
|
|
5593c8 |
# We only need libtoolize from the libtool package.
|
|
|
5593c8 |
if test "$app" = libtool; then
|
|
|
5593c8 |
app=libtoolize
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
# Exempt git if --no-git is in effect.
|
|
|
5593c8 |
if test "$app" = git; then
|
|
|
5593c8 |
$use_git || continue
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
# Honor $APP variables ($TAR, $AUTOCONF, etc.)
|
|
|
5593c8 |
appvar=$(echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_')
|
|
|
5593c8 |
test "$appvar" = TAR && appvar=AMTAR
|
|
|
5593c8 |
case $appvar in
|
|
|
5593c8 |
GZIP) ;; # Do not use $GZIP: it contains gzip options.
|
|
|
5593c8 |
PERL::*) ;; # Keep perl modules as-is
|
|
|
5593c8 |
*) eval "app=\${$appvar-$app}" ;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
|
|
|
5593c8 |
# Handle the still-experimental Automake-NG programs specially.
|
|
|
5593c8 |
# They remain named as the mainstream Automake programs ("automake",
|
|
|
5593c8 |
# and "aclocal") to avoid gratuitous incompatibilities with
|
|
|
5593c8 |
# pre-existing usages (by, say, autoreconf, or custom autogen.sh
|
|
|
5593c8 |
# scripts), but correctly identify themselves (as being part of
|
|
|
5593c8 |
# "GNU automake-ng") when asked their version.
|
|
|
5593c8 |
case $app in
|
|
|
5593c8 |
automake-ng|aclocal-ng)
|
|
|
5593c8 |
app=${app%-ng}
|
|
|
5593c8 |
($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || {
|
|
|
5593c8 |
warn_ "Error: '$app' not found or not from Automake-NG"
|
|
|
5593c8 |
ret=1
|
|
|
5593c8 |
continue
|
|
|
5593c8 |
} ;;
|
|
|
5593c8 |
# Another check is for perl modules. These can be written as
|
|
|
5593c8 |
# e.g. perl::XML::XPath in case of XML::XPath module, etc.
|
|
|
5593c8 |
perl::*)
|
|
|
5593c8 |
# Extract module name
|
|
|
5593c8 |
app="${app#perl::}"
|
|
|
5593c8 |
if ! $PERL -m"$app" -e 'exit 0' >/dev/null 2>&1; then
|
|
|
5593c8 |
warn_ "Error: perl module '$app' not found"
|
|
|
5593c8 |
ret=1
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
continue
|
|
|
5593c8 |
;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
if [ "$req_ver" = "-" ]; then
|
|
|
5593c8 |
# Merely require app to exist; not all prereq apps are well-behaved
|
|
|
5593c8 |
# so we have to rely on $? rather than get_version.
|
|
|
5593c8 |
if ! check_exists --verbose $app; then
|
|
|
5593c8 |
warn_ "Error: '$app' not found"
|
|
|
5593c8 |
ret=1
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
else
|
|
|
5593c8 |
# Require app to produce a new enough version string.
|
|
|
5593c8 |
inst_ver=$(get_version $app)
|
|
|
5593c8 |
if [ ! "$inst_ver" ]; then
|
|
|
5593c8 |
warn_ "Error: '$app' not found"
|
|
|
5593c8 |
ret=1
|
|
|
5593c8 |
else
|
|
|
5593c8 |
latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
|
|
|
5593c8 |
if [ ! "$latest_ver" = "$inst_ver" ]; then
|
|
|
5593c8 |
warnf_ '%s\n' \
|
|
|
5593c8 |
"Error: '$app' version == $inst_ver is too old" \
|
|
|
5593c8 |
" '$app' version >= $req_ver is required"
|
|
|
5593c8 |
ret=1
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
done
|
|
|
5593c8 |
|
|
|
5593c8 |
return $ret
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
print_versions() {
|
|
|
5593c8 |
echo "Program Min_version"
|
|
|
5593c8 |
echo "----------------------"
|
|
|
5593c8 |
printf %s "$buildreq"
|
|
|
5593c8 |
echo "----------------------"
|
|
|
5593c8 |
# can't depend on column -t
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
|
|
|
5593c8 |
# Also find the compatible sha1 utility on the BSDs
|
|
|
5593c8 |
if test x"$SKIP_PO" = x; then
|
|
|
5593c8 |
find_tool SHA1SUM sha1sum gsha1sum shasum sha1
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
use_libtool=0
|
|
|
5593c8 |
# We'd like to use grep -E, to see if any of LT_INIT,
|
|
|
5593c8 |
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
|
|
|
5593c8 |
# but that's not portable enough (e.g., for Solaris).
|
|
|
5593c8 |
grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
|
|
|
5593c8 |
&& use_libtool=1
|
|
|
5593c8 |
grep '^[ ]*LT_INIT' configure.ac >/dev/null \
|
|
|
5593c8 |
&& use_libtool=1
|
|
|
5593c8 |
if test $use_libtool = 1; then
|
|
|
5593c8 |
find_tool LIBTOOLIZE glibtoolize libtoolize
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
# gnulib-tool requires at least automake and autoconf.
|
|
|
5593c8 |
# If either is not listed, add it (with minimum version) as a prerequisite.
|
|
|
5593c8 |
case $buildreq in
|
|
|
5593c8 |
*automake*) ;;
|
|
|
5593c8 |
*) buildreq="automake 1.9
|
|
|
5593c8 |
$buildreq" ;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
case $buildreq in
|
|
|
5593c8 |
*autoconf*) ;;
|
|
|
5593c8 |
*) buildreq="autoconf 2.59
|
|
|
5593c8 |
$buildreq" ;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
|
|
|
5593c8 |
# When we can deduce that gnulib-tool will require patch,
|
|
|
5593c8 |
# and when patch is not already listed as a prerequisite, add it, too.
|
|
|
5593c8 |
if test -d "$local_gl_dir" \
|
|
|
5593c8 |
&& ! find "$local_gl_dir" -name '*.diff' -exec false {} +; then
|
|
|
5593c8 |
case $buildreq in
|
|
|
5593c8 |
*patch*) ;;
|
|
|
5593c8 |
*) buildreq="patch -
|
|
|
5593c8 |
$buildreq" ;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
if ! printf "$buildreq" | check_versions; then
|
|
|
5593c8 |
echo >&2
|
|
|
5593c8 |
if test -f README-prereq; then
|
|
|
5593c8 |
die "See README-prereq for how to get the prerequisite programs"
|
|
|
5593c8 |
else
|
|
|
5593c8 |
die "Please install the prerequisite programs"
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
# Warn the user if autom4te appears to be broken; this causes known
|
|
|
5593c8 |
# issues with at least gettext 0.18.3.
|
|
|
5593c8 |
probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -)
|
|
|
5593c8 |
if test "x$probe" != xhi; then
|
|
|
5593c8 |
warn_ "WARNING: your autom4te wrapper eats stdin;"
|
|
|
5593c8 |
warn_ "if bootstrap fails, consider upgrading your autotools"
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
echo "$0: Bootstrapping from checked-out $package sources..."
|
|
|
5593c8 |
|
|
|
5593c8 |
# See if we can use gnulib's git-merge-changelog merge driver.
|
|
|
5593c8 |
if $use_git && test -d .git && check_exists git; then
|
|
|
5593c8 |
if git config merge.merge-changelog.driver >/dev/null ; then
|
|
|
5593c8 |
:
|
|
|
5593c8 |
elif check_exists git-merge-changelog; then
|
|
|
5593c8 |
echo "$0: initializing git-merge-changelog driver"
|
|
|
5593c8 |
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
|
|
|
5593c8 |
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
|
|
|
5593c8 |
else
|
|
|
5593c8 |
echo "$0: consider installing git-merge-changelog from gnulib"
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
|
|
|
5593c8 |
cleanup_gnulib() {
|
|
|
5593c8 |
status=$?
|
|
|
5593c8 |
rm -fr "$gnulib_path"
|
|
|
5593c8 |
exit $status
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
git_modules_config () {
|
|
|
5593c8 |
test -f .gitmodules && git config --file .gitmodules "$@"
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
if $use_gnulib; then
|
|
|
5593c8 |
if $use_git; then
|
|
|
5593c8 |
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
|
|
5593c8 |
test -z "$gnulib_path" && gnulib_path=gnulib
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
|
|
|
5593c8 |
# submodule, for use in the rest of the script.
|
|
|
5593c8 |
|
|
|
5593c8 |
case ${GNULIB_SRCDIR--} in
|
|
|
5593c8 |
-)
|
|
|
5593c8 |
# Note that $use_git is necessarily true in this case.
|
|
|
5593c8 |
if git_modules_config submodule.gnulib.url >/dev/null; then
|
|
|
5593c8 |
echo "$0: getting gnulib files..."
|
|
|
5593c8 |
git submodule init -- "$gnulib_path" || exit $?
|
|
|
5593c8 |
git submodule update -- "$gnulib_path" || exit $?
|
|
|
5593c8 |
|
|
|
5593c8 |
elif [ ! -d "$gnulib_path" ]; then
|
|
|
5593c8 |
echo "$0: getting gnulib files..."
|
|
|
5593c8 |
|
|
|
5593c8 |
trap cleanup_gnulib 1 2 13 15
|
|
|
5593c8 |
|
|
|
5593c8 |
shallow=
|
|
|
5593c8 |
if test -z "$GNULIB_REVISION"; then
|
|
|
5593c8 |
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
|
|
|
5593c8 |
|| cleanup_gnulib
|
|
|
5593c8 |
|
|
|
5593c8 |
trap - 1 2 13 15
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
GNULIB_SRCDIR=$gnulib_path
|
|
|
5593c8 |
;;
|
|
|
5593c8 |
*)
|
|
|
5593c8 |
# Use GNULIB_SRCDIR directly or as a reference.
|
|
|
5593c8 |
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
|
|
|
5593c8 |
git_modules_config submodule.gnulib.url >/dev/null; then
|
|
|
5593c8 |
echo "$0: getting gnulib files..."
|
|
|
5593c8 |
if git submodule -h|grep -- --reference > /dev/null; then
|
|
|
5593c8 |
# Prefer the one-liner available in git 1.6.4 or newer.
|
|
|
5593c8 |
git submodule update --init --reference "$GNULIB_SRCDIR" \
|
|
|
5593c8 |
"$gnulib_path" || exit $?
|
|
|
5593c8 |
else
|
|
|
5593c8 |
# This fallback allows at least git 1.5.5.
|
|
|
5593c8 |
if test -f "$gnulib_path"/gnulib-tool; then
|
|
|
5593c8 |
# Since file already exists, assume submodule init already complete.
|
|
|
5593c8 |
git submodule update -- "$gnulib_path" || exit $?
|
|
|
5593c8 |
else
|
|
|
5593c8 |
# Older git can't clone into an empty directory.
|
|
|
5593c8 |
rmdir "$gnulib_path" 2>/dev/null
|
|
|
5593c8 |
git clone --reference "$GNULIB_SRCDIR" \
|
|
|
5593c8 |
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
|
|
5593c8 |
&& git submodule init -- "$gnulib_path" \
|
|
|
5593c8 |
&& git submodule update -- "$gnulib_path" \
|
|
|
5593c8 |
|| exit $?
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
GNULIB_SRCDIR=$gnulib_path
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
|
|
|
5593c8 |
if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \
|
|
|
5593c8 |
&& ! git_modules_config submodule.gnulib.url >/dev/null; then
|
|
|
5593c8 |
(cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
|
|
5593c8 |
# we no longer need to use git or $gnulib_path below here.
|
|
|
5593c8 |
|
|
|
5593c8 |
if $bootstrap_sync; then
|
|
|
5593c8 |
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
|
|
5593c8 |
echo "$0: updating bootstrap and restarting..."
|
|
|
5593c8 |
case $(sh -c 'echo "$1"' -- a) in
|
|
|
5593c8 |
a) ignored=--;;
|
|
|
5593c8 |
*) ignored=ignored;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
exec sh -c \
|
|
|
5593c8 |
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
|
|
5593c8 |
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
|
|
5593c8 |
"$0" "$@" --no-bootstrap-sync
|
|
|
5593c8 |
}
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
|
|
5593c8 |
<$gnulib_tool || exit $?
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
# Get translations.
|
|
|
5593c8 |
|
|
|
5593c8 |
download_po_files() {
|
|
|
5593c8 |
subdir=$1
|
|
|
5593c8 |
domain=$2
|
|
|
5593c8 |
echo "$me: getting translations into $subdir for $domain..."
|
|
|
5593c8 |
cmd=$(printf "$po_download_command_format" "$subdir" "$domain")
|
|
|
5593c8 |
eval "$cmd"
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
# Mirror .po files to $po_dir/.reference and copy only the new
|
|
|
5593c8 |
# or modified ones into $po_dir. Also update $po_dir/LINGUAS.
|
|
|
5593c8 |
# Note po files that exist locally only are left in $po_dir but will
|
|
|
5593c8 |
# not be included in LINGUAS and hence will not be distributed.
|
|
|
5593c8 |
update_po_files() {
|
|
|
5593c8 |
# Directory containing primary .po files.
|
|
|
5593c8 |
# Overwrite them only when we're sure a .po file is new.
|
|
|
5593c8 |
po_dir=$1
|
|
|
5593c8 |
domain=$2
|
|
|
5593c8 |
|
|
|
5593c8 |
# Mirror *.po files into this dir.
|
|
|
5593c8 |
# Usually contains *.s1 checksum files.
|
|
|
5593c8 |
ref_po_dir="$po_dir/.reference"
|
|
|
5593c8 |
|
|
|
5593c8 |
test -d $ref_po_dir || mkdir $ref_po_dir || return
|
|
|
5593c8 |
download_po_files $ref_po_dir $domain \
|
|
|
5593c8 |
&& ls "$ref_po_dir"/*.po 2>/dev/null |
|
|
|
5593c8 |
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
|
|
|
5593c8 |
|
|
|
5593c8 |
langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g')
|
|
|
5593c8 |
test "$langs" = '*' && langs=x
|
|
|
5593c8 |
for po in $langs; do
|
|
|
5593c8 |
case $po in x) continue;; esac
|
|
|
5593c8 |
new_po="$ref_po_dir/$po.po"
|
|
|
5593c8 |
cksum_file="$ref_po_dir/$po.s1"
|
|
|
5593c8 |
if ! test -f "$cksum_file" ||
|
|
|
5593c8 |
! test -f "$po_dir/$po.po" ||
|
|
|
5593c8 |
! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
|
|
|
5593c8 |
echo "$me: updated $po_dir/$po.po..."
|
|
|
5593c8 |
cp "$new_po" "$po_dir/$po.po" \
|
|
|
5593c8 |
&& $SHA1SUM < "$new_po" > "$cksum_file" || return
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
done
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
case $SKIP_PO in
|
|
|
5593c8 |
'')
|
|
|
5593c8 |
if test -d po; then
|
|
|
5593c8 |
update_po_files po $package || exit
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
if test -d runtime-po; then
|
|
|
5593c8 |
update_po_files runtime-po $package-runtime || exit
|
|
|
5593c8 |
fi;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
|
|
|
5593c8 |
symlink_to_dir()
|
|
|
5593c8 |
{
|
|
|
5593c8 |
src=$1/$2
|
|
|
5593c8 |
dst=${3-$2}
|
|
|
5593c8 |
|
|
|
5593c8 |
test -f "$src" && {
|
|
|
5593c8 |
|
|
|
5593c8 |
# If the destination directory doesn't exist, create it.
|
|
|
5593c8 |
# This is required at least for "lib/uniwidth/cjk.h".
|
|
|
5593c8 |
dst_dir=$(dirname "$dst")
|
|
|
5593c8 |
if ! test -d "$dst_dir"; then
|
|
|
5593c8 |
mkdir -p "$dst_dir"
|
|
|
5593c8 |
|
|
|
5593c8 |
# If we've just created a directory like lib/uniwidth,
|
|
|
5593c8 |
# tell version control system(s) it's ignorable.
|
|
|
5593c8 |
# FIXME: for now, this does only one level
|
|
|
5593c8 |
parent=$(dirname "$dst_dir")
|
|
|
5593c8 |
for dot_ig in x $vc_ignore; do
|
|
|
5593c8 |
test $dot_ig = x && continue
|
|
|
5593c8 |
ig=$parent/$dot_ig
|
|
|
5593c8 |
insert_vc_ignore $ig "${dst_dir##*/}"
|
|
|
5593c8 |
done
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
if $copy; then
|
|
|
5593c8 |
{
|
|
|
5593c8 |
test ! -h "$dst" || {
|
|
|
5593c8 |
echo "$me: rm -f $dst" &&
|
|
|
5593c8 |
rm -f "$dst"
|
|
|
5593c8 |
}
|
|
|
5593c8 |
} &&
|
|
|
5593c8 |
test -f "$dst" &&
|
|
|
5593c8 |
cmp -s "$src" "$dst" || {
|
|
|
5593c8 |
echo "$me: cp -fp $src $dst" &&
|
|
|
5593c8 |
cp -fp "$src" "$dst"
|
|
|
5593c8 |
}
|
|
|
5593c8 |
else
|
|
|
5593c8 |
# Leave any existing symlink alone, if it already points to the source,
|
|
|
5593c8 |
# so that broken build tools that care about symlink times
|
|
|
5593c8 |
# aren't confused into doing unnecessary builds. Conversely, if the
|
|
|
5593c8 |
# existing symlink's timestamp is older than the source, make it afresh,
|
|
|
5593c8 |
# so that broken tools aren't confused into skipping needed builds. See
|
|
|
5593c8 |
# <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
|
|
|
5593c8 |
test -h "$dst" &&
|
|
|
5593c8 |
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
|
|
|
5593c8 |
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
|
|
|
5593c8 |
test "$src_i" = "$dst_i" &&
|
|
|
5593c8 |
both_ls=$(ls -dt "$src" "$dst") &&
|
|
|
5593c8 |
test "X$both_ls" = "X$dst$nl$src" || {
|
|
|
5593c8 |
dot_dots=
|
|
|
5593c8 |
case $src in
|
|
|
5593c8 |
/*) ;;
|
|
|
5593c8 |
*)
|
|
|
5593c8 |
case /$dst/ in
|
|
|
5593c8 |
*//* | */../* | */./* | /*/*/*/*/*/)
|
|
|
5593c8 |
die "invalid symlink calculation: $src -> $dst";;
|
|
|
5593c8 |
/*/*/*/*/) dot_dots=../../../;;
|
|
|
5593c8 |
/*/*/*/) dot_dots=../../;;
|
|
|
5593c8 |
/*/*/) dot_dots=../;;
|
|
|
5593c8 |
esac;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
|
|
|
5593c8 |
echo "$me: ln -fs $dot_dots$src $dst" &&
|
|
|
5593c8 |
ln -fs "$dot_dots$src" "$dst"
|
|
|
5593c8 |
}
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
}
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
version_controlled_file() {
|
|
|
5593c8 |
parent=$1
|
|
|
5593c8 |
file=$2
|
|
|
5593c8 |
if test -d .git; then
|
|
|
5593c8 |
git rm -n "$file" > /dev/null 2>&1
|
|
|
5593c8 |
elif test -d .svn; then
|
|
|
5593c8 |
svn log -r HEAD "$file" > /dev/null 2>&1
|
|
|
5593c8 |
elif test -d CVS; then
|
|
|
5593c8 |
grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null |
|
|
|
5593c8 |
grep '^/[^/]*/[0-9]' > /dev/null
|
|
|
5593c8 |
else
|
|
|
5593c8 |
warn_ "no version control for $file?"
|
|
|
5593c8 |
false
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
}
|
|
|
5593c8 |
|
|
|
5593c8 |
# NOTE: we have to be careful to run both autopoint and libtoolize
|
|
|
5593c8 |
# before gnulib-tool, since gnulib-tool is likely to provide newer
|
|
|
5593c8 |
# versions of files "installed" by these two programs.
|
|
|
5593c8 |
# Then, *after* gnulib-tool (see below), we have to be careful to
|
|
|
5593c8 |
# run autoreconf in such a way that it does not run either of these
|
|
|
5593c8 |
# two just-pre-run programs.
|
|
|
5593c8 |
|
|
|
5593c8 |
# Import from gettext.
|
|
|
5593c8 |
with_gettext=yes
|
|
|
5593c8 |
grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
|
|
|
5593c8 |
with_gettext=no
|
|
|
5593c8 |
|
|
|
5593c8 |
if test $with_gettext = yes || test $use_libtool = 1; then
|
|
|
5593c8 |
|
|
|
5593c8 |
tempbase=.bootstrap$$
|
|
|
5593c8 |
trap "rm -f $tempbase.0 $tempbase.1" 1 2 13 15
|
|
|
5593c8 |
|
|
|
5593c8 |
> $tempbase.0 > $tempbase.1 &&
|
|
|
5593c8 |
find . ! -type d -print | sort > $tempbase.0 || exit
|
|
|
5593c8 |
|
|
|
5593c8 |
if test $with_gettext = yes; then
|
|
|
5593c8 |
# Released autopoint has the tendency to install macros that have been
|
|
|
5593c8 |
# obsoleted in current gnulib, so run this before gnulib-tool.
|
|
|
5593c8 |
echo "$0: $AUTOPOINT --force"
|
|
|
5593c8 |
$AUTOPOINT --force || exit
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
# Autoreconf runs aclocal before libtoolize, which causes spurious
|
|
|
5593c8 |
# warnings if the initial aclocal is confused by the libtoolized
|
|
|
5593c8 |
# (or worse out-of-date) macro directory.
|
|
|
5593c8 |
# libtoolize 1.9b added the --install option; but we support back
|
|
|
5593c8 |
# to libtoolize 1.5.22, where the install action was default.
|
|
|
5593c8 |
if test $use_libtool = 1; then
|
|
|
5593c8 |
install=
|
|
|
5593c8 |
case $($LIBTOOLIZE --help) in
|
|
|
5593c8 |
*--install*) install=--install ;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
echo "running: $LIBTOOLIZE $install --copy"
|
|
|
5593c8 |
$LIBTOOLIZE $install --copy
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
find . ! -type d -print | sort >$tempbase.1
|
|
|
5593c8 |
old_IFS=$IFS
|
|
|
5593c8 |
IFS=$nl
|
|
|
5593c8 |
for file in $(comm -13 $tempbase.0 $tempbase.1); do
|
|
|
5593c8 |
IFS=$old_IFS
|
|
|
5593c8 |
parent=${file%/*}
|
|
|
5593c8 |
version_controlled_file "$parent" "$file" || {
|
|
|
5593c8 |
for dot_ig in x $vc_ignore; do
|
|
|
5593c8 |
test $dot_ig = x && continue
|
|
|
5593c8 |
ig=$parent/$dot_ig
|
|
|
5593c8 |
insert_vc_ignore "$ig" "${file##*/}"
|
|
|
5593c8 |
done
|
|
|
5593c8 |
}
|
|
|
5593c8 |
done
|
|
|
5593c8 |
IFS=$old_IFS
|
|
|
5593c8 |
|
|
|
5593c8 |
rm -f $tempbase.0 $tempbase.1
|
|
|
5593c8 |
trap - 1 2 13 15
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
# Import from gnulib.
|
|
|
5593c8 |
|
|
|
5593c8 |
if $use_gnulib; then
|
|
|
5593c8 |
gnulib_tool_options="\
|
|
|
5593c8 |
--no-changelog\
|
|
|
5593c8 |
--aux-dir=$build_aux\
|
|
|
5593c8 |
--doc-base=$doc_base\
|
|
|
5593c8 |
--lib=$gnulib_name\
|
|
|
5593c8 |
--m4-base=$m4_base/\
|
|
|
5593c8 |
--source-base=$source_base/\
|
|
|
5593c8 |
--tests-base=$tests_base\
|
|
|
5593c8 |
--local-dir=$local_gl_dir\
|
|
|
5593c8 |
$gnulib_tool_option_extras\
|
|
|
5593c8 |
"
|
|
|
5593c8 |
if test $use_libtool = 1; then
|
|
|
5593c8 |
case "$gnulib_tool_options " in
|
|
|
5593c8 |
*' --libtool '*) ;;
|
|
|
5593c8 |
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
|
|
5593c8 |
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|
|
|
5593c8 |
|| die "gnulib-tool failed"
|
|
|
5593c8 |
|
|
|
5593c8 |
for file in $gnulib_files; do
|
|
|
5593c8 |
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
|
|
5593c8 |
|| die "failed to symlink $file"
|
|
|
5593c8 |
done
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
bootstrap_post_import_hook \
|
|
|
5593c8 |
|| die "bootstrap_post_import_hook failed"
|
|
|
5593c8 |
|
|
|
5593c8 |
# Don't proceed if there are uninitialized submodules. In particular,
|
|
|
5593c8 |
# the next step will remove dangling links, which might be links into
|
|
|
5593c8 |
# uninitialized submodules.
|
|
|
5593c8 |
#
|
|
|
5593c8 |
# Uninitialized submodules are listed with an initial dash.
|
|
|
5593c8 |
if $use_git && git submodule | grep '^-' >/dev/null; then
|
|
|
5593c8 |
die "some git submodules are not initialized. " \
|
|
|
5593c8 |
"Run 'git submodule init' and bootstrap again."
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
|
|
|
5593c8 |
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
|
|
|
5593c8 |
# The following requires GNU find 4.2.3 or newer. Considering the usual
|
|
|
5593c8 |
# portability constraints of this script, that may seem a very demanding
|
|
|
5593c8 |
# requirement, but it should be ok. Ignore any failure, which is fine,
|
|
|
5593c8 |
# since this is only a convenience to help developers avoid the relatively
|
|
|
5593c8 |
# unusual case in which a symlinked-to .m4 file is git-removed from gnulib
|
|
|
5593c8 |
# between successive runs of this script.
|
|
|
5593c8 |
find "$m4_base" "$source_base" \
|
|
|
5593c8 |
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
|
|
|
5593c8 |
-type l -xtype l -delete > /dev/null 2>&1
|
|
|
5593c8 |
|
|
|
5593c8 |
# Invoke autoreconf with --force --install to ensure upgrades of tools
|
|
|
5593c8 |
# such as ylwrap.
|
|
|
5593c8 |
AUTORECONFFLAGS="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS"
|
|
|
5593c8 |
|
|
|
5593c8 |
# Some systems (RHEL 5) are using ancient autotools, for which the
|
|
|
5593c8 |
# --no-recursive option had not been invented. Detect that lack and
|
|
|
5593c8 |
# omit the option when it's not supported. FIXME in 2017: remove this
|
|
|
5593c8 |
# hack when RHEL 5 autotools are updated, or when they become irrelevant.
|
|
|
5593c8 |
case $($AUTORECONF --help) in
|
|
|
5593c8 |
*--no-recursive*) AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive";;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
|
|
|
5593c8 |
# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
|
|
|
5593c8 |
echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS"
|
|
|
5593c8 |
AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \
|
|
|
5593c8 |
|| die "autoreconf failed"
|
|
|
5593c8 |
|
|
|
5593c8 |
# Get some extra files from gnulib, overriding existing files.
|
|
|
5593c8 |
for file in $gnulib_extra_files; do
|
|
|
5593c8 |
case $file in
|
|
|
5593c8 |
*/INSTALL) dst=INSTALL;;
|
|
|
5593c8 |
build-aux/*) dst=$build_aux/${file#build-aux/};;
|
|
|
5593c8 |
*) dst=$file;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
symlink_to_dir "$GNULIB_SRCDIR" $file $dst \
|
|
|
5593c8 |
|| die "failed to symlink $file"
|
|
|
5593c8 |
done
|
|
|
5593c8 |
|
|
|
5593c8 |
if test $with_gettext = yes; then
|
|
|
5593c8 |
# Create gettext configuration.
|
|
|
5593c8 |
echo "$0: Creating po/Makevars from po/Makevars.template ..."
|
|
|
5593c8 |
rm -f po/Makevars
|
|
|
5593c8 |
sed '
|
|
|
5593c8 |
/^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
|
|
|
5593c8 |
/^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
|
|
|
5593c8 |
/^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
|
|
|
5593c8 |
/^XGETTEXT_OPTIONS *=/{
|
|
|
5593c8 |
s/$/ \\/
|
|
|
5593c8 |
a\
|
|
|
5593c8 |
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
|
|
|
5593c8 |
}
|
|
|
5593c8 |
' po/Makevars.template >po/Makevars \
|
|
|
5593c8 |
|| die 'cannot generate po/Makevars'
|
|
|
5593c8 |
|
|
|
5593c8 |
# If the 'gettext' module is in use, grab the latest Makefile.in.in.
|
|
|
5593c8 |
# If only the 'gettext-h' module is in use, assume autopoint already
|
|
|
5593c8 |
# put the correct version of this file into place.
|
|
|
5593c8 |
case $gnulib_modules in
|
|
|
5593c8 |
*gettext-h*) ;;
|
|
|
5593c8 |
*gettext*)
|
|
|
5593c8 |
cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in \
|
|
|
5593c8 |
|| die "cannot create po/Makefile.in.in"
|
|
|
5593c8 |
;;
|
|
|
5593c8 |
esac
|
|
|
5593c8 |
|
|
|
5593c8 |
if test -d runtime-po; then
|
|
|
5593c8 |
# Similarly for runtime-po/Makevars, but not quite the same.
|
|
|
5593c8 |
rm -f runtime-po/Makevars
|
|
|
5593c8 |
sed '
|
|
|
5593c8 |
/^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
|
|
|
5593c8 |
/^subdir *=.*/s/=.*/= runtime-po/
|
|
|
5593c8 |
/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
|
|
|
5593c8 |
/^XGETTEXT_OPTIONS *=/{
|
|
|
5593c8 |
s/$/ \\/
|
|
|
5593c8 |
a\
|
|
|
5593c8 |
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
|
|
|
5593c8 |
}
|
|
|
5593c8 |
' po/Makevars.template >runtime-po/Makevars \
|
|
|
5593c8 |
|| die 'cannot generate runtime-po/Makevars'
|
|
|
5593c8 |
|
|
|
5593c8 |
# Copy identical files from po to runtime-po.
|
|
|
5593c8 |
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
fi
|
|
|
5593c8 |
|
|
|
5593c8 |
bootstrap_epilogue
|
|
|
5593c8 |
|
|
|
5593c8 |
echo "$0: done. Now you can run './configure'."
|
|
|
5593c8 |
|
|
|
5593c8 |
# Local variables:
|
|
|
5593c8 |
# eval: (add-hook 'before-save-hook 'time-stamp)
|
|
|
5593c8 |
# time-stamp-start: "scriptversion="
|
|
|
5593c8 |
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
|
|
5593c8 |
# time-stamp-time-zone: "UTC0"
|
|
|
5593c8 |
# time-stamp-end: "; # UTC"
|
|
|
5593c8 |
# End:
|