summaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-09-13 20:44:56 +0200
committerJim Meyering <meyering@redhat.com>2009-09-17 14:20:55 +0200
commit25d7271ee830b2c950a59890436a80ac60ac6fc2 (patch)
treef08c677ec92896438124a38685a79000f1262a1b /bootstrap
parent2a6936fab4d4499a4b812dd330d3db50549029e0 (diff)
downloadparted-25d7271ee830b2c950a59890436a80ac60ac6fc2.tar.gz
build: sync bootstrap from coreutils
* bootstrap: Update from coreutils.
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap245
1 files changed, 139 insertions, 106 deletions
diff --git a/bootstrap b/bootstrap
index 5502a1d..eeb399a 100755
--- a/bootstrap
+++ b/bootstrap
@@ -34,7 +34,7 @@ bt_regex=`echo "$bt"| sed 's/\./[.]/g'`
bt2=${bt}2
usage() {
- echo >&2 "\
+ cat <<EOF
Usage: $0 [OPTION]...
Bootstrap this package from the checked-out sources.
@@ -56,7 +56,7 @@ For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
are honored.
Running without arguments will suffice in most cases.
-"
+EOF
}
# Configuration.
@@ -106,14 +106,14 @@ tests_base=tests
# Extra files from gnulib, which override files from other sources.
gnulib_extra_files="
- $build_aux/install-sh
- $build_aux/missing
- $build_aux/mdate-sh
- $build_aux/texinfo.tex
- $build_aux/depcomp
- $build_aux/config.guess
- $build_aux/config.sub
- doc/INSTALL
+ $build_aux/install-sh
+ $build_aux/missing
+ $build_aux/mdate-sh
+ $build_aux/texinfo.tex
+ $build_aux/depcomp
+ $build_aux/config.guess
+ $build_aux/config.sub
+ doc/INSTALL
"
# Additional gnulib-tool options to use. Use "\newline" to break lines.
@@ -148,6 +148,37 @@ copy=false
# on which version control system (if any) is used in the source directory.
vc_ignore=auto
+# find_tool ENVVAR NAMES...
+# -------------------------
+find_tool ()
+{
+ # Find sha1sum, named gsha1sum on MacPorts.
+ find_tool_envvar=$1
+ shift
+ if eval test x"\$$find_tool_envvar" = x; then
+ for i
+ do
+ if ($i --version </dev/null) >/dev/null 2>&1; then
+ find_tool_res=$i
+ break
+ fi
+ done
+ fi
+ if test x"$find_tool_res" = x; then
+ echo >&2 "$0: $find_tool_name is required"
+ exit 1
+ fi
+ ($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
+ echo >&2 "$0: cannot run $find_tool_res --version"
+ exit 1
+ }
+ eval "$find_tool_envvar=\"$find_tool_res\""
+ eval "export $find_tool_envvar"
+}
+
+# Find sha1sum, named gsha1sum on MacPorts.
+find_tool SHA1SUM sha1sum gsha1sum
+
# Override the default configuration, if necessary.
# Make sure that bootstrap.conf is sourced from the current directory
# if we were invoked as "sh bootstrap".
@@ -231,11 +262,11 @@ fi
# version formats or redundant trailing .0 in bootstrap.conf.
# If we did want full compatibility then we should probably
# use m4_version_compare from autoconf.
-sort_ver() { #sort -V is not generally available
+sort_ver() { # sort -V is not generally available
ver1="$1"
ver2="$2"
- #split on '.' and compare each component
+ # split on '.' and compare each component
i=1
while : ; do
p1=$(echo "$ver1" | cut -d. -f$i)
@@ -247,11 +278,11 @@ sort_ver() { #sort -V is not generally available
echo "$2 $1"
break
elif [ ! "$p1" = "$p2" ]; then
- if [ "$p1" -gt "$p2" ] 2>/dev/null; then #numeric comparision
+ if [ "$p1" -gt "$p2" ] 2>/dev/null; then # numeric comparison
echo "$2 $1"
- elif [ "$p2" -gt "$p1" ] 2>/dev/null; then #numeric comparision
+ elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison
echo "$1 $2"
- else #numeric, then lexographic comparison
+ else # numeric, then lexicographic comparison
lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1)
if [ "$lp" = "$p2" ]; then
echo "$1 $2"
@@ -272,10 +303,10 @@ get_version() {
$app --version 2>&1 |
sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
- t done
- d
- :done
- q'
+ t done
+ d
+ :done
+ q'
}
check_versions() {
@@ -308,12 +339,12 @@ print_versions() {
echo "----------------------"
printf "$buildreq"
echo "----------------------"
- #can't depend on column -t
+ # can't depend on column -t
}
if ! printf "$buildreq" | check_versions; then
test -f README-prereq &&
- echo "Please see README-prereq for notes on obtaining these prerequisite programs:" >&2
+ echo "See README-prereq for notes on obtaining these prerequisite programs:" >&2
echo
print_versions
exit 1
@@ -342,7 +373,7 @@ cleanup_gnulib() {
}
git_modules_config () {
- GIT_CONFIG=.gitmodules git config "$@"
+ test -f .gitmodules && git config --file .gitmodules "$@"
}
# Get gnulib files.
@@ -359,8 +390,8 @@ case ${GNULIB_SRCDIR--} in
trap cleanup_gnulib 1 2 13 15
- git clone --help|grep depth > /dev/null && depth='--depth 2' || depth=
- git clone $depth git://git.sv.gnu.org/gnulib ||
+ git clone --help|grep depth > /dev/null && shallow='--depth 2' || shallow=
+ git clone $shallow git://git.sv.gnu.org/gnulib ||
cleanup_gnulib
trap - 1 2 13 15
@@ -371,7 +402,7 @@ case ${GNULIB_SRCDIR--} in
# Redirect the gnulib submodule to the directory on the command line
# if possible.
if test -d "$GNULIB_SRCDIR"/.git && \
- git_modules_config submodule.gnulib.url >/dev/null; then
+ git_modules_config submodule.gnulib.url >/dev/null; then
git submodule init
GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
@@ -419,10 +450,12 @@ update_po_files() {
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-sha1sum} -c --status "$cksum_file" < "$new_po" > /dev/null; then
+ ! test -f "$po_dir/$po.po" ||
+ ! $SHA1SUM -c --status "$cksum_file" \
+ < "$new_po" > /dev/null; then
echo "updated $po_dir/$po.po..."
- cp "$new_po" "$po_dir/$po.po" && ${SHA1SUM-sha1sum} < "$new_po" > "$cksum_file"
+ cp "$new_po" "$po_dir/$po.po" \
+ && $SHA1SUM < "$new_po" > "$cksum_file"
fi
done
}
@@ -456,45 +489,45 @@ symlink_to_dir()
# FIXME: for now, this does only one level
parent=`dirname "$dst_dir"`
for dot_ig in x $vc_ignore; do
- test $dot_ig = x && continue
- ig=$parent/$dot_ig
- insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'`
+ test $dot_ig = x && continue
+ ig=$parent/$dot_ig
+ insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'`
done
fi
if $copy; then
{
- test ! -h "$dst" || {
- echo "$0: rm -f $dst" &&
- rm -f "$dst"
- }
+ test ! -h "$dst" || {
+ echo "$0: rm -f $dst" &&
+ rm -f "$dst"
+ }
} &&
test -f "$dst" &&
cmp -s "$src" "$dst" || {
- echo "$0: cp -fp $src $dst" &&
- cp -fp "$src" "$dst"
+ echo "$0: 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" || {
- dot_dots=
- case $src in
- /*) ;;
- *)
- case /$dst/ in
- *//* | */../* | */./* | /*/*/*/*/*/)
- echo >&2 "$0: invalid symlink calculation: $src -> $dst"
- exit 1;;
- /*/*/*/*/) dot_dots=../../../;;
- /*/*/*/) dot_dots=../../;;
- /*/*/) dot_dots=../;;
- esac;;
- esac
-
- echo "$0: ln -fs $dot_dots$src $dst" &&
- ln -fs "$dot_dots$src" "$dst"
+ dot_dots=
+ case $src in
+ /*) ;;
+ *)
+ case /$dst/ in
+ *//* | */../* | */./* | /*/*/*/*/*/)
+ echo >&2 "$0: invalid symlink calculation: $src -> $dst"
+ exit 1;;
+ /*/*/*/*/) dot_dots=../../../;;
+ /*/*/*/) dot_dots=../../;;
+ /*/*/) dot_dots=../;;
+ esac;;
+ esac
+
+ echo "$0: ln -fs $dot_dots$src $dst" &&
+ ln -fs "$dot_dots$src" "$dst"
}
fi
}
@@ -524,28 +557,28 @@ cp_mark_as_generated()
if test -z "$c1"; then
cmp -s "$cp_src" "$cp_dst" || {
- # Copy the file first to get proper permissions if it
- # doesn't already exist. Then overwrite the copy.
- echo "$0: cp -f $cp_src $cp_dst" &&
- rm -f "$cp_dst" &&
- cp "$cp_src" "$cp_dst-t" &&
- sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
- mv -f "$cp_dst-t" "$cp_dst"
+ # Copy the file first to get proper permissions if it
+ # doesn't already exist. Then overwrite the copy.
+ echo "$0: cp -f $cp_src $cp_dst" &&
+ rm -f "$cp_dst" &&
+ cp "$cp_src" "$cp_dst-t" &&
+ sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
+ mv -f "$cp_dst-t" "$cp_dst"
}
else
# Copy the file first to get proper permissions if it
# doesn't already exist. Then overwrite the copy.
cp "$cp_src" "$cp_dst-t" &&
(
- echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
- echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
- sed "s!$bt_regex/!!g" "$cp_src"
+ echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
+ echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
+ sed "s!$bt_regex/!!g" "$cp_src"
) > $cp_dst-t &&
if cmp -s "$cp_dst-t" "$cp_dst"; then
- rm -f "$cp_dst-t"
+ rm -f "$cp_dst-t"
else
- echo "$0: cp $cp_src $cp_dst # with edits" &&
- mv -f "$cp_dst-t" "$cp_dst"
+ echo "$0: cp $cp_src $cp_dst # with edits" &&
+ mv -f "$cp_dst-t" "$cp_dst"
fi
fi
fi
@@ -557,7 +590,7 @@ version_controlled_file() {
found=no
if test -d CVS; then
grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
- grep '^/[^/]*/[0-9]' > /dev/null && found=yes
+ grep '^/[^/]*/[0-9]' > /dev/null && found=yes
elif test -d .git; then
git rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
elif test -d .svn; then
@@ -579,35 +612,35 @@ slurp() {
esac
test -d $1/$dir/$file && continue
for excluded_file in $excluded_files; do
- test "$dir/$file" = "$excluded_file" && continue 2
+ test "$dir/$file" = "$excluded_file" && continue 2
done
if test $file = Makefile.am; then
copied=$copied${sep}$gnulib_mk; sep=$nl
- remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
+ remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null || {
- echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
- rm -f $dir/$gnulib_mk &&
- sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
- }
+ echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
+ rm -f $dir/$gnulib_mk &&
+ sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
+ }
elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
- version_controlled_file $dir $file; then
- echo "$0: $dir/$file overrides $1/$dir/$file"
+ version_controlled_file $dir $file; then
+ echo "$0: $dir/$file overrides $1/$dir/$file"
else
- copied=$copied$sep$file; sep=$nl
- if test $file = gettext.m4; then
- echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
- rm -f $dir/$file
- sed '
- /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
- AC_DEFUN([AM_INTL_SUBDIR], [
- /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
- AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
- $a\
- AC_DEFUN([gl_LOCK_EARLY], [])
- ' $1/$dir/$file >$dir/$file
- else
- cp_mark_as_generated $1/$dir/$file $dir/$file
- fi
+ copied=$copied$sep$file; sep=$nl
+ if test $file = gettext.m4; then
+ echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
+ rm -f $dir/$file
+ sed '
+ /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
+ AC_DEFUN([AM_INTL_SUBDIR], [
+ /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
+ AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
+ $a\
+ AC_DEFUN([gl_LOCK_EARLY], [])
+ ' $1/$dir/$file >$dir/$file
+ else
+ cp_mark_as_generated $1/$dir/$file $dir/$file
+ fi
fi || exit
done
@@ -615,18 +648,18 @@ slurp() {
test $dot_ig = x && continue
ig=$dir/$dot_ig
if test -n "$copied"; then
- insert_sorted_if_absent $ig "$copied"
- # If an ignored file name ends with .in.h, then also add
- # the name with just ".h". Many gnulib headers are generated,
- # e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc.
- # Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
- f=`echo "$copied"|sed 's/\.in\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
- insert_sorted_if_absent $ig "$f"
-
- # For files like sys_stat.in.h and sys_time.in.h, record as
- # ignorable the directory we might eventually create: sys/.
- f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'`
- insert_sorted_if_absent $ig "$f"
+ insert_sorted_if_absent $ig "$copied"
+ # If an ignored file name ends with .in.h, then also add
+ # the name with just ".h". Many gnulib headers are generated,
+ # e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc.
+ # Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
+ f=`echo "$copied"|sed 's/\.in\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
+ insert_sorted_if_absent $ig "$f"
+
+ # For files like sys_stat.in.h and sys_time.in.h, record as
+ # ignorable the directory we might eventually create: sys/.
+ f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'`
+ insert_sorted_if_absent $ig "$f"
fi
done
done
@@ -732,7 +765,7 @@ if test $with_gettext = yes; then
/^XGETTEXT_OPTIONS *=/{
s/$/ \\/
a\
- '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
+ '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
}
' po/Makevars.template >po/Makevars
@@ -744,9 +777,9 @@ if test $with_gettext = yes; then
/^subdir *=.*/s/=.*/= runtime-po/
/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
/^XGETTEXT_OPTIONS *=/{
- s/$/ \\/
- a\
- '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
+ s/$/ \\/
+ a\
+ '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
}
' <po/Makevars.template >runtime-po/Makevars