Use "git COMMAND", not "git-COMMAND".
[pspp] / build-aux / bootstrap
index 295e92a3e914dd2e7dc5d6918bd102442744eeb0..6fa1553dbc2cc61ad656de6447b5bca2118a0870 100755 (executable)
@@ -2,7 +2,7 @@
 
 # Bootstrap this package from checked-out sources.
 
-# Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2003-2008 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -23,7 +23,6 @@ nl='
 '
 
 # Ensure file names are sorted consistently across platforms.
-# Also, ensure diagnostics are in English, e.g., "wget --help" below.
 LC_ALL=C
 export LC_ALL
 
@@ -49,8 +48,6 @@ Options:
  --force                  Attempt to bootstrap even if the sources seem
                           not to have been checked out.
  --skip-po                Do not download po files.
- --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
 contents are read as shell variables to configure the bootstrap.
@@ -80,9 +77,10 @@ po_download_command_format=\
 
 extract_package_name='
   /^AC_INIT(/{
-     /.*,.*,.*,/{
+     /.*,.*,.*, */{
        s///
        s/[][]//g
+       s/)$//
        p
        q
      }
@@ -123,6 +121,9 @@ XGETTEXT_OPTIONS='\\\
  --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
 '
 
+# Package bug report address for gettext files
+MSGID_BUGS_ADDRESS=bug-$package@gnu.org
+
 # Files we don't want to import.
 excluded_files=
 
@@ -160,8 +161,6 @@ do
     exit;;
   --gnulib-srcdir=*)
     GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
-  --cvs-user=*)
-    CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
   --skip-po)
     SKIP_PO=t;;
   --force)
@@ -227,23 +226,9 @@ case ${GNULIB_SRCDIR--} in
   if [ ! -d gnulib ]; then
     echo "$0: getting gnulib files..."
 
-    case ${CVS_AUTH-pserver} in
-    pserver)
-      CVS_PREFIX=':pserver:anonymous@';;
-    ssh)
-      CVS_PREFIX="$CVS_USER${CVS_USER+@}";;
-    *)
-      echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
-      exit 1;;
-    esac
-
-    case $CVS_RSH in
-    '') CVS_RSH=ssh; export CVS_RSH;;
-    esac
-
     trap cleanup_gnulib 1 2 13 15
 
-    cvs -z3 -q -d ${CVS_PREFIX}cvs.savannah.gnu.org:/cvsroot/gnulib co gnulib ||
+    git clone --depth 2 git://git.sv.gnu.org/gnulib ||
       cleanup_gnulib
 
     trap - 1 2 13 15
@@ -281,13 +266,17 @@ update_po_files() {
     && ls "$ref_po_dir"/*.po 2>/dev/null |
       sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS"
 
+  langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
+  test "$langs" = '*' && langs=x
   for po in `cd $ref_po_dir && echo *.po|sed 's/\.po//g'`; do
-     new_po="$ref_po_dir/$po.po"
-     cksum_file="$ref_po_dir/$po.s1"
-     if ! sha1sum -c --status "$cksum_file" < "$new_po" > /dev/null; then
-       echo "updated $po_dir/$po.po..."
-       cp "$new_po" "$po_dir/$po.po" && sha1sum < "$new_po" > "$cksum_file"
-     fi
+    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" ||
+       ! sha1sum -c --status "$cksum_file" < "$new_po" > /dev/null; then
+      echo "updated $po_dir/$po.po..."
+      cp "$new_po" "$po_dir/$po.po" && sha1sum < "$new_po" > "$cksum_file"
+    fi
   done
 }
 
@@ -381,6 +370,11 @@ cp_mark_as_generated()
       *)                  c1=     ; c2=     ;;
     esac
 
+    # If the destination directory doesn't exist, create it.
+    # This is required at least for "lib/uniwidth/cjk.h".
+    dst_dir=`dirname "$cp_dst"`
+    test -d "$dst_dir" || mkdir -p "$dst_dir"
+
     if test -z "$c1"; then
       cmp -s "$cp_src" "$cp_dst" || {
        echo "$0: cp -f $cp_src $cp_dst" &&
@@ -414,7 +408,7 @@ version_controlled_file() {
     grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
             grep '^/[^/]*/[0-9]' > /dev/null && found=yes
   elif test -d .git; then
-    git-rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
+    git rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
   else
     echo "$0: no version control for $dir/$file?" >&2
   fi
@@ -469,16 +463,16 @@ slurp() {
       ig=$dir/$dot_ig
       if test -n "$copied"; then
        insert_sorted_if_absent $ig "$copied"
-       # If an ignored file name ends with _.h, then also add
+       # 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_.h -> stdint.h, dirent_.h ->..., etc.
+       # 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/_\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
+       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_.h and sys_time_.h, record as
+       # 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_.*_\.h$/sys/'`
+       f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'`
        insert_sorted_if_absent $ig "$f"
       fi
     done
@@ -502,7 +496,7 @@ gnulib_tool_options="\
  --source-base $bt/lib/\
  --tests-base $bt/tests\
  --local-dir $local_gl_dir\
-$gnulib_tool_option_extras\
+ $gnulib_tool_option_extras\
 "
 echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
 $gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
@@ -581,7 +575,7 @@ if test $with_gettext = yes; then
   rm -f po/Makevars
   sed '
     /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
-    /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
+    /^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
     /^XGETTEXT_OPTIONS *=/{
       s/$/ \\/
       a\