]> git.proxmox.com Git - grub2.git/blobdiff - autogen.sh
Add facility to debug GRUB with gdb under qemu.
[grub2.git] / autogen.sh
index 5358d45f1eb9b5277d22b352a827617133d3ed96..db719cd1decaed9f75dfbe70a95087c9d0d9aacf 100755 (executable)
@@ -1,34 +1,71 @@
-#! /bin/sh
+#! /usr/bin/env bash
 
 set -e
 
-ln -sf ../NEWS             grub-core/
-ln -sf ../README           grub-core/
-ln -sf ../INSTALL          grub-core/
-ln -sf ../AUTHORS          grub-core/
-ln -sf ../COPYING          grub-core/
-ln -sf ../ABOUT-NLS        grub-core/
-ln -sf ../ChangeLog        grub-core/
-ln -sf ../aclocal.m4       grub-core/
-ln -sf ../acinclude.m4     grub-core/
-ln -sf ../config.rpath     grub-core/
-ln -sf ../gentpl.py        grub-core/
-ln -sf ../configure.common grub-core/
-
-ln -sf grub-core/include .
-ln -sf grub-core/gnulib .
-ln -sf grub-core/lib .
+export LC_CTYPE=C
+export LC_COLLATE=C
+unset LC_ALL
 
+autogen --version >/dev/null || exit 1
+
+echo "Importing unicode..."
+python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
+
+echo "Importing libgcrypt..."
+python util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
+
+echo "Creating Makefile.tpl..."
 python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl
-autogen -T Makefile.tpl modules.def | sed -e '/^$/{N;/^\n$/D;}' > modules.am
 
-(cd grub-core && python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl)
-(cd grub-core && autogen -T Makefile.tpl modules.def | sed -e '/^$/{N;/^\n$/D;}' > modules.am)
+echo "Running autogen..."
+
+# Automake doesn't like including files from a path outside the project.
+rm -f contrib grub-core/contrib
+if [ "x${GRUB_CONTRIB}" != x ]; then
+  [ "${GRUB_CONTRIB}" = contrib ] || ln -s "${GRUB_CONTRIB}" contrib
+  [ "${GRUB_CONTRIB}" = grub-core/contrib ] || ln -s ../contrib grub-core/contrib
+fi
+
+UTIL_DEFS='Makefile.util.def Makefile.utilgcry.def'
+CORE_DEFS='grub-core/Makefile.core.def grub-core/Makefile.gcry.def'
+
+for extra in contrib/*/Makefile.util.def; do
+  if test -e "$extra"; then
+    UTIL_DEFS="$UTIL_DEFS $extra"
+  fi
+done
 
-(cd grub-core && echo timestamp > stamp-h.in)
-(cd grub-core && python import_gcry.py lib/libgcrypt/ .)
+for extra in contrib/*/Makefile.core.def; do
+  if test -e "$extra"; then
+    CORE_DEFS="$CORE_DEFS $extra"
+  fi
+done
 
+cat $UTIL_DEFS | autogen -T Makefile.tpl | sed -e '/^$/{N;/^\n$/D;}' > Makefile.util.am
+cat $CORE_DEFS | autogen -T Makefile.tpl | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.core.am
+
+for extra in contrib/*/Makefile.common; do
+  if test -e "$extra"; then
+    echo "include $extra" >> Makefile.util.am
+    echo "include $extra" >> grub-core/Makefile.core.am
+  fi
+done
+
+for extra in contrib/*/Makefile.util.common; do
+  if test -e "$extra"; then
+    echo "include $extra" >> Makefile.util.am
+  fi
+done
+
+for extra in contrib/*/Makefile.core.common; do
+  if test -e "$extra"; then
+    echo "include $extra" >> grub-core/Makefile.core.am
+  fi
+done
+
+echo "Saving timestamps..."
 echo timestamp > stamp-h.in
-autoreconf -vi
 
+echo "Running autoreconf..."
+autoreconf -vi
 exit 0