From 173ff44a439dc7cf51a3f7a433c4d0d444b59293 Mon Sep 17 00:00:00 2001 Message-Id: <173ff44a439dc7cf51a3f7a433c4d0d444b59293.1715019173.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sun, 3 May 2009 01:42:39 +0100 Subject: [PATCH] precomp: New directory for precomputed files. Organization: Straylight/Edgeware From: Mark Wooding The `precomp' directory in the distribution tarball contains pre-built tables, for CRC and unihash computations. Distributing the tables means that the library can be built by cross-compilers. Indeed, we don't even try to generate the tables if cross compilation is detected. The precomp directory shouldn't exist in revision-control, but it's populated during the build process if necessary, and it's distributed in release tarballs. --- .gitignore | 1 + configure.ac | 3 +++ debian/changelog | 4 +++- hash/Makefile.am | 18 ++++++++++++------ vars.am | 8 ++++++-- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 7107b05..5ab57a7 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ install-sh mdwopt.c mdwopt.h autom4te.cache +precomp diff --git a/configure.ac b/configure.ac index d2af6c7..107b49b 100644 --- a/configure.ac +++ b/configure.ac @@ -60,6 +60,9 @@ AC_CHECK_MEMBERS([struct msgdr.msg_control],,, [ #include ]) +dnl Find out whether we're cross-compiling. +AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes ]) + dnl-------------------------------------------------------------------------- dnl Name resolution. diff --git a/debian/changelog b/debian/changelog index e94ef2d..fc49b4a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,10 @@ mlib (2.2.0~pre1) experimental; urgency=low * Major internal reorganization. + * Ship precomputed tables and provide partial support for + cross-compilation. - -- Mark Wooding Sun, 03 May 2009 01:40:10 +0100 + -- mlib (2.1.1) experimental; urgency=low diff --git a/hash/Makefile.am b/hash/Makefile.am index 26099d6..c6167a6 100644 --- a/hash/Makefile.am +++ b/hash/Makefile.am @@ -43,15 +43,18 @@ crc_mktab_SOURCES = crc-mktab.c crc_mktab_LDADD = $(UTIL_LIBS) PROGMANS += crc-mktab.1 -libhash_la_SOURCES += crc32-tab.c -CLEANFILES += crc32-tab.c -crc32-tab.c: +libhash_la_SOURCES += $(precomp)/crc32-tab.c +PRECOMPS += $(precomp)/crc32-tab.c +if !CROSS_COMPILING +$(precomp)/crc32-tab.c: + @$(mkdir_p) $(precomp) @$(build_util_libs) @$(MAKE) crc-mktab$(EXEEXT) ./crc-mktab -o $@.new \ -p0x04c11db7 -b32 -B8 -r -c \ -scrc32_table -icrc32.h -tuint32 && \ mv $@.new $@ +endif ## Universal hashing. pkginclude_HEADERS += unihash.h @@ -65,13 +68,16 @@ unihash_mkstatic_SOURCES = unihash-mkstatic.c unihash_mkstatic_LDADD = libunihash.la $(UTIL_LIBS) PROGMANS += unihash-mkstatic.1 -libhash_la_SOURCES += unihash-global.c -CLEANFILES += unihash-global.c -unihash-global.c: +libhash_la_SOURCES += $(precomp)/unihash-global.c +PRECOMPS += $(precomp)/unihash-global.c +if !CROSS_COMPILING +$(precomp)/unihash-global.c: + @$(mkdir_p) $(precomp) @$(build_util_libs) @$(MAKE) unihash-mkstatic$(EXEEXT) ./unihash-mkstatic -c -sunihash_global -iunihash.h -o$@.new && \ mv $@.new $@ +endif check_PROGRAMS += unihash.t unihash_t_SOURCES = unihash.c diff --git a/vars.am b/vars.am index c6f7884..a35014d 100644 --- a/vars.am +++ b/vars.am @@ -35,11 +35,12 @@ pkglibexecdir = $(libexecdir)/$(PACKAGE) bin_PROGRAMS = check_PROGRAMS = pkginclude_HEADERS = +PRECOMPS = PROGMANS = LIBMANS = -EXTRA_DIST = $(LIBMANS) $(PROGMANS) +EXTRA_DIST = $(PRECOMPS) $(LIBMANS) $(PROGMANS) CLEANFILES = -MAINTAINERCLEANFILES = +MAINTAINERCLEANFILES = $(PRECOMPS) ###-------------------------------------------------------------------------- ### Include path. @@ -71,6 +72,9 @@ SUBSTITUTIONS = \ bindir=$(bindir) sbindir=$(sbindir) \ PACKAGE=$(PACKAGE) VERSION=$(VERSION) +## Location of precomputed tables. +precomp = $(top_srcdir)/precomp + ###-------------------------------------------------------------------------- ### Building utilities. -- [mdw]