bootstrap: allow for alternate submodule location
authorEric Blake <eblake@redhat.com>
Mon, 22 Feb 2010 17:59:33 +0000 (10:59 -0700)
committerEric Blake <eblake@redhat.com>
Mon, 22 Feb 2010 23:01:05 +0000 (16:01 -0700)
Libvirt sets submodule.gnulib.path to ".gnulib".  Also, it does
not need gnulib.mk, but directly uses Makefile.am.

* build-aux/bootstrap (gnulib_path): New variable; use instead of
hardcoding submodule location.
(gnulib_mk): Allow direct use of Makefile.am.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
build-aux/bootstrap

index 916b311..2056add 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-02-22  Eric Blake  <eblake@redhat.com>
 
+       bootstrap: allow for alternate submodule location
+       * build-aux/bootstrap (gnulib_path): New variable; use instead of
+       hardcoding submodule location.
+       (gnulib_mk): Allow direct use of Makefile.am.
+
        bootstrap: use GNULIB_SRCDIR to reduce disk usage
        * build-aux/bootstrap (GNULIB_SRCDIR): If set, use as a reference,
        rather than reconfiguring where the submodule points.
index 1595d1b..4b947eb 100755 (executable)
@@ -390,7 +390,7 @@ fi
 
 cleanup_gnulib() {
   status=$?
-  rm -fr gnulib
+  rm -fr "$gnulib_path"
   exit $status
 }
 
@@ -398,6 +398,8 @@ git_modules_config () {
   test -f .gitmodules && git config --file .gitmodules "$@"
 }
 
+gnulib_path=`git_modules_config submodule.gnulib.path`
+
 # Get gnulib files.
 
 case ${GNULIB_SRCDIR--} in
@@ -407,26 +409,27 @@ case ${GNULIB_SRCDIR--} in
     git submodule init || exit $?
     git submodule update || exit $?
 
-  elif [ ! -d gnulib ]; then
+  elif [ ! -d "$gnulib_path" ]; then
     echo "$0: getting gnulib files..."
 
     trap cleanup_gnulib 1 2 13 15
 
     git clone --help|grep depth > /dev/null && shallow='--depth 2' || shallow=
-    git clone $shallow git://git.sv.gnu.org/gnulib ||
+    git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
       cleanup_gnulib
 
     trap - 1 2 13 15
   fi
-  GNULIB_SRCDIR=gnulib
+  GNULIB_SRCDIR=$gnulib_path
   ;;
 *)
   # Use GNULIB_SRCDIR as a reference.  Assumes git 1.6.4 or newer.
   if test -d "$GNULIB_SRCDIR"/.git && \
         git_modules_config submodule.gnulib.url >/dev/null; then
     echo "$0: getting gnulib files..."
-    git submodule update --init --reference "$GNULIB_SRCDIR" gnulib || exit $?
-    GNULIB_SRCDIR=gnulib
+    git submodule update --init --reference "$GNULIB_SRCDIR" \
+        "$gnulib_path" || exit $?
+    GNULIB_SRCDIR=$gnulib_path
   fi
   ;;
 esac
@@ -632,7 +635,7 @@ slurp() {
       for excluded_file in $excluded_files; do
         test "$dir/$file" = "$excluded_file" && continue 2
       done
-      if test $file = Makefile.am; then
+      if test $file = Makefile.am && test "X$gnulib_mk" != XMakefile.am; then
         copied=$copied${sep}$gnulib_mk; sep=$nl
         remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
         sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null || {