merge mainline into zfs
[grub.git] / autogen.sh
1 #! /usr/bin/env bash
2
3 set -e
4
5 export LC_CTYPE=C
6 export LC_COLLATE=C
7 unset LC_ALL
8
9 autogen --version >/dev/null || exit 1
10
11 echo "Importing unicode..."
12 python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
13
14 echo "Importing libgcrypt..."
15 python util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
16
17 echo "Creating Makefile.tpl..."
18 python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl
19
20 echo "Running autogen..."
21
22 # Automake doesn't like including files from a path outside the project.
23 rm -f contrib grub-core/contrib
24 if [ "x${GRUB_CONTRIB}" != x ]; then
25   [ "${GRUB_CONTRIB}" = contrib ] || ln -s "${GRUB_CONTRIB}" contrib
26   [ "${GRUB_CONTRIB}" = grub-core/contrib ] || ln -s ../contrib grub-core/contrib
27 fi
28
29 UTIL_DEFS='Makefile.util.def Makefile.utilgcry.def'
30 CORE_DEFS='grub-core/Makefile.core.def grub-core/Makefile.gcry.def'
31
32 for extra in contrib/*/Makefile.util.def; do
33   if test -e "$extra"; then
34     UTIL_DEFS="$UTIL_DEFS $extra"
35   fi
36 done
37
38 for extra in contrib/*/Makefile.core.def; do
39   if test -e "$extra"; then
40     CORE_DEFS="$CORE_DEFS $extra"
41   fi
42 done
43
44 cat $UTIL_DEFS | autogen -T Makefile.tpl | sed -e '/^$/{N;/^\n$/D;}' > Makefile.util.am
45 cat $CORE_DEFS | autogen -T Makefile.tpl | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.core.am
46
47 for extra in contrib/*/Makefile.common; do
48   if test -e "$extra"; then
49     echo "include $extra" >> Makefile.util.am
50     echo "include $extra" >> grub-core/Makefile.core.am
51   fi
52 done
53
54 for extra in contrib/*/Makefile.util.common; do
55   if test -e "$extra"; then
56     echo "include $extra" >> Makefile.util.am
57   fi
58 done
59
60 for extra in contrib/*/Makefile.core.common; do
61   if test -e "$extra"; then
62     echo "include $extra" >> grub-core/Makefile.core.am
63   fi
64 done
65
66 echo "Saving timestamps..."
67 echo timestamp > stamp-h.in
68
69 echo "Running autoreconf..."
70 autoreconf -vi
71 exit 0