chiark / gitweb /
precomp: New directory for precomputed files.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 3 May 2009 00:42:39 +0000 (01:42 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 20 Oct 2012 11:40:02 +0000 (12:40 +0100)
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
configure.ac
debian/changelog
hash/Makefile.am
vars.am

index 7107b05..5ab57a7 100644 (file)
@@ -10,3 +10,4 @@ install-sh
 mdwopt.c
 mdwopt.h
 autom4te.cache
+precomp
index d2af6c7..107b49b 100644 (file)
@@ -60,6 +60,9 @@ AC_CHECK_MEMBERS([struct msgdr.msg_control],,, [
 #include <sys/socket.h>
 ])
 
+dnl Find out whether we're cross-compiling.
+AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes ])
+
 dnl--------------------------------------------------------------------------
 dnl Name resolution.
 
index e94ef2d..fc49b4a 100644 (file)
@@ -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 <mdw@distorted.org.uk>  Sun, 03 May 2009 01:40:10 +0100
+ --
 
 mlib (2.1.1) experimental; urgency=low
 
index 26099d6..c6167a6 100644 (file)
@@ -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 (file)
--- 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.