generate gcry rules from import_gcry

This commit is contained in:
BVK Chaitanya 2010-08-20 18:21:31 +05:30
parent 771111e53d
commit 3d9d354297
9 changed files with 49 additions and 165 deletions

View file

@ -19,7 +19,6 @@ config.status
config.sub
configure
conf/*.mk
conf/gcry.rmk
*.d
DISTLIST
docs/*.info
@ -80,7 +79,6 @@ trigtables.c
update-grub_lib
unidata.c
Makefile.in
modules.am
GPATH
GRTAGS
GSYMS
@ -93,3 +91,7 @@ texinfo.tex
grub-core/lib/libgcrypt-grub
**/.deps-util
**/.deps-core
Makefile.util.am
grub-core/Makefile.core.am
grub-core/Makefile.gcry.am
grub-core/Makefile.gcry.def

View file

@ -16,7 +16,7 @@ LDFLAGS_PROGRAM += $(LDFLAGS_GNULIB)
CPPFLAGS_PROGRAM += $(CPPFLAGS_GNULIB)
CCASFLAGS_PROGRAM += $(CCASFLAGS_GNULIB)
include $(srcdir)/modules.am
include $(srcdir)/Makefile.util.am
# XXX Use Automake's LEX & YACC support
grub_script.tab.h: $(top_srcdir)/grub-core/script/parser.y
@ -82,3 +82,4 @@ CLEANFILES += widthspec.h
# Install config.h into platformdir
platform_HEADERS = config.h

View file

@ -4,19 +4,20 @@ set -e
autogen --version >/dev/null || (echo autogen missing; exit 1)
echo "Creating Makefile.tpl..."
python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl
echo "Running autogen..."
autogen -T Makefile.tpl modules.def | sed -e '/^$/{N;/^\n$/D;}' > modules.am
autogen -T Makefile.tpl grub-core/modules.def | sed -e '/^$/{N;/^\n$/D;}' > grub-core/modules.am
echo "Importing unicode..."
python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
echo "Importing libgcrypt..."
python util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
echo "Creating Makefile.tpl..."
python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl
echo "Running autogen..."
autogen -T Makefile.tpl Makefile.util.def | sed -e '/^$/{N;/^\n$/D;}' > Makefile.util.am
autogen -T Makefile.tpl grub-core/Makefile.core.def | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.core.am
autogen -T Makefile.tpl grub-core/Makefile.gcry.def | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.gcry.am
echo "Saving timestamps..."
echo timestamp > stamp-h.in

View file

@ -1,3 +1,5 @@
# -*- makefile -*-
# Platform specific options
if COND_i386_pc
CFLAGS_PLATFORM = -mrtd -mregparm=3
@ -117,3 +119,25 @@ TESTS =
EXTRA_DIST =
CLEANFILES =
BUILT_SOURCES =
# Rules for autogen definition files
.PRECIOUS: $(top_srcdir)/Makefile.tpl
$(top_srcdir)/Makefile.tpl: $(top_srcdir)/gentpl.py
python $< | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@
.PRECIOUS: $(top_srcdir)/Makefile.util.am
$(top_srcdir)/Makefile.util.am: $(top_srcdir)/Makefile.util.def $(top_srcdir)/Makefile.tpl
autogen -T $(top_srcdir)/Makefile.tpl $< | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@
.PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
$(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/Makefile.tpl
autogen -T $(top_srcdir)/Makefile.tpl $< | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@
.PRECIOUS: $(top_srcdir)/grub-core/Makefile.gcry.am
$(top_srcdir)/grub-core/Makefile.gcry.am: $(top_srcdir)/grub-core/Makefile.gcry.def $(top_srcdir)/Makefile.tpl
autogen -T $(top_srcdir)/Makefile.tpl $< | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@

View file

@ -448,14 +448,3 @@ print d
print e
print f
print g
print """.PRECIOUS: modules.am
$(srcdir)/modules.am: $(srcdir)/modules.def $(top_srcdir)/Makefile.tpl
autogen -T $(top_srcdir)/Makefile.tpl $(srcdir)/modules.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@
.PRECIOUS: $(top_srcdir)/Makefile.tpl
$(top_srcdir)/Makefile.tpl: $(top_srcdir)/gentpl.py
python $(top_srcdir)/gentpl.py | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@
"""

View file

@ -45,7 +45,8 @@ grub_script.yy.h: script/yylex.l
grub_script.yy.c: grub_script.yy.h
CLEANFILES += grub_script.yy.c grub_script.yy.h
include $(srcdir)/modules.am
include $(srcdir)/Makefile.core.am
include $(srcdir)/Makefile.gcry.am
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cache.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h

View file

@ -1049,140 +1049,6 @@ module = {
extra_dist = lib/libgcrypt-grub/cipher/crypto.lst;
};
module = {
name = gcry_arcfour;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/arcfour.c;
};
module = {
name = gcry_blowfish;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/blowfish.c;
};
module = {
name = gcry_camellia;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/camellia.c;
source = lib/libgcrypt-grub/cipher/camellia-glue.c;
};
module = {
name = gcry_cast5;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/cast5.c;
};
module = {
name = gcry_crc;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/crc.c;
};
module = {
name = gcry_des;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/des.c;
};
module = {
name = gcry_md4;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/md4.c;
};
module = {
name = gcry_md5;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/md5.c;
};
module = {
name = gcry_rfc2268;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/rfc2268.c;
};
module = {
name = gcry_rijndael;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/rijndael.c;
};
module = {
name = gcry_rmd160;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/rmd160.c;
};
module = {
name = gcry_seed;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/seed.c;
};
module = {
name = gcry_serpent;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/serpent.c;
};
module = {
name = gcry_sha1;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/sha1.c;
};
module = {
name = gcry_sha256;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/sha256.c;
};
module = {
name = gcry_sha512;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/sha512.c;
};
module = {
name = gcry_tiger;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/tiger.c;
};
module = {
name = gcry_twofish;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/twofish.c;
};
module = {
name = gcry_whirlpool;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
source = lib/libgcrypt-grub/cipher/whirlpool.c;
};
module = {
name = pbkdf2;
source = lib/pbkdf2.c;

View file

@ -40,8 +40,8 @@ except:
print ("WARNING: %s already exists" % cipher_dir_out)
cipher_files = os.listdir (cipher_dir_in)
conf = open (os.path.join ("conf", "gcry.rmk"), "w")
conf.write ("# -*- makefile -*-\n\n")
conf = open (os.path.join ("grub-core", "Makefile.gcry.def"), "w")
conf.write ("AutoGen definitions Makefile.tpl;\n\n")
chlog = ""
# Strictly speaking CRC32/CRC24 work on bytes so this value should be 1
@ -62,7 +62,6 @@ mdblocksizes = {"_gcry_digest_spec_crc32" : 64,
"_gcry_digest_spec_whirlpool" : 64}
cryptolist = open (os.path.join (cipher_dir_out, "crypto.lst"), "w")
conf.write ("MAINTAINER_CLEANFILES += $(srcdir)/conf/gcry.rmk $(srcdir)/lib/libgcrypt-grub/cipher/ChangeLog $(srcdir)/lib/libgcrypt-grub/cipher/cipher.h $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst $(srcdir)/lib/libgcrypt-grub/cipher/g10lib.h $(srcdir)/lib/libgcrypt-grub/cipher/memory.h $(srcdir)/lib/libgcrypt-grub/cipher/types.h\n");
# rijndael is the only cipher using aliases. So no need for mangling, just
# hardcode it
@ -88,7 +87,6 @@ for cipher_file in cipher_files:
continue
nch = False
if re.match (".*\.[ch]$", cipher_file):
conf.write ("MAINTAINER_CLEANFILES += $(srcdir)/lib/libgcrypt-grub/cipher/" + cipher_file + "\n");
isc = re.match (".*\.c$", cipher_file)
f = open (infile, "r")
fw = open (outfile, "w")
@ -276,11 +274,13 @@ for cipher_file in cipher_files:
chlognew = "%s\n %s" % (chlognew, chmsg)
fw.write (" grub_md_unregister (&%s);\n" % mdname)
fw.write ("}\n")
conf.write ("pkglib_MODULES += %s.mod\n" % modname)
conf.write ("%s_mod_SOURCES = %s\n" %\
(modname, modfiles))
conf.write ("%s_mod_CFLAGS = $(COMMON_CFLAGS) -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap\n" % modname)
conf.write ("%s_mod_LDFLAGS = $(COMMON_LDFLAGS)\n\n" % modname)
conf.write ("module = {\n")
conf.write (" name = %s;\n" % modname)
for src in modfiles.split():
conf.write (" source = %s;\n" % src)
conf.write (" cflags = '$(CFLAGS_GCRY)';\n");
conf.write (" cppflags = '$(CPPFLAGS_GCRY)';\n");
conf.write ("};\n\n")
elif isc and cipher_file != "camellia.c":
print ("WARNING: C file isn't a module: %s" % cipher_file)
f.close ()