|
|
#! /bin/sh |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scriptversion=2025-06-10.02; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
me="$0" |
|
|
medir=`dirname "$me"` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scriptlibversion=2025-09-07.23; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nl=' |
|
|
' |
|
|
|
|
|
|
|
|
LC_ALL=C |
|
|
export LC_ALL |
|
|
|
|
|
|
|
|
PERL="${PERL-perl}" |
|
|
|
|
|
default_gnulib_url=https://https.git.savannah.gnu.org/git/gnulib.git |
|
|
|
|
|
|
|
|
copyright_year=`echo "$scriptlibversion" | sed -e 's/[^0-9].*//'` |
|
|
copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc. |
|
|
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. |
|
|
This is free software: you are free to change and redistribute it. |
|
|
There is NO WARRANTY, to the extent permitted by law." |
|
|
|
|
|
|
|
|
warnf_ () |
|
|
{ |
|
|
warnf_format_=$1 |
|
|
shift |
|
|
nl=' |
|
|
' |
|
|
case $* in |
|
|
*$nl*) me_=$(printf "$me"|tr "$nl|" '??') |
|
|
printf "$warnf_format_" "$@" | sed "s|^|$me_: |" ;; |
|
|
*) printf "$me: $warnf_format_" "$@" ;; |
|
|
esac >&2 |
|
|
} |
|
|
|
|
|
|
|
|
warn_ () |
|
|
{ |
|
|
|
|
|
case $IFS in |
|
|
' '*) warnf_ '%s\n' "$*";; |
|
|
*) (IFS=' '; warn_ "$@");; |
|
|
esac |
|
|
} |
|
|
|
|
|
|
|
|
die() { warn_ "$@"; exit 1; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local_gl_dir=gl |
|
|
|
|
|
|
|
|
|
|
|
gnulib_mk=gnulib.mk |
|
|
|
|
|
|
|
|
gnulib_modules= |
|
|
|
|
|
|
|
|
gnulib_files= |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bootstrap_option_hook() { return 1; } |
|
|
|
|
|
|
|
|
|
|
|
bootstrap_print_option_usage_hook() { :; } |
|
|
|
|
|
|
|
|
|
|
|
bootstrap_post_pull_hook() { :; } |
|
|
|
|
|
|
|
|
|
|
|
bootstrap_post_import_hook() { :; } |
|
|
|
|
|
|
|
|
|
|
|
bootstrap_epilogue() { :; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
po_download_command_format=\ |
|
|
"wget --mirror --level=1 -nd -nv -A.po -P '%s' \ |
|
|
https://translationproject.org/latest/%s/" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extract_package_name=' |
|
|
/^AC_INIT(\[*/{ |
|
|
s/// |
|
|
/^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{ |
|
|
s//\1/ |
|
|
s/[],)].*// |
|
|
p |
|
|
q |
|
|
} |
|
|
s/[],)].*// |
|
|
p |
|
|
} |
|
|
' |
|
|
normalize_package_name=' |
|
|
s/^GNU // |
|
|
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ |
|
|
s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g |
|
|
' |
|
|
package=$(${AUTOCONF:-autoconf} --trace 'AC_INIT:$4' configure.ac 2>/dev/null) |
|
|
if test -z "$package"; then |
|
|
package=$(sed -n "$extract_package_name" configure.ac) \ |
|
|
|| die 'cannot find package name in configure.ac' |
|
|
fi |
|
|
package=$(echo "$package" | sed "$normalize_package_name") |
|
|
gnulib_name=lib$package |
|
|
|
|
|
build_aux=build-aux |
|
|
source_base=lib |
|
|
m4_base=m4 |
|
|
doc_base=doc |
|
|
tests_base=tests |
|
|
gnulib_extra_files=" |
|
|
build-aux/install-sh |
|
|
build-aux/mdate-sh |
|
|
build-aux/texinfo.tex |
|
|
build-aux/depcomp |
|
|
build-aux/config.guess |
|
|
build-aux/config.sub |
|
|
doc/INSTALL |
|
|
" |
|
|
|
|
|
|
|
|
gnulib_tool_option_extras= |
|
|
|
|
|
|
|
|
EXTRA_LOCALE_CATEGORIES= |
|
|
|
|
|
|
|
|
XGETTEXT_OPTIONS='\\\ |
|
|
--flag=_:1:pass-c-format\\\ |
|
|
--flag=N_:1:pass-c-format\\\ |
|
|
--flag=error:3:c-format --flag=error_at_line:5:c-format\\\ |
|
|
' |
|
|
|
|
|
|
|
|
COPYRIGHT_HOLDER='Free Software Foundation, Inc.' |
|
|
MSGID_BUGS_ADDRESS=bug-$package@gnu.org |
|
|
|
|
|
|
|
|
|
|
|
excluded_files= |
|
|
|
|
|
|
|
|
|
|
|
checkout_only_file=README-hacking |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vc_ignore=auto |
|
|
|
|
|
|
|
|
|
|
|
bootstrap_sync=false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
conffile=`dirname "$me"`/bootstrap.conf |
|
|
test -r "$conffile" && . "$conffile" |
|
|
|
|
|
|
|
|
|
|
|
check_exists() { |
|
|
if test "$1" = "--verbose"; then |
|
|
($2 --version </dev/null) >/dev/null 2>&1 |
|
|
if test $? -ge 126; then |
|
|
|
|
|
|
|
|
($2 --version </dev/null) |
|
|
fi |
|
|
else |
|
|
($1 --version </dev/null) >/dev/null 2>&1 |
|
|
fi |
|
|
|
|
|
test $? -lt 126 |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sort_ver() { |
|
|
ver1="$1" |
|
|
ver2="$2" |
|
|
|
|
|
|
|
|
i=1 |
|
|
while : ; do |
|
|
p1=$(echo "$ver1" | cut -d. -f$i) |
|
|
p2=$(echo "$ver2" | cut -d. -f$i) |
|
|
if [ ! "$p1" ]; then |
|
|
echo "$1 $2" |
|
|
break |
|
|
elif [ ! "$p2" ]; then |
|
|
echo "$2 $1" |
|
|
break |
|
|
elif [ ! "$p1" = "$p2" ]; then |
|
|
if [ "$p1" -gt "$p2" ] 2>/dev/null; then |
|
|
echo "$2 $1" |
|
|
elif [ "$p2" -gt "$p1" ] 2>/dev/null; then |
|
|
echo "$1 $2" |
|
|
else |
|
|
lp=$(printf "%s\n%s\n" "$p1" "$p2" | LANG=C sort -n | tail -n1) |
|
|
if [ "$lp" = "$p2" ]; then |
|
|
echo "$1 $2" |
|
|
else |
|
|
echo "$2 $1" |
|
|
fi |
|
|
fi |
|
|
break |
|
|
fi |
|
|
i=$(($i+1)) |
|
|
done |
|
|
} |
|
|
|
|
|
get_version_sed=' |
|
|
# Move version to start of line. |
|
|
s/.*[v ]\([0-9]\)/\1/ |
|
|
|
|
|
# Skip lines that do not start with version. |
|
|
/^[0-9]/!d |
|
|
|
|
|
# Remove characters after the version. |
|
|
s/[^.a-z0-9-].*// |
|
|
|
|
|
# The first component must be digits only. |
|
|
s/^\([0-9]*\)[a-z-].*/\1/ |
|
|
|
|
|
#the following essentially does s/5.005/5.5/ |
|
|
s/\.0*\([1-9]\)/.\1/g |
|
|
p |
|
|
q' |
|
|
|
|
|
get_version() { |
|
|
app=$1 |
|
|
|
|
|
$app --version >/dev/null 2>&1 || { $app --version; return 1; } |
|
|
|
|
|
$app --version 2>&1 | sed -n "$get_version_sed" |
|
|
} |
|
|
|
|
|
check_versions() { |
|
|
ret=0 |
|
|
|
|
|
while read app req_ver; do |
|
|
|
|
|
if test "$app" = libtool; then |
|
|
app=libtoolize |
|
|
fi |
|
|
|
|
|
if test "$app" = git; then |
|
|
$check_git || continue |
|
|
fi |
|
|
|
|
|
appvar=$(echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_') |
|
|
test "$appvar" = TAR && appvar=AMTAR |
|
|
case $appvar in |
|
|
GZIP) ;; |
|
|
PERL::*) ;; |
|
|
*) eval "app=\${$appvar-$app}" ;; |
|
|
esac |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case $app in |
|
|
automake-ng|aclocal-ng) |
|
|
app=${app%-ng} |
|
|
($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || { |
|
|
warn_ "Error: '$app' not found or not from Automake-NG" |
|
|
ret=1 |
|
|
continue |
|
|
} ;; |
|
|
|
|
|
|
|
|
perl::*) |
|
|
|
|
|
app="${app#perl::}" |
|
|
if ! $PERL -m"$app" -e 'exit 0' >/dev/null 2>&1; then |
|
|
warn_ "Error: perl module '$app' not found" |
|
|
ret=1 |
|
|
fi |
|
|
continue |
|
|
;; |
|
|
esac |
|
|
if [ "$req_ver" = "-" ]; then |
|
|
|
|
|
|
|
|
if ! check_exists --verbose $app; then |
|
|
warn_ "Error: '$app' not found" |
|
|
ret=1 |
|
|
fi |
|
|
else |
|
|
|
|
|
inst_ver=$(get_version $app) |
|
|
if [ ! "$inst_ver" ]; then |
|
|
warn_ "Error: '$app' not found" |
|
|
ret=1 |
|
|
else |
|
|
latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2) |
|
|
if [ ! "$latest_ver" = "$inst_ver" ]; then |
|
|
warnf_ '%s\n' \ |
|
|
"Error: '$app' version == $inst_ver is too old" \ |
|
|
" '$app' version >= $req_ver is required" |
|
|
ret=1 |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
done |
|
|
|
|
|
return $ret |
|
|
} |
|
|
|
|
|
print_versions() { |
|
|
echo "Program Min_version" |
|
|
echo "----------------------" |
|
|
printf %s "$buildreq" |
|
|
echo "----------------------" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
check_build_prerequisites() |
|
|
{ |
|
|
check_git="$1" |
|
|
|
|
|
|
|
|
|
|
|
case $buildreq in |
|
|
*automake*) ;; |
|
|
*) buildreq="automake 1.9 |
|
|
$buildreq" ;; |
|
|
esac |
|
|
case $buildreq in |
|
|
*autoconf*) ;; |
|
|
*) buildreq="autoconf 2.59 |
|
|
$buildreq" ;; |
|
|
esac |
|
|
|
|
|
|
|
|
|
|
|
if test -d "$local_gl_dir" \ |
|
|
&& ! find "$local_gl_dir" -name '*.diff' -exec false {} +; then |
|
|
case $buildreq in |
|
|
*patch*) ;; |
|
|
*) buildreq="patch - |
|
|
$buildreq" ;; |
|
|
esac |
|
|
fi |
|
|
|
|
|
if ! printf '%s' "$buildreq" | check_versions; then |
|
|
echo >&2 |
|
|
if test -f README-prereq; then |
|
|
die "See README-prereq for how to get the prerequisite programs" |
|
|
else |
|
|
die "Please install the prerequisite programs" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -) |
|
|
if test "x$probe" != xhi; then |
|
|
warn_ "WARNING: your autom4te wrapper eats stdin;" |
|
|
warn_ "if bootstrap fails, consider upgrading your autotools" |
|
|
fi |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
find_tool () |
|
|
{ |
|
|
find_tool_envvar=$1 |
|
|
shift |
|
|
find_tool_names=$@ |
|
|
eval "find_tool_res=\$$find_tool_envvar" |
|
|
if test x"$find_tool_res" = x; then |
|
|
for i; do |
|
|
if check_exists $i; then |
|
|
find_tool_res=$i |
|
|
break |
|
|
fi |
|
|
done |
|
|
fi |
|
|
if test x"$find_tool_res" = x; then |
|
|
warn_ "one of these is required: $find_tool_names;" |
|
|
die "alternatively set $find_tool_envvar to a compatible tool" |
|
|
fi |
|
|
eval "$find_tool_envvar=\$find_tool_res" |
|
|
eval "export $find_tool_envvar" |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleanup_gnulib() { |
|
|
status=$? |
|
|
rm -fr "$gnulib_path" |
|
|
exit $status |
|
|
} |
|
|
|
|
|
git_modules_config () { |
|
|
test -f .gitmodules && git config --file .gitmodules "$@" |
|
|
} |
|
|
|
|
|
prepare_GNULIB_SRCDIR () |
|
|
{ |
|
|
if test -n "$GNULIB_SRCDIR"; then |
|
|
|
|
|
|
|
|
|
|
|
test -f "$GNULIB_SRCDIR/gnulib-tool" \ |
|
|
|| die "Error: --gnulib-srcdir or \$GNULIB_SRCDIR is specified," \ |
|
|
"but does not contain gnulib-tool" |
|
|
if test -n "$GNULIB_REVISION" && $use_git; then |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
git -C "$GNULIB_SRCDIR" checkout "$GNULIB_REVISION" 2>/dev/null \ |
|
|
|| { git -C "$GNULIB_SRCDIR" fetch origin \ |
|
|
&& git -C "$GNULIB_SRCDIR" checkout "$GNULIB_REVISION"; } \ |
|
|
|| exit $? |
|
|
fi |
|
|
else |
|
|
if ! $use_git; then |
|
|
die "Error: --no-git is specified," \ |
|
|
"but neither --gnulib-srcdir nor \$GNULIB_SRCDIR is specified" |
|
|
fi |
|
|
if git submodule -h | grep -- --reference > /dev/null; then |
|
|
: |
|
|
else |
|
|
die "git version is too old, git >= 1.6.4 is required" |
|
|
fi |
|
|
gnulib_path=$(git_modules_config submodule.gnulib.path) |
|
|
if test -n "$gnulib_path"; then |
|
|
|
|
|
|
|
|
if test -n "$GNULIB_REFDIR" && test -d "$GNULIB_REFDIR"/.git; then |
|
|
|
|
|
echo "$0: getting gnulib files..." |
|
|
git submodule update --init --reference "$GNULIB_REFDIR" "$gnulib_path"\ |
|
|
|| exit $? |
|
|
else |
|
|
|
|
|
if git_modules_config submodule.gnulib.url >/dev/null; then |
|
|
echo "$0: getting gnulib files..." |
|
|
git submodule init -- "$gnulib_path" || exit $? |
|
|
git submodule update -- "$gnulib_path" || exit $? |
|
|
else |
|
|
die "Error: submodule 'gnulib' has no configured url" |
|
|
fi |
|
|
fi |
|
|
else |
|
|
gnulib_path='gnulib' |
|
|
if test ! -d "$gnulib_path"; then |
|
|
|
|
|
echo "$0: getting gnulib files..." |
|
|
trap cleanup_gnulib HUP INT PIPE TERM |
|
|
gnulib_url=${GNULIB_URL:-$default_gnulib_url} |
|
|
if test -n "$GNULIB_REFDIR" && test -d "$GNULIB_REFDIR"/.git; then |
|
|
|
|
|
git clone "$GNULIB_REFDIR" "$gnulib_path" \ |
|
|
&& git -C "$gnulib_path" remote set-url origin "$gnulib_url" \ |
|
|
&& if test -z "$GNULIB_REVISION"; then |
|
|
git -C "$gnulib_path" pull origin \ |
|
|
&& { |
|
|
|
|
|
|
|
|
|
|
|
default_branch=`LC_ALL=C git -C "$gnulib_path" \ |
|
|
remote show origin \ |
|
|
| sed -n -e 's/^ *HEAD branch: //p'` |
|
|
test -n "$default_branch" || default_branch='master' |
|
|
git -C "$gnulib_path" checkout "$default_branch" |
|
|
} |
|
|
else |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
git -C "$gnulib_path" checkout "$GNULIB_REVISION" 2>/dev/null \ |
|
|
|| { git -C "$gnulib_path" fetch origin \ |
|
|
&& git -C "$gnulib_path" checkout "$GNULIB_REVISION"; } |
|
|
fi \ |
|
|
|| cleanup_gnulib |
|
|
else |
|
|
|
|
|
shallow='--depth 2' |
|
|
if test -z "$GNULIB_REVISION"; then |
|
|
git clone $shallow "$gnulib_url" "$gnulib_path" \ |
|
|
|| cleanup_gnulib |
|
|
else |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mkdir -p "$gnulib_path" |
|
|
|
|
|
|
|
|
|
|
|
git -C "$gnulib_path" -c init.defaultBranch=master init |
|
|
git -C "$gnulib_path" remote add origin "$gnulib_url" |
|
|
if git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" |
|
|
then |
|
|
|
|
|
git -C "$gnulib_path" reset --hard FETCH_HEAD \ |
|
|
|| cleanup_gnulib |
|
|
|
|
|
|
|
|
|
|
|
revision=`git -C "$gnulib_path" log -1 --pretty=format:%H` |
|
|
branch=`LC_ALL=C git -C "$gnulib_path" remote show origin \ |
|
|
| sed -n -e 's/^ \([^ ]*\) * tracked$/\1/p'` |
|
|
test "$revision" = "$GNULIB_REVISION" \ |
|
|
|| test "$branch" = "$GNULIB_REVISION" \ |
|
|
|| git -C "$gnulib_path" tag "$GNULIB_REVISION" |
|
|
else |
|
|
|
|
|
git -C "$gnulib_path" fetch origin \ |
|
|
|| cleanup_gnulib |
|
|
git -C "$gnulib_path" checkout "$GNULIB_REVISION" \ |
|
|
|| cleanup_gnulib |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
trap - HUP INT PIPE TERM |
|
|
else |
|
|
|
|
|
if test -n "$GNULIB_REVISION"; then |
|
|
if test -d "$gnulib_path/.git"; then |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
git -C "$gnulib_path" checkout "$GNULIB_REVISION" 2>/dev/null \ |
|
|
|| { git -C "$gnulib_path" fetch origin \ |
|
|
&& git -C "$gnulib_path" checkout "$GNULIB_REVISION"; } \ |
|
|
|| exit $? |
|
|
else |
|
|
die "Error: GNULIB_REVISION is specified in bootstrap.conf," \ |
|
|
"but '$gnulib_path' contains no git history" |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
|
|
|
test -f "$gnulib_path/gnulib-tool" \ |
|
|
|| die "Error: '$gnulib_path' is supposed to contain a gnulib checkout," \ |
|
|
"but does not contain gnulib-tool" |
|
|
GNULIB_SRCDIR=$gnulib_path |
|
|
fi |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
upgrade_bootstrap () |
|
|
{ |
|
|
if test -f "$medir"/bootstrap-funclib.sh; then |
|
|
update_lib=true |
|
|
{ cmp -s "$medir"/bootstrap "$GNULIB_SRCDIR/top/bootstrap" \ |
|
|
&& cmp -s "$medir"/bootstrap-funclib.sh \ |
|
|
"$GNULIB_SRCDIR/top/bootstrap-funclib.sh" \ |
|
|
&& cmp -s "$medir"/autopull.sh "$GNULIB_SRCDIR/top/autopull.sh" \ |
|
|
&& cmp -s "$medir"/autogen.sh "$GNULIB_SRCDIR/top/autogen.sh"; \ |
|
|
} |
|
|
else |
|
|
update_lib=false |
|
|
cmp -s "$medir"/bootstrap "$GNULIB_SRCDIR/build-aux/bootstrap" |
|
|
fi || { |
|
|
if $update_lib; then |
|
|
echo "$0: updating bootstrap & companions and restarting..." |
|
|
else |
|
|
echo "$0: updating bootstrap and restarting..." |
|
|
fi |
|
|
case $(sh -c 'echo "$1"' -- a) in |
|
|
a) ignored=--;; |
|
|
*) ignored=ignored;; |
|
|
esac |
|
|
u=$update_lib |
|
|
exec sh -c \ |
|
|
'{ if '$u' && test -f "$1"; then cp "$1" "$3"; else cp "$2" "$3"; fi; } && |
|
|
{ if '$u' && test -f "$4"; then cp "$4" "$5"; else rm -f "$5"; fi; } && |
|
|
{ if '$u' && test -f "$6"; then cp "$6" "$7"; else rm -f "$7"; fi; } && |
|
|
{ if '$u' && test -f "$8"; then cp "$8" "$9"; else rm -f "$9"; fi; } && |
|
|
shift && shift && shift && shift && shift && |
|
|
shift && shift && shift && shift && |
|
|
exec "${CONFIG_SHELL-/bin/sh}" "$@"' \ |
|
|
$ignored \ |
|
|
"$GNULIB_SRCDIR/top/bootstrap" "$GNULIB_SRCDIR/build-aux/bootstrap" \ |
|
|
"$medir/bootstrap" \ |
|
|
"$GNULIB_SRCDIR/top/bootstrap-funclib.sh" "$medir/bootstrap-funclib.sh" \ |
|
|
"$GNULIB_SRCDIR/top/autopull.sh" "$medir/autopull.sh" \ |
|
|
"$GNULIB_SRCDIR/top/autogen.sh" "$medir/autogen.sh" \ |
|
|
"$0" "$@" --no-bootstrap-sync |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then |
|
|
use_gnulib=false |
|
|
else |
|
|
use_gnulib=true |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
autopull_usage() { |
|
|
cat <<EOF |
|
|
Usage: $me [OPTION]... |
|
|
Bootstrap this package from the checked-out sources, phase 1: |
|
|
Pull files from the network. |
|
|
|
|
|
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. |
|
|
GNULIB_URL URL of the gnulib repository. The default is |
|
|
$default_gnulib_url, |
|
|
which is Gnulib's upstream repository. |
|
|
|
|
|
Options: |
|
|
|
|
|
--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. |
|
|
|
|
|
--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 points to a gnulib repository |
|
|
with the correct revision. |
|
|
--skip-po Do not download *.po files. |
|
|
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 the environment variable GNULIB_SRCDIR is set, 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 the environment variable |
|
|
GNULIB_REFDIR is set 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 |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
autopull() |
|
|
{ |
|
|
|
|
|
|
|
|
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use_git=true |
|
|
|
|
|
for option |
|
|
do |
|
|
case $option in |
|
|
--help) |
|
|
autopull_usage |
|
|
return;; |
|
|
--version) |
|
|
set -e |
|
|
echo "autopull.sh $scriptlibversion" |
|
|
echo "$copyright" |
|
|
return 0 |
|
|
;; |
|
|
--skip-po) |
|
|
SKIP_PO=t;; |
|
|
--force) |
|
|
checkout_only_file=;; |
|
|
--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 |
|
|
|
|
|
$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 "Running this script from a non-checked-out distribution is risky." |
|
|
fi |
|
|
|
|
|
check_build_prerequisites $use_git |
|
|
|
|
|
if $use_gnulib || $bootstrap_sync; then |
|
|
prepare_GNULIB_SRCDIR |
|
|
if $bootstrap_sync; then |
|
|
upgrade_bootstrap "$@" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if test x"$SKIP_PO" = x; then |
|
|
find_tool SHA1SUM sha1sum gsha1sum shasum sha1 |
|
|
fi |
|
|
|
|
|
|
|
|
if $use_git && test -d .git && check_exists git; then |
|
|
if git config merge.merge-changelog.driver >/dev/null ; then |
|
|
: |
|
|
elif check_exists git-merge-changelog; then |
|
|
echo "$0: initializing git-merge-changelog driver" |
|
|
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver' |
|
|
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B' |
|
|
else |
|
|
echo "$0: consider installing git-merge-changelog from gnulib" |
|
|
fi |
|
|
fi |
|
|
|
|
|
case $SKIP_PO in |
|
|
'') |
|
|
if test -d po; then |
|
|
update_po_files po $package || return |
|
|
fi |
|
|
|
|
|
if test -d runtime-po; then |
|
|
update_po_files runtime-po $package-runtime || return |
|
|
fi;; |
|
|
esac |
|
|
|
|
|
|
|
|
|
|
|
bootstrap_post_pull_hook \ |
|
|
|| die "bootstrap_post_pull_hook failed" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if $use_git; then |
|
|
|
|
|
uninitialized=`git submodule | grep '^-' | awk '{ print $2 }'` |
|
|
if test -n "$GNULIB_SRCDIR"; then |
|
|
uninitialized=`echo "$uninitialized" | grep -v '^gnulib$'` |
|
|
fi |
|
|
if test -n "$uninitialized"; then |
|
|
uninit_comma=`echo "$uninitialized" | tr '\n' ',' | sed -e 's|,$|.|'` |
|
|
die "Some git submodules are not initialized: "$uninit_comma \ |
|
|
"Either use option '--no-git'," \ |
|
|
"or run 'git submodule update --init' and bootstrap again." |
|
|
fi |
|
|
fi |
|
|
|
|
|
if test -f "$medir"/autogen.sh; then |
|
|
echo "$0: done. Now you can run '$medir/autogen.sh'." |
|
|
fi |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
download_po_files() { |
|
|
subdir=$1 |
|
|
domain=$2 |
|
|
echo "$me: getting translations into $subdir for $domain..." |
|
|
cmd=$(printf "$po_download_command_format" "$subdir" "$domain") |
|
|
eval "$cmd" |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update_po_files() { |
|
|
|
|
|
|
|
|
po_dir=$1 |
|
|
domain=$2 |
|
|
|
|
|
|
|
|
|
|
|
ref_po_dir="$po_dir/.reference" |
|
|
|
|
|
test -d $ref_po_dir || mkdir $ref_po_dir || return |
|
|
download_po_files $ref_po_dir $domain \ |
|
|
&& ls "$ref_po_dir"/*.po 2>/dev/null | |
|
|
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return |
|
|
|
|
|
for po in x $(ls $ref_po_dir | sed -n 's/\.po$//p'); do |
|
|
case $po in x) continue;; esac |
|
|
new_po="$ref_po_dir/$po.po" |
|
|
cksum_file="$ref_po_dir/$po.s1" |
|
|
if ! test -f "$cksum_file" || |
|
|
! test -f "$po_dir/$po.po" || |
|
|
! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then |
|
|
echo "$me: updated $po_dir/$po.po..." |
|
|
cp "$new_po" "$po_dir/$po.po" \ |
|
|
&& $SHA1SUM < "$new_po" > "$cksum_file" || return |
|
|
fi |
|
|
done |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
autogen_usage() { |
|
|
cat <<EOF |
|
|
Usage: $me [OPTION]... |
|
|
Bootstrap this package from the checked-out sources, phase 2: |
|
|
Generate files from local files (no network access). |
|
|
|
|
|
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. |
|
|
|
|
|
Options: |
|
|
--copy Copy files instead of creating symbolic links. |
|
|
--force Attempt to bootstrap even if the sources seem |
|
|
not to have been checked out. |
|
|
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 are assumed to be present: |
|
|
* in \$GNULIB_SRCDIR, if that environment variable is set, |
|
|
* otherwise, in the 'gnulib' submodule, if such a submodule is configured, |
|
|
* otherwise, in the 'gnulib' subdirectory. |
|
|
|
|
|
Running without arguments will suffice in most cases. |
|
|
EOF |
|
|
} |
|
|
|
|
|
|
|
|
version_controlled_file() { |
|
|
parent=$1 |
|
|
file=$2 |
|
|
if test -d .git; then |
|
|
git rm -n "$file" > /dev/null 2>&1 |
|
|
elif test -d .svn; then |
|
|
svn log -r HEAD "$file" > /dev/null 2>&1 |
|
|
elif test -d CVS; then |
|
|
grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null | |
|
|
grep '^/[^/]*/[0-9]' > /dev/null |
|
|
else |
|
|
warn_ "no version control for $file?" |
|
|
false |
|
|
fi |
|
|
} |
|
|
|
|
|
|
|
|
gitignore_entries() { |
|
|
sed '/^#/d; /^$/d' "$@" |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
insert_if_absent() { |
|
|
file=$1 |
|
|
str=$2 |
|
|
test -f $file || touch $file |
|
|
test -r $file || die "Error: failed to read ignore file: $file" |
|
|
duplicate_entries=$(gitignore_entries $file | sort | uniq -d) |
|
|
if [ "$duplicate_entries" ] ; then |
|
|
die "Error: Duplicate entries in $file: " $duplicate_entries |
|
|
fi |
|
|
linesold=$(gitignore_entries $file | wc -l) |
|
|
linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l) |
|
|
if [ $linesold != $linesnew ] ; then |
|
|
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \ |
|
|
|| die "insert_if_absent $file $str: failed" |
|
|
fi |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
insert_vc_ignore() { |
|
|
vc_ignore_file="$1" |
|
|
pattern="$2" |
|
|
case $vc_ignore_file in |
|
|
*.gitignore) |
|
|
|
|
|
|
|
|
|
|
|
pattern=$(echo "$pattern" | sed s,^,/,);; |
|
|
esac |
|
|
insert_if_absent "$vc_ignore_file" "$pattern" |
|
|
} |
|
|
|
|
|
symlink_to_dir() |
|
|
{ |
|
|
src=$1/$2 |
|
|
dst=${3-$2} |
|
|
|
|
|
test -f "$src" && { |
|
|
|
|
|
|
|
|
|
|
|
dst_dir=$(dirname "$dst") |
|
|
if ! test -d "$dst_dir"; then |
|
|
mkdir -p "$dst_dir" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parent=$(dirname "$dst_dir") |
|
|
for dot_ig in x $vc_ignore; do |
|
|
test $dot_ig = x && continue |
|
|
ig=$parent/$dot_ig |
|
|
insert_vc_ignore $ig "${dst_dir##*/}/" |
|
|
done |
|
|
fi |
|
|
|
|
|
if $copy; then |
|
|
{ |
|
|
test ! -h "$dst" || { |
|
|
echo "$me: rm -f $dst" && |
|
|
rm -f "$dst" |
|
|
} |
|
|
} && |
|
|
test -f "$dst" && |
|
|
cmp -s "$src" "$dst" || { |
|
|
echo "$me: cp -fp $src $dst" && |
|
|
cp -fp "$src" "$dst" |
|
|
} |
|
|
else |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test -h "$dst" && |
|
|
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 && |
|
|
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 && |
|
|
test "$src_i" = "$dst_i" && |
|
|
both_ls=$(ls -dt "$src" "$dst") && |
|
|
test "X$both_ls" = "X$dst$nl$src" || { |
|
|
dot_dots= |
|
|
case $src in |
|
|
/*) ;; |
|
|
*) |
|
|
case /$dst/ in |
|
|
*//* | */../* | */./* | /*/*/*/*/*/) |
|
|
die "invalid symlink calculation: $src -> $dst";; |
|
|
/*/*/*/*/) dot_dots=../../../;; |
|
|
/*/*/*/) dot_dots=../../;; |
|
|
/*/*/) dot_dots=../;; |
|
|
esac;; |
|
|
esac |
|
|
|
|
|
echo "$me: ln -fs $dot_dots$src $dst" && |
|
|
ln -fs "$dot_dots$src" "$dst" |
|
|
} |
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
autogen() |
|
|
{ |
|
|
|
|
|
|
|
|
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
|
|
|
|
|
|
|
|
: "${AUTOPOINT=autopoint}" |
|
|
: "${AUTORECONF=autoreconf}" |
|
|
|
|
|
if test "$vc_ignore" = auto; then |
|
|
vc_ignore= |
|
|
test -d .git && vc_ignore=.gitignore |
|
|
test -d CVS && vc_ignore="$vc_ignore .cvsignore" |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
copy=false |
|
|
|
|
|
for option |
|
|
do |
|
|
case $option in |
|
|
--help) |
|
|
autogen_usage |
|
|
return;; |
|
|
--version) |
|
|
set -e |
|
|
echo "autogen.sh $scriptlibversion" |
|
|
echo "$copyright" |
|
|
return 0 |
|
|
;; |
|
|
--force) |
|
|
checkout_only_file=;; |
|
|
--copy) |
|
|
copy=true;; |
|
|
*) |
|
|
bootstrap_option_hook $option || die "$option: unknown option";; |
|
|
esac |
|
|
done |
|
|
|
|
|
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 "Running this script from a non-checked-out distribution is risky." |
|
|
fi |
|
|
|
|
|
if $use_gnulib; then |
|
|
if test -z "$GNULIB_SRCDIR"; then |
|
|
gnulib_path=$(test -f .gitmodules && |
|
|
git config --file .gitmodules submodule.gnulib.path) |
|
|
test -z "$gnulib_path" && gnulib_path=gnulib |
|
|
GNULIB_SRCDIR=$gnulib_path |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
found_aux_dir=no |
|
|
grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'])' configure.ac \ |
|
|
>/dev/null && found_aux_dir=yes |
|
|
grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \ |
|
|
>/dev/null && found_aux_dir=yes |
|
|
test $found_aux_dir = yes \ |
|
|
|| die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it" |
|
|
|
|
|
|
|
|
|
|
|
if test ! -d $build_aux; then |
|
|
mkdir $build_aux |
|
|
for dot_ig in x $vc_ignore; do |
|
|
test $dot_ig = x && continue |
|
|
insert_vc_ignore $dot_ig $build_aux/ |
|
|
done |
|
|
fi |
|
|
|
|
|
check_build_prerequisites false |
|
|
|
|
|
use_libtool=0 |
|
|
|
|
|
|
|
|
|
|
|
grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \ |
|
|
&& use_libtool=1 |
|
|
grep '^[ ]*LT_INIT' configure.ac >/dev/null \ |
|
|
&& use_libtool=1 |
|
|
if test $use_libtool = 1; then |
|
|
find_tool LIBTOOLIZE glibtoolize libtoolize |
|
|
fi |
|
|
|
|
|
if $use_gnulib; then |
|
|
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool |
|
|
<$gnulib_tool || return |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with_gettext=yes |
|
|
grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \ |
|
|
with_gettext=no |
|
|
|
|
|
if test $with_gettext = yes || test $use_libtool = 1; then |
|
|
|
|
|
tempbase=.bootstrap$$ |
|
|
trap "rm -f $tempbase.0 $tempbase.1" HUP INT PIPE TERM |
|
|
|
|
|
> $tempbase.0 > $tempbase.1 && |
|
|
find . ! -type d -print | sort > $tempbase.0 || return |
|
|
|
|
|
if test $with_gettext = yes; then |
|
|
|
|
|
|
|
|
echo "$0: $AUTOPOINT --force" |
|
|
$AUTOPOINT --force || return |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if test $use_libtool = 1; then |
|
|
install= |
|
|
case $($LIBTOOLIZE --help) in |
|
|
*--install*) install=--install ;; |
|
|
esac |
|
|
echo "running: $LIBTOOLIZE $install --copy" |
|
|
$LIBTOOLIZE $install --copy |
|
|
fi |
|
|
|
|
|
find . ! -type d -print | sort >$tempbase.1 |
|
|
old_IFS=$IFS |
|
|
IFS=$nl |
|
|
for file in $(comm -13 $tempbase.0 $tempbase.1); do |
|
|
IFS=$old_IFS |
|
|
parent=${file%/*} |
|
|
version_controlled_file "$parent" "$file" || { |
|
|
for dot_ig in x $vc_ignore; do |
|
|
test $dot_ig = x && continue |
|
|
ig=$parent/$dot_ig |
|
|
insert_vc_ignore "$ig" "${file##*/}" |
|
|
done |
|
|
} |
|
|
done |
|
|
IFS=$old_IFS |
|
|
|
|
|
rm -f $tempbase.0 $tempbase.1 |
|
|
trap - HUP INT PIPE TERM |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if $use_gnulib; then |
|
|
gnulib_tool_options="\ |
|
|
--no-changelog\ |
|
|
--aux-dir=$build_aux\ |
|
|
--doc-base=$doc_base\ |
|
|
--lib=$gnulib_name\ |
|
|
--m4-base=$m4_base/\ |
|
|
--source-base=$source_base/\ |
|
|
--tests-base=$tests_base\ |
|
|
--local-dir=$local_gl_dir\ |
|
|
$gnulib_tool_option_extras\ |
|
|
" |
|
|
if test $use_libtool = 1; then |
|
|
case "$gnulib_tool_options " in |
|
|
*' --libtool '*) ;; |
|
|
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;; |
|
|
esac |
|
|
fi |
|
|
echo "$0: $gnulib_tool $gnulib_tool_options --import ..." |
|
|
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \ |
|
|
|| die "gnulib-tool failed" |
|
|
|
|
|
if test $with_gettext = yes && test ! -f $m4_base/gettext.m4; then |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "$0: $AUTOPOINT --force" |
|
|
$AUTOPOINT --force || return |
|
|
|
|
|
echo "$0: $gnulib_tool $gnulib_tool_options --import ..." |
|
|
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \ |
|
|
|| die "gnulib-tool failed" |
|
|
fi |
|
|
|
|
|
for file in $gnulib_files; do |
|
|
symlink_to_dir "$GNULIB_SRCDIR" $file \ |
|
|
|| die "failed to symlink $file" |
|
|
done |
|
|
fi |
|
|
|
|
|
bootstrap_post_import_hook \ |
|
|
|| die "bootstrap_post_import_hook failed" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
find "$m4_base" "$source_base" \ |
|
|
-depth \( -name '*.m4' -o -name '*.[ch]' \) \ |
|
|
-type l -xtype l -delete > /dev/null 2>&1 |
|
|
|
|
|
|
|
|
|
|
|
AUTORECONFFLAGS="--verbose --install --force $ACLOCAL_FLAGS" |
|
|
AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive" |
|
|
|
|
|
|
|
|
echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS" |
|
|
AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \ |
|
|
|| die "autoreconf failed" |
|
|
|
|
|
|
|
|
for file in $gnulib_extra_files; do |
|
|
case $file in |
|
|
*/INSTALL) dst=INSTALL;; |
|
|
build-aux/*) dst=$build_aux/${file#build-aux/};; |
|
|
*) dst=$file;; |
|
|
esac |
|
|
symlink_to_dir "$GNULIB_SRCDIR" $file $dst \ |
|
|
|| die "failed to symlink $file" |
|
|
done |
|
|
|
|
|
if test $with_gettext = yes; then |
|
|
|
|
|
echo "$0: Creating po/Makevars from po/Makevars.template ..." |
|
|
rm -f po/Makevars |
|
|
sed ' |
|
|
/^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/ |
|
|
/^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/ |
|
|
/^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'| |
|
|
/^XGETTEXT_OPTIONS *=/{ |
|
|
s/$/ \\/ |
|
|
a\ |
|
|
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+} |
|
|
} |
|
|
' po/Makevars.template >po/Makevars \ |
|
|
|| die 'cannot generate po/Makevars' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case $gnulib_modules in |
|
|
*gettext-h*) ;; |
|
|
*gettext*) |
|
|
cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in \ |
|
|
|| die "cannot create po/Makefile.in.in" |
|
|
;; |
|
|
esac |
|
|
|
|
|
if test -d runtime-po; then |
|
|
|
|
|
rm -f runtime-po/Makevars |
|
|
sed ' |
|
|
/^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/ |
|
|
/^subdir *=.*/s/=.*/= runtime-po/ |
|
|
/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/ |
|
|
/^XGETTEXT_OPTIONS *=/{ |
|
|
s/$/ \\/ |
|
|
a\ |
|
|
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+} |
|
|
} |
|
|
' po/Makevars.template >runtime-po/Makevars \ |
|
|
|| die 'cannot generate runtime-po/Makevars' |
|
|
|
|
|
|
|
|
cp -p po/Makefile.in.in po/*-quot po/*.header po/*.sed po/*.sin runtime-po |
|
|
fi |
|
|
fi |
|
|
|
|
|
bootstrap_epilogue |
|
|
|
|
|
echo "$0: done. Now you can run './configure'." |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|