autogen.sh 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #! /usr/bin/env bash
  2. set -e
  3. # Set ${PYTHON} to plain 'python' if not set already
  4. : ${PYTHON:=python}
  5. export LC_COLLATE=C
  6. unset LC_ALL
  7. 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
  8. find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in
  9. echo "Importing unicode..."
  10. ${PYTHON} util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
  11. echo "Importing libgcrypt..."
  12. ${PYTHON} util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
  13. sed -n -f util/import_gcrypth.sed < grub-core/lib/libgcrypt/src/gcrypt.h.in > include/grub/gcrypt/gcrypt.h
  14. if [ -f include/grub/gcrypt/g10lib.h ]; then
  15. rm include/grub/gcrypt/g10lib.h
  16. fi
  17. if [ -d grub-core/lib/libgcrypt-grub/mpi/generic ]; then
  18. rm -rf grub-core/lib/libgcrypt-grub/mpi/generic
  19. fi
  20. cp grub-core/lib/libgcrypt-grub/src/g10lib.h include/grub/gcrypt/g10lib.h
  21. cp -R grub-core/lib/libgcrypt/mpi/generic grub-core/lib/libgcrypt-grub/mpi/generic
  22. 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
  23. if [ -h grub-core/lib/libgcrypt-grub/mpi/"$x" ] || [ -f grub-core/lib/libgcrypt-grub/mpi/"$x" ]; then
  24. rm grub-core/lib/libgcrypt-grub/mpi/"$x"
  25. fi
  26. cp grub-core/lib/libgcrypt-grub/mpi/generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x"
  27. done
  28. echo "Generating Automake input..."
  29. # Automake doesn't like including files from a path outside the project.
  30. rm -f contrib grub-core/contrib
  31. if [ "x${GRUB_CONTRIB}" != x ]; then
  32. [ "${GRUB_CONTRIB}" = contrib ] || ln -s "${GRUB_CONTRIB}" contrib
  33. [ "${GRUB_CONTRIB}" = grub-core/contrib ] || ln -s ../contrib grub-core/contrib
  34. fi
  35. UTIL_DEFS='Makefile.util.def Makefile.utilgcry.def'
  36. CORE_DEFS='grub-core/Makefile.core.def grub-core/Makefile.gcry.def'
  37. for extra in contrib/*/Makefile.util.def; do
  38. if test -e "$extra"; then
  39. UTIL_DEFS="$UTIL_DEFS $extra"
  40. fi
  41. done
  42. for extra in contrib/*/Makefile.core.def; do
  43. if test -e "$extra"; then
  44. CORE_DEFS="$CORE_DEFS $extra"
  45. fi
  46. done
  47. ${PYTHON} gentpl.py $UTIL_DEFS > Makefile.util.am
  48. ${PYTHON} gentpl.py $CORE_DEFS > grub-core/Makefile.core.am
  49. for extra in contrib/*/Makefile.common; do
  50. if test -e "$extra"; then
  51. echo "include $extra" >> Makefile.util.am
  52. echo "include $extra" >> grub-core/Makefile.core.am
  53. fi
  54. done
  55. for extra in contrib/*/Makefile.util.common; do
  56. if test -e "$extra"; then
  57. echo "include $extra" >> Makefile.util.am
  58. fi
  59. done
  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. echo "Saving timestamps..."
  66. echo timestamp > stamp-h.in
  67. echo "Running autoreconf..."
  68. autoreconf -vi
  69. exit 0