Description: Deterministically build crypt.pdf for multi-arch
Author: Michael Stapelberg <stapelberg@debian.org>
Forwarded: https://github.com/libtom/libtomcrypt/pull/33
Bug-Debian: http://bugs.debian.org/734109
Last-Updated: 2014-01-04

---

Index: libtomcrypt/makefile
===================================================================
--- libtomcrypt.orig/makefile	2014-01-04 16:26:09.001353782 +0100
+++ libtomcrypt/makefile	2014-01-04 16:26:57.328828492 +0100
@@ -355,14 +355,24 @@
 #delete it if we are rebuilding it.
 docs: crypt.tex
 	rm -f doc/crypt.pdf $(LEFTOVERS)
+	cp crypt.tex crypt.bak
+	touch --reference=crypt.tex crypt.bak
+	(echo "\\def\\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -d @$$(stat --format=%Y crypt.tex) | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > crypt-deterministic.tex
+	echo "\\pdfinfo{" >> crypt-deterministic.tex
+	echo "/CreationDate (\fixedpdfdate)" >> crypt-deterministic.tex
+	echo "/ModDate (\fixedpdfdate) }" >> crypt-deterministic.tex
+	cat crypt.tex >> crypt-deterministic.tex
+	mv crypt-deterministic.tex crypt.tex
+	touch --reference=crypt.bak crypt.tex
 	echo "hello" > crypt.ind
 	latex crypt
 	latex crypt
 	makeindex crypt.idx
 	perl fixupind.pl
-	latex crypt
-	dvipdf crypt
+	pdflatex crypt
+	sed -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' crypt.pdf
 	mv -ivf crypt.pdf doc/crypt.pdf
+	mv crypt.bak crypt.tex
 	rm -f $(LEFTOVERS)
 
 docdvi: crypt.tex
