grub/autogen.sh

104 lines
3.5 KiB
Bash
Raw Normal View History

2010-08-23 08:37:29 +00:00
#! /usr/bin/env bash
2002-12-27 08:53:07 +00:00
set -e
if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then
echo "Gnulib not yet bootstrapped; run ./bootstrap instead." >&2
exit 1
fi
# Set ${PYTHON} to plain 'python' if not set already
: ${PYTHON:=python}
export LC_COLLATE=C
unset LC_ALL
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
find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in
2010-07-12 19:13:28 +00:00
echo "Importing unicode..."
${PYTHON} util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
2010-07-12 19:13:28 +00:00
2010-06-03 06:22:33 +00:00
echo "Importing libgcrypt..."
${PYTHON} util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
sed -n -f util/import_gcrypth.sed < grub-core/lib/libgcrypt/src/gcrypt.h.in > include/grub/gcrypt/gcrypt.h
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
cp grub-core/lib/libgcrypt-grub/src/g10lib.h include/grub/gcrypt/g10lib.h
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
if [ -h grub-core/lib/libgcrypt-grub/mpi/"$x" ] || [ -f grub-core/lib/libgcrypt-grub/mpi/"$x" ]; then
rm grub-core/lib/libgcrypt-grub/mpi/"$x"
fi
cp grub-core/lib/libgcrypt-grub/mpi/generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x"
done
echo "Generating Automake input..."
Re-enable grub-extras. * autogen.sh: Create symlinks to ${GRUB_CONTRIB} if necessary to avoid confusing Automake. Run autogen only twice, once for the top level and once for grub-core. Add Makefile.util.def and Makefile.core.def from extra modules to the appropriate autogen invocations. If Makefile.common exists in an extra module, include it in both Makefile.util.am and grub-core/Makefile.core.am; similarly, include any Makefile.util.common file in Makefile.util.am and any Makefile.core.common file in grub-core/Makefile.core.am. * conf/Makefile.common ($(top_srcdir)/grub-core/Makefile.core.am): Depend on $(top_srcdir)/grub-core/Makefile.gcry.def. ($(top_srcdir)/grub-core/Makefile.gcry.def): Remove. * grub-core/Makefile.am: Remove inclusion of Makefile.gcry.am. * gentpl.py (gvar_add): Turn GVARS into a set. (global_variable_initializers): Sort global variables on output. (vars_init): New function. (first_time): Likewise. (library): Ensure that non-global variable initialisations are emitted before the first time we emit code for a library block. Append to variables rather than setting them. Only emit noinst_LIBRARIES, BUILT_SOURCES, and CLEANFILES the first time for each conditional path. (program): installdir() emits an Autogen macro, so must be passed to var_add rather than gvar_add. (data): Likewise. (script): Likewise. (rules): New function, centralising handling for different target types. Set up Guile association lists for first_time and vars_init, and send most output to a diversion so that variable initialisations can be emitted first. (module_rules): Use new rules function. (kernel_rules): Likewise. (image_rules): Likewise. (library_rules): Likewise. (program_rules): Likewise. (script_rules): Likewise. (data_rules): Likewise. * configure.ac: Add AC_PROG_LN_S, for the benefit of ntldr-img. * .bzrignore: Add contrib and grub-core/contrib. Remove grub-core/Makefile.gcry.am.
2010-09-24 08:48:27 +00:00
# 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
2011-04-22 17:04:21 +00:00
UTIL_DEFS='Makefile.util.def Makefile.utilgcry.def'
Re-enable grub-extras. * autogen.sh: Create symlinks to ${GRUB_CONTRIB} if necessary to avoid confusing Automake. Run autogen only twice, once for the top level and once for grub-core. Add Makefile.util.def and Makefile.core.def from extra modules to the appropriate autogen invocations. If Makefile.common exists in an extra module, include it in both Makefile.util.am and grub-core/Makefile.core.am; similarly, include any Makefile.util.common file in Makefile.util.am and any Makefile.core.common file in grub-core/Makefile.core.am. * conf/Makefile.common ($(top_srcdir)/grub-core/Makefile.core.am): Depend on $(top_srcdir)/grub-core/Makefile.gcry.def. ($(top_srcdir)/grub-core/Makefile.gcry.def): Remove. * grub-core/Makefile.am: Remove inclusion of Makefile.gcry.am. * gentpl.py (gvar_add): Turn GVARS into a set. (global_variable_initializers): Sort global variables on output. (vars_init): New function. (first_time): Likewise. (library): Ensure that non-global variable initialisations are emitted before the first time we emit code for a library block. Append to variables rather than setting them. Only emit noinst_LIBRARIES, BUILT_SOURCES, and CLEANFILES the first time for each conditional path. (program): installdir() emits an Autogen macro, so must be passed to var_add rather than gvar_add. (data): Likewise. (script): Likewise. (rules): New function, centralising handling for different target types. Set up Guile association lists for first_time and vars_init, and send most output to a diversion so that variable initialisations can be emitted first. (module_rules): Use new rules function. (kernel_rules): Likewise. (image_rules): Likewise. (library_rules): Likewise. (program_rules): Likewise. (script_rules): Likewise. (data_rules): Likewise. * configure.ac: Add AC_PROG_LN_S, for the benefit of ntldr-img. * .bzrignore: Add contrib and grub-core/contrib. Remove grub-core/Makefile.gcry.am.
2010-09-24 08:48:27 +00:00
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
${PYTHON} gentpl.py $UTIL_DEFS > Makefile.util.am
${PYTHON} gentpl.py $CORE_DEFS > grub-core/Makefile.core.am
Re-enable grub-extras. * autogen.sh: Create symlinks to ${GRUB_CONTRIB} if necessary to avoid confusing Automake. Run autogen only twice, once for the top level and once for grub-core. Add Makefile.util.def and Makefile.core.def from extra modules to the appropriate autogen invocations. If Makefile.common exists in an extra module, include it in both Makefile.util.am and grub-core/Makefile.core.am; similarly, include any Makefile.util.common file in Makefile.util.am and any Makefile.core.common file in grub-core/Makefile.core.am. * conf/Makefile.common ($(top_srcdir)/grub-core/Makefile.core.am): Depend on $(top_srcdir)/grub-core/Makefile.gcry.def. ($(top_srcdir)/grub-core/Makefile.gcry.def): Remove. * grub-core/Makefile.am: Remove inclusion of Makefile.gcry.am. * gentpl.py (gvar_add): Turn GVARS into a set. (global_variable_initializers): Sort global variables on output. (vars_init): New function. (first_time): Likewise. (library): Ensure that non-global variable initialisations are emitted before the first time we emit code for a library block. Append to variables rather than setting them. Only emit noinst_LIBRARIES, BUILT_SOURCES, and CLEANFILES the first time for each conditional path. (program): installdir() emits an Autogen macro, so must be passed to var_add rather than gvar_add. (data): Likewise. (script): Likewise. (rules): New function, centralising handling for different target types. Set up Guile association lists for first_time and vars_init, and send most output to a diversion so that variable initialisations can be emitted first. (module_rules): Use new rules function. (kernel_rules): Likewise. (image_rules): Likewise. (library_rules): Likewise. (program_rules): Likewise. (script_rules): Likewise. (data_rules): Likewise. * configure.ac: Add AC_PROG_LN_S, for the benefit of ntldr-img. * .bzrignore: Add contrib and grub-core/contrib. Remove grub-core/Makefile.gcry.am.
2010-09-24 08:48:27 +00:00
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
2010-08-20 12:51:31 +00:00
2010-06-03 06:22:33 +00:00
echo "Saving timestamps..."
2010-05-06 06:04:04 +00:00
echo timestamp > stamp-h.in
2002-12-27 08:53:07 +00:00
if [ -z "$FROM_BOOTSTRAP" ]; then
# Unaided autoreconf is likely to install older versions of many files
# than the ones provided by Gnulib, but in most cases this won't matter
# very much. This mode is provided so that you can run ./autogen.sh to
# regenerate the GRUB build system in an unpacked release tarball (perhaps
# after patching it), even on systems that don't have access to
# gnulib.git.
echo "Running autoreconf..."
cp -a INSTALL INSTALL.grub
autoreconf -vif
mv INSTALL.grub INSTALL
fi
2002-12-27 08:53:07 +00:00
exit 0