]> git.proxmox.com Git - grub2.git/blob - autogen.sh
* grub-core/commands/legacycfg.c (grub_cmd_legacy_kernel): Fix
[grub2.git] / autogen.sh
1 #! /usr/bin/env bash
2
3 set -e
4
5 export LC_COLLATE=C
6 unset LC_ALL
7
8 find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' |sort > po/POTFILES.in
9 find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in
10
11 autogen --version >/dev/null || exit 1
12
13 echo "Importing unicode..."
14 python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
15
16 echo "Importing libgcrypt..."
17 python util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
18 sed -n -f util/import_gcrypth.sed < grub-core/lib/libgcrypt/src/gcrypt.h.in > include/grub/gcrypt/gcrypt.h
19 if [ -f include/grub/gcrypt/g10lib.h ]; then
20 rm include/grub/gcrypt/g10lib.h
21 fi
22 if [ -d grub-core/lib/libgcrypt-grub/mpi/generic ]; then
23 rm -rf grub-core/lib/libgcrypt-grub/mpi/generic
24 fi
25 ln -s ../../../grub-core/lib/libgcrypt-grub/src/g10lib.h include/grub/gcrypt/g10lib.h
26 cp -R grub-core/lib/libgcrypt/mpi/generic grub-core/lib/libgcrypt-grub/mpi/generic
27
28 for x in mpi-asm-defs.h mpih-add1.c mpih-sub1.c mpih-mul1.c mpih-mul2.c mpih-mul3.c mpih-lshift.c mpih-rshift.c; do
29 if [ -h grub-core/lib/libgcrypt-grub/mpi/"$x" ] || [ -f grub-core/lib/libgcrypt-grub/mpi/"$x" ]; then
30 rm grub-core/lib/libgcrypt-grub/mpi/"$x"
31 fi
32 ln -s generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x"
33 done
34
35 echo "Creating Makefile.tpl..."
36 python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl
37
38 echo "Running autogen..."
39
40 # Automake doesn't like including files from a path outside the project.
41 rm -f contrib grub-core/contrib
42 if [ "x${GRUB_CONTRIB}" != x ]; then
43 [ "${GRUB_CONTRIB}" = contrib ] || ln -s "${GRUB_CONTRIB}" contrib
44 [ "${GRUB_CONTRIB}" = grub-core/contrib ] || ln -s ../contrib grub-core/contrib
45 fi
46
47 UTIL_DEFS='Makefile.util.def Makefile.utilgcry.def'
48 CORE_DEFS='grub-core/Makefile.core.def grub-core/Makefile.gcry.def'
49
50 for extra in contrib/*/Makefile.util.def; do
51 if test -e "$extra"; then
52 UTIL_DEFS="$UTIL_DEFS $extra"
53 fi
54 done
55
56 for extra in contrib/*/Makefile.core.def; do
57 if test -e "$extra"; then
58 CORE_DEFS="$CORE_DEFS $extra"
59 fi
60 done
61
62 cat $UTIL_DEFS | autogen -T Makefile.tpl | sed -e '/^$/{N;/^\n$/D;}' > Makefile.util.am
63 cat $CORE_DEFS | autogen -T Makefile.tpl | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.core.am
64
65 for extra in contrib/*/Makefile.common; do
66 if test -e "$extra"; then
67 echo "include $extra" >> Makefile.util.am
68 echo "include $extra" >> grub-core/Makefile.core.am
69 fi
70 done
71
72 for extra in contrib/*/Makefile.util.common; do
73 if test -e "$extra"; then
74 echo "include $extra" >> Makefile.util.am
75 fi
76 done
77
78 for extra in contrib/*/Makefile.core.common; do
79 if test -e "$extra"; then
80 echo "include $extra" >> grub-core/Makefile.core.am
81 fi
82 done
83
84 echo "Saving timestamps..."
85 echo timestamp > stamp-h.in
86
87 echo "Running autoreconf..."
88 autoreconf -vi
89 exit 0