changeset 30258:303ee2a73955

have bootstrap initialize a `gnulib' submodule in a git checkout 2008-10-02 Paolo Bonzini <bonzini@gnu.org> * build-aux/bootstrap: Recognize `gnulib' being a submodule in a git repository, and initialize/update it accordingly.
author Paolo Bonzini <bonzini@gnu.org>
date Thu, 02 Oct 2008 10:57:50 +0200
parents 597f6f4a8c4f
children ad047166777f
files ChangeLog build-aux/bootstrap
diffstat 2 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Oct 02 10:00:46 2008 +0200
+++ b/ChangeLog	Thu Oct 02 10:57:50 2008 +0200
@@ -1,3 +1,8 @@
+2008-10-02  Paolo Bonzini  <bonzini@gnu.org>
+
+	* build-aux/bootstrap: Recognize `gnulib' being a submodule in a
+	git repository, and initialize/update it accordingly.
+
 2008-10-02  Jim Meyering  <meyering@redhat.com>
 
 	fts.c: sync with similar code from coreutils' remove.c
--- a/build-aux/bootstrap	Thu Oct 02 10:00:46 2008 +0200
+++ b/build-aux/bootstrap	Thu Oct 02 10:57:50 2008 +0200
@@ -224,11 +224,20 @@
   exit $status
 }
 
+git_modules_config () {
+  GIT_CONFIG_LOCAL=.gitmodules git config "$@"
+}
+
 # Get gnulib files.
 
 case ${GNULIB_SRCDIR--} in
 -)
-  if [ ! -d gnulib ]; then
+  if git_modules_config submodule.gnulib.url >/dev/null; then
+    echo "$0: getting gnulib files..."
+    git submodule init || exit $?
+    git submodule update || exit $?
+
+  elif [ ! -d gnulib ]; then
     echo "$0: getting gnulib files..."
 
     trap cleanup_gnulib 1 2 13 15
@@ -239,6 +248,20 @@
     trap - 1 2 13 15
   fi
   GNULIB_SRCDIR=gnulib
+  ;;
+*)
+  # 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 submodule init
+    GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
+    git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
+    echo "$0: getting gnulib files..."
+    git submodule update || exit $?
+    GNULIB_SRCDIR=gnulib
+  fi
+  ;;
 esac
 
 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool