autogen.sh 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #! /usr/bin/env bash
  2. set -e
  3. if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then
  4. echo "Gnulib not yet bootstrapped; run ./bootstrap instead." >&2
  5. exit 1
  6. fi
  7. # Set ${PYTHON} to plain 'python' if not set already
  8. : ${PYTHON:=python}
  9. export LC_COLLATE=C
  10. 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' ! -ipath './gnulib/*' ! -ipath './grub-core/lib/gnulib/*' |sort > po/POTFILES.in
  12. find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in
  13. echo "Importing unicode..."
  14. ${PYTHON} util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
  15. echo "Importing libgcrypt..."
  16. ${PYTHON} util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
  17. sed -n -f util/import_gcrypth.sed < grub-core/lib/libgcrypt/src/gcrypt.h.in > include/grub/gcrypt/gcrypt.h
  18. if [ -f include/grub/gcrypt/g10lib.h ]; then
  19. rm include/grub/gcrypt/g10lib.h
  20. fi
  21. if [ -d grub-core/lib/libgcrypt-grub/mpi/generic ]; then
  22. rm -rf grub-core/lib/libgcrypt-grub/mpi/generic
  23. fi
  24. cp grub-core/lib/libgcrypt-grub/src/g10lib.h include/grub/gcrypt/g10lib.h
  25. cp -R grub-core/lib/libgcrypt/mpi/generic grub-core/lib/libgcrypt-grub/mpi/generic
  26. 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
  27. if [ -h grub-core/lib/libgcrypt-grub/mpi/"$x" ] || [ -f grub-core/lib/libgcrypt-grub/mpi/"$x" ]; then
  28. rm grub-core/lib/libgcrypt-grub/mpi/"$x"
  29. fi
  30. cp grub-core/lib/libgcrypt-grub/mpi/generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x"
  31. done
  32. echo "Generating Automake input..."
  33. # Automake doesn't like including files from a path outside the project.
  34. rm -f contrib grub-core/contrib
  35. if [ "x${GRUB_CONTRIB}" != x ]; then
  36. [ "${GRUB_CONTRIB}" = contrib ] || ln -s "${GRUB_CONTRIB}" contrib
  37. [ "${GRUB_CONTRIB}" = grub-core/contrib ] || ln -s ../contrib grub-core/contrib
  38. fi
  39. UTIL_DEFS='Makefile.util.def Makefile.utilgcry.def'
  40. CORE_DEFS='grub-core/Makefile.core.def grub-core/Makefile.gcry.def'
  41. for extra in contrib/*/Makefile.util.def; do
  42. if test -e "$extra"; then
  43. UTIL_DEFS="$UTIL_DEFS $extra"
  44. fi
  45. done
  46. for extra in contrib/*/Makefile.core.def; do
  47. if test -e "$extra"; then
  48. CORE_DEFS="$CORE_DEFS $extra"
  49. fi
  50. done
  51. ${PYTHON} gentpl.py $UTIL_DEFS > Makefile.util.am
  52. ${PYTHON} gentpl.py $CORE_DEFS > grub-core/Makefile.core.am
  53. for extra in contrib/*/Makefile.common; do
  54. if test -e "$extra"; then
  55. echo "include $extra" >> Makefile.util.am
  56. echo "include $extra" >> grub-core/Makefile.core.am
  57. fi
  58. done
  59. for extra in contrib/*/Makefile.util.common; do
  60. if test -e "$extra"; then
  61. echo "include $extra" >> Makefile.util.am
  62. fi
  63. done
  64. for extra in contrib/*/Makefile.core.common; do
  65. if test -e "$extra"; then
  66. echo "include $extra" >> grub-core/Makefile.core.am
  67. fi
  68. done
  69. echo "Saving timestamps..."
  70. echo timestamp > stamp-h.in
  71. if [ -z "$FROM_BOOTSTRAP" ]; then
  72. # Unaided autoreconf is likely to install older versions of many files
  73. # than the ones provided by Gnulib, but in most cases this won't matter
  74. # very much. This mode is provided so that you can run ./autogen.sh to
  75. # regenerate the GRUB build system in an unpacked release tarball (perhaps
  76. # after patching it), even on systems that don't have access to
  77. # gnulib.git.
  78. echo "Running autoreconf..."
  79. cp -a INSTALL INSTALL.grub
  80. autoreconf -vif
  81. mv INSTALL.grub INSTALL
  82. fi
  83. exit 0