diff --git a/ChangeLog b/ChangeLog index 14054d9..4ab1e8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-08-17 Paul Eggert + + * bootstrap: Import from gnulib. + 2007-08-15 Paul Eggert * src/diff.c (compare_files): Use last_component rather than base_name, diff --git a/bootstrap b/bootstrap index 07d3dba..413ee7f 100755 --- a/bootstrap +++ b/bootstrap @@ -27,6 +27,8 @@ nl=' LC_ALL=C export LC_ALL +local_gl_dir=gl + # Temporary directory names. bt='._bootmp' bt_regex=`echo "$bt"| sed 's/\./[.]/g'` @@ -50,7 +52,7 @@ Options: --cvs-user=USERNAME Set the username to use when checking out sources from the gnulib repository. -If the file .bootstrap.conf exists in the current working directory, its +If the file bootstrap.conf exists in the current working directory, its contents are read as shell variables to configure the bootstrap. Running without arguments will suffice in most cases. @@ -59,6 +61,9 @@ Running without arguments will suffice in most cases. # Configuration. +# Name of the Makefile.am +gnulib_mk=gnulib.mk + # List of gnulib modules needed. gnulib_modules= @@ -67,8 +72,7 @@ gnulib_files= # Translation Project URL, for the registry of all projects # and for the translation-team master directory. -TP_URL='http://www.iro.umontreal.ca/translation/registry.cgi?domain=' -TP_PO_URL='http://www.iro.umontreal.ca/translation/teams/PO/' +TP_URL="http://translationproject.org/latest/" extract_package_name=' /^AC_INIT(/{ @@ -102,6 +106,9 @@ gnulib_extra_files=" doc/INSTALL " +# Additional gnulib-tool options to use. Use "\newline" to break lines. +gnulib_tool_option_extras= + # Other locale categories that need message catalogs. EXTRA_LOCALE_CATEGORIES= @@ -174,7 +181,8 @@ grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \ >/dev/null && found_aux_dir=yes if test $found_aux_dir = no; then echo "$0: expected line not found in configure.ac. Add the following:" >&2 - echo " AC_CONFIG_AUX_DIR([$build_aux])" >&2. + echo " AC_CONFIG_AUX_DIR([$build_aux])" >&2 + exit 1 fi # If $build_aux doesn't exist, create it now, otherwise some bits @@ -240,31 +248,12 @@ get_translations() { ?*) echo "$0: getting translations into $subdir for $domain..." && - (cd $subdir && rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'`) && - $WGET_COMMAND -O "$subdir/$domain.html" "$TP_URL$domain" && - - sed -n 's|.*"http://[^"]*/translation/teams/PO/\([^/"]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\1.\2|p' <"$subdir/$domain.html" | - sort -k 1,1 -k 2,2n -k2,2 -k3,3n -k3,3 -k4,4n -k4,4 -k5,5n -k5.5 | - awk -F. ' - { if (lang && $1 != lang) print lang, ver } - { lang = $1; ver = substr($0, index($0, ".") + 1) } - END { if (lang) print lang, ver } - ' | awk -v domain="$domain" -v subdir="$subdir" ' - { - lang = $1 - ver = $2 - urlfmt = "" - printf "{ $WGET_COMMAND -O %s/%s.po '\'"$TP_PO_URL"'/%s/%s-%s.%s.po'\'' &&\n", subdir, lang, lang, domain, ver, lang - printf " msgfmt -c -o /dev/null %s/%s.po || {\n", subdir, lang - printf " echo >&2 '\'"$0"': omitting translation for %s'\''\n", lang - printf " rm -f %s/%s.po; }; } &&\n", subdir, lang - } - END { print ":" } - ' | WGET_COMMAND="$WGET_COMMAND" sh;; + (cd $subdir && rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` && + $WGET_COMMAND -r -l1 -nd -np -A.po $TP_URL/$domain) + ;; esac && ls "$subdir"/*.po 2>/dev/null | - sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" && - rm -f "$subdir/$domain.html" + sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" } case $SKIP_PO in @@ -289,12 +278,18 @@ case $SKIP_PO in fi;; esac -symlink_to_gnulib() +symlink_to_dir() { - src=$GNULIB_SRCDIR/$1 - dst=${2-$1} + src=$1/$2 + dst=${3-$2} test -f "$src" && { + + # If the destination directory doesn't exist, create it. + # This is required at least for "lib/uniwidth/cjk.h". + dst_dir=`dirname "$dst"` + test -d "$dst_dir" || mkdir -p "$dst_dir" + if $copy; then { test ! -h "$dst" || { @@ -339,7 +334,9 @@ cp_mark_as_generated() cp_dst=$2 if cmp -s "$cp_src" "$GNULIB_SRCDIR/$cp_dst"; then - symlink_to_gnulib "$cp_dst" + symlink_to_dir "$GNULIB_SRCDIR" "$cp_dst" + elif cmp -s "$cp_src" "$local_gl_dir/$cp_dst"; then + symlink_to_dir $local_gl_dir "$cp_dst" else case $cp_dst in *.[ch]) c1='/* '; c2=' */';; @@ -392,18 +389,22 @@ slurp() { for dir in . `(cd $1 && find * -type d -print)`; do copied= sep= - for file in `ls $1/$dir`; do + for file in `ls -a $1/$dir`; do + case $file in + .|..) continue;; + .*) continue;; # FIXME: should all file names starting with "." be ignored? + esac test -d $1/$dir/$file && continue for excluded_file in $excluded_files; do test "$dir/$file" = "$excluded_file" && continue 2 done if test $file = Makefile.am; then - copied=$copied${sep}gnulib.mk; sep=$nl + copied=$copied${sep}$gnulib_mk; sep=$nl remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g" - sed "$remove_intl" $1/$dir/$file | cmp -s - $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 + sed "$remove_intl" $1/$dir/$file | cmp -s - $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 @@ -457,14 +458,15 @@ gnulib_tool_options="\ --m4-base $bt/m4/\ --source-base $bt/lib/\ --tests-base $bt/tests\ - --local-dir gl\ + --local-dir $local_gl_dir\ +$gnulib_tool_option_extras\ " echo "$0: $gnulib_tool $gnulib_tool_options --import ..." $gnulib_tool $gnulib_tool_options --import $gnulib_modules && slurp $bt || exit for file in $gnulib_files; do - symlink_to_gnulib $file || exit + symlink_to_dir "$GNULIB_SRCDIR" $file || exit done @@ -482,6 +484,24 @@ if test $with_gettext = yes; then rm -fr $bt $bt2 || exit fi +# Coreutils is unusual in that it generates some of its test-related +# Makefile.am files. That must be done before invoking automake. +mam_template=tests/Makefile.am.in +if test -f $mam_template; then + PERL=perl + for tool in cut head join pr sort tac tail test tr uniq wc; do + m=tests/$tool/Makefile.am + t=${m}t + rm -f $m $t + sed -n '1,/^##test-files-begin/p' $mam_template > $t + echo "x = $tool" >> $t + srcdir=tests/$tool + $PERL -I$srcdir -w -- tests/mk-script $srcdir --list >> $t + sed -n '/^##test-files-end/,$p' $mam_template >> $t + chmod -w $t + mv $t $m + done +fi # Reconfigure, getting other files. @@ -503,13 +523,13 @@ done # Get some extra files from gnulib, overriding existing files. - for file in $gnulib_extra_files; do case $file in */INSTALL) dst=INSTALL;; + build-aux/*) dst=$build_aux/`expr "$file" : 'build-aux/\(.*\)'`;; *) dst=$file;; esac - symlink_to_gnulib $file $dst || exit + symlink_to_dir "$GNULIB_SRCDIR" $file $dst || exit done if test $with_gettext = yes; then