summaryrefslogtreecommitdiff
path: root/debian/patches/0012-Set-date-also-for-appnotes.sh.patch
blob: c08ffc31a58b749e04ed286d0819ada5b1b507ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From: Ruben Undheim <ruben.undheim@gmail.com>
Date: Sat, 14 Jul 2018 23:03:06 +0200
Subject: Set date also for appnotes.sh

---
 Makefile           | 2 +-
 manual/appnotes.sh | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 78f0f58..aa66a54 100644
--- a/Makefile
+++ b/Makefile
@@ -463,7 +463,7 @@ update-manual: $(TARGETS) $(EXTRA_TARGETS)
 	cd manual && ../yosys -p 'help -write-tex-command-reference-manual'
 
 manual: $(TARGETS) $(EXTRA_TARGETS)
-	cd manual && bash appnotes.sh
+	cd manual && PDF_DATE=$(PDF_DATE) bash appnotes.sh
 	cd manual && PDF_DATE=$(PDF_DATE) bash presentation.sh
 	cd manual && PDF_DATE=$(PDF_DATE) bash manual.sh
 
diff --git a/manual/appnotes.sh b/manual/appnotes.sh
index 0ae5286..798d9d3 100755
--- a/manual/appnotes.sh
+++ b/manual/appnotes.sh
@@ -7,16 +7,19 @@ do
 	if [ -f $job/make.sh ]; then
 		cd $job
 		bash make.sh
+        sed -i 's#/CreationDate (D:[^)]\+)#/CreationDate ('${PDF_DATE}')#' *.pdf
 		cd ..
 	fi
 	old_md5=$([ -f $job.aux ] && md5sum < $job.aux || true)
 	while
-		pdflatex -shell-escape -halt-on-error $job.tex || exit
+        pdflatex -shell-escape -halt-on-error '\pdfinfo{/CreationDate('${PDF_DATE}')/ModDate('${PDF_DATE}')}\input{'${job}'.tex}' || exit
 		new_md5=$(md5sum < $job.aux)
 		[ "$old_md5" != "$new_md5" ]
 	do
 		old_md5="$new_md5"
 	done
+    grep -av '^/ID \[\(<[0-9A-F]\{32\}>\) \1]$' ${job}.pdf > ${job}.pdf.without_pdf_id
+    mv -f ${job}.pdf.without_pdf_id ${job}.pdf
 	touch $job.ok
 done