1 From 630f457666b48321be0a5b6fbf391efef1fa3eb4 Mon Sep 17 00:00:00 2001
2 From: Keith Packard <keithp@keithp.com>
3 Date: Sun, 3 Feb 2019 12:48:45 -0800
4 Subject: [PATCH] Use strip-nondeterminism to fix JAR timestamps
6 .jar files are just zip files, and contain dates. These will cause the
7 build to be non-reproducible. Use strip-nondeterminism to smash all of
8 these back to a fixed value.
10 Signed-off-by: Keith Packard <keithp@keithp.com>
12 altoslib/Makefile.am | 3 +++
13 altosui/Makefile.am | 6 ++++++
14 altosuilib/Makefile.am | 3 +++
15 configure.ac | 20 ++++++++++++++++++++
16 map-server/altos-mapd/Makefile.am | 6 ++++++
17 map-server/altos-mapj/Makefile.am | 6 ++++++
18 micropeak/Makefile.am | 6 ++++++
19 telegps/Makefile.am | 6 ++++++
20 8 files changed, 56 insertions(+)
22 diff --git a/altoslib/Makefile.am b/altoslib/Makefile.am
23 index 447830e5..dfae0f69 100644
24 --- a/altoslib/Makefile.am
25 +++ b/altoslib/Makefile.am
26 @@ -207,3 +207,6 @@ bin:
28 $(JAR): classaltoslib.stamp
30 +if STRIP_NONDETERMINISM
31 + $(STRIP_NONDETERMINISM) $@
33 diff --git a/altosui/Makefile.am b/altosui/Makefile.am
34 index 7cc1f4ea..eec15786 100644
35 --- a/altosui/Makefile.am
36 +++ b/altosui/Makefile.am
37 @@ -255,12 +255,18 @@ $(JAR): classaltosui.stamp Manifest.txt $(JAVA_ICONS) $(ALTOSLIB_CLASS) $(ALTOSU
40 -C ../libaltos libaltosJNI
41 +if STRIP_NONDETERMINISM
42 + $(STRIP_NONDETERMINISM) $@
45 $(FATJAR): classaltosui.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) $(JAVA_ICONS)
46 jar cfm $@ Manifest-fat.txt \
49 -C ../libaltos libaltosJNI
50 +if STRIP_NONDETERMINISM
51 + $(STRIP_NONDETERMINISM) $@
54 Manifest.txt: Makefile
55 echo 'Main-Class: altosui.AltosUI' > $@
56 diff --git a/altosuilib/Makefile.am b/altosuilib/Makefile.am
57 index c00144f8..3b2e49d4 100644
58 --- a/altosuilib/Makefile.am
59 +++ b/altosuilib/Makefile.am
60 @@ -101,3 +101,6 @@ $(JAVAROOT):
62 $(JAR): classaltosuilib.stamp $(ICONS)
63 jar cf $@ $(ICONJAR) -C $(JAVAROOT) .
64 +if STRIP_NONDETERMINISM
65 + $(STRIP_NONDETERMINISM) $@
67 diff --git a/configure.ac b/configure.ac
68 index 466f5369..a2d84ce6 100644
71 @@ -395,6 +395,25 @@ if test "x$HAVE_ASCIIDOCTOR_PDF" = "xno"; then
73 AM_CONDITIONAL([ASCIIDOCTOR_PDF], [test x$HAVE_ASCIIDOCTOR_PDF != xno])
75 +AC_ARG_WITH([strip-nondeterminism],
76 + [AS_HELP_STRING([--with-strip-nondeterminism],
77 + [Name of non-deterministic build data stripping tool])],
79 + [with_strip_nondeterminism=auto])
81 +if test "x$with_strip_nondeterminism" != "xno"; then
82 + if test "x$with_strip_nondeterminism" = "xauto"; then
83 + with_strip_nondeterminism="strip-nondeterminism"
84 + AC_CHECK_PROG([HAVE_STRIP_NONDETERMINISM],[$with_strip_nondeterminism], yes, no)
86 + HAVE_STRIP_NONDETERMINISM=yes
89 + HAVE_STRIP_NONDETERMINISM=no
91 +AM_CONDITIONAL([STRIP_NONDETERMINISM], [test x$HAVE_STRIP_NONDETERMINISM != xno])
92 +AC_SUBST(STRIP_NONDETERMINISM, "$with_strip_nondeterminism")
94 PKG_CHECK_MODULES([JANSSON], [jansson])
96 AC_ARG_WITH([readline],
97 @@ -572,6 +591,7 @@ echo " STlink support..............: ${HAVE_STLINK}"
98 echo " Newlib-nano support.........: ${NEWLIB_NANO}"
99 echo " i386 and amd64 libaltos.....: ${MULTI_ARCH}"
100 echo " install shared mime info....: ${INSTALL_SHARED_MIME_INFO}"
101 +echo " Strip jar timestamps........: ${STRIP_NONDETERMINISM}"
104 echo " freetts.....................: ${FREETTS}"
105 diff --git a/map-server/altos-mapd/Makefile.am b/map-server/altos-mapd/Makefile.am
106 index 39f67536..315a33d5 100644
107 --- a/map-server/altos-mapd/Makefile.am
108 +++ b/map-server/altos-mapd/Makefile.am
109 @@ -42,12 +42,18 @@ classes/altosmapd:
110 $(JAR): classaltosmapd.stamp Manifest.txt $(ALTOSLIB_CLASS)
111 jar cfm $@ Manifest.txt \
113 +if STRIP_NONDETERMINISM
114 + $(STRIP_NONDETERMINISM) $@
117 altosmapddir=$(datadir)/java
119 $(FATJAR): classaltosmapd.stamp Manifest-fat.txt $(ALTOSLIB_CLASS)
120 jar cfm $@ Manifest-fat.txt \
122 +if STRIP_NONDETERMINISM
123 + $(STRIP_NONDETERMINISM) $@
127 echo "#!/bin/sh" > $@
128 diff --git a/map-server/altos-mapj/Makefile.am b/map-server/altos-mapj/Makefile.am
129 index f447adb6..98d4f170 100644
130 --- a/map-server/altos-mapj/Makefile.am
131 +++ b/map-server/altos-mapj/Makefile.am
132 @@ -31,12 +31,18 @@ classes/altosmap:
133 $(JAR): classaltosmap.stamp Manifest.txt $(ALTOSLIB_CLASS)
134 jar cfm $@ Manifest.txt \
136 +if STRIP_NONDETERMINISM
137 + $(STRIP_NONDETERMINISM) $@
140 altosmapdir=$(datadir)/java
142 $(FATJAR): classaltosmap.stamp Manifest-fat.txt $(ALTOSLIB_CLASS)
143 jar cfm $@ Manifest-fat.txt \
145 +if STRIP_NONDETERMINISM
146 + $(STRIP_NONDETERMINISM) $@
150 echo "#!/bin/sh" > $@
151 diff --git a/micropeak/Makefile.am b/micropeak/Makefile.am
152 index f01c5c9f..7e9b490d 100644
153 --- a/micropeak/Makefile.am
154 +++ b/micropeak/Makefile.am
155 @@ -222,12 +222,18 @@ $(JAR): classmicropeak.stamp Manifest.txt $(JAVA_ICONS) $(ALTOSLIB_CLASS) $(ALTO
158 -C ../libaltos libaltosJNI
159 +if STRIP_NONDETERMINISM
160 + $(STRIP_NONDETERMINISM) $@
163 $(FATJAR): classmicropeak.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(JAVA_ICONS)
164 jar cfm $@ Manifest-fat.txt \
167 -C ../libaltos libaltosJNI
168 +if STRIP_NONDETERMINISM
169 + $(STRIP_NONDETERMINISM) $@
172 classaltosui.stamp: $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS)
174 diff --git a/telegps/Makefile.am b/telegps/Makefile.am
175 index 3443b288..ae1e83e9 100644
176 --- a/telegps/Makefile.am
177 +++ b/telegps/Makefile.am
178 @@ -227,12 +227,18 @@ $(JAR): classtelegps.stamp Manifest.txt $(JAVA_ICONS) $(ALTOSLIB_CLASS) $(ALTOSU
181 -C ../libaltos libaltosJNI
182 +if STRIP_NONDETERMINISM
183 + $(STRIP_NONDETERMINISM) $@
186 $(FATJAR): classtelegps.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(JAVA_ICONS)
187 jar cfm $@ Manifest-fat.txt \
190 -C ../libaltos libaltosJNI
191 +if STRIP_NONDETERMINISM
192 + $(STRIP_NONDETERMINISM) $@
195 libaltos.so: build-libaltos