autogen.sh 2.93 KB
Newer Older
1
#! /usr/bin/env bash
okuji's avatar
okuji committed
2 3 4

set -e

5 6 7
# Set ${PYTHON} to plain 'python' if not set already
: ${PYTHON:=python}

8 9 10
export LC_COLLATE=C
unset LC_ALL

11
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
12
find util -iname '*.in' ! -name Makefile.in  |sort > po/POTFILES-shell.in
13

BVK Chaitanya's avatar
BVK Chaitanya committed
14
echo "Importing unicode..."
15
${PYTHON} util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
BVK Chaitanya's avatar
BVK Chaitanya committed
16

BVK Chaitanya's avatar
BVK Chaitanya committed
17
echo "Importing libgcrypt..."
18
${PYTHON} util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
19
sed -n -f util/import_gcrypth.sed < grub-core/lib/libgcrypt/src/gcrypt.h.in > include/grub/gcrypt/gcrypt.h
20 21 22 23 24 25
if [ -f include/grub/gcrypt/g10lib.h ]; then
    rm include/grub/gcrypt/g10lib.h
fi
if [ -d grub-core/lib/libgcrypt-grub/mpi/generic ]; then 
    rm -rf grub-core/lib/libgcrypt-grub/mpi/generic
fi
26
cp grub-core/lib/libgcrypt-grub/src/g10lib.h include/grub/gcrypt/g10lib.h
27 28 29
cp -R grub-core/lib/libgcrypt/mpi/generic grub-core/lib/libgcrypt-grub/mpi/generic

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
30
    if [ -h grub-core/lib/libgcrypt-grub/mpi/"$x" ] || [ -f grub-core/lib/libgcrypt-grub/mpi/"$x" ]; then
31 32
	rm grub-core/lib/libgcrypt-grub/mpi/"$x"
    fi
33
    cp grub-core/lib/libgcrypt-grub/mpi/generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x"
34
done
35

36
echo "Generating Automake input..."
Colin Watson's avatar
Colin Watson committed
37 38 39 40 41 42 43 44

# 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

45
UTIL_DEFS='Makefile.util.def Makefile.utilgcry.def'
Colin Watson's avatar
Colin Watson committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59
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

for extra in contrib/*/Makefile.core.def; do
  if test -e "$extra"; then
    CORE_DEFS="$CORE_DEFS $extra"
  fi
done

60 61
${PYTHON} gentpl.py $UTIL_DEFS > Makefile.util.am
${PYTHON} gentpl.py $CORE_DEFS > grub-core/Makefile.core.am
Colin Watson's avatar
Colin Watson committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80

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
81

BVK Chaitanya's avatar
BVK Chaitanya committed
82
echo "Saving timestamps..."
83
echo timestamp > stamp-h.in
okuji's avatar
okuji committed
84

BVK Chaitanya's avatar
BVK Chaitanya committed
85 86
echo "Running autoreconf..."
autoreconf -vi
okuji's avatar
okuji committed
87
exit 0