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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
|
From 630f457666b48321be0a5b6fbf391efef1fa3eb4 Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp@keithp.com>
Date: Sun, 3 Feb 2019 12:48:45 -0800
Subject: [PATCH] Use strip-nondeterminism to fix JAR timestamps
.jar files are just zip files, and contain dates. These will cause the
build to be non-reproducible. Use strip-nondeterminism to smash all of
these back to a fixed value.
Signed-off-by: Keith Packard <keithp@keithp.com>
---
altoslib/Makefile.am | 3 +++
altosui/Makefile.am | 6 ++++++
altosuilib/Makefile.am | 3 +++
configure.ac | 20 ++++++++++++++++++++
map-server/altos-mapd/Makefile.am | 6 ++++++
map-server/altos-mapj/Makefile.am | 6 ++++++
micropeak/Makefile.am | 6 ++++++
telegps/Makefile.am | 6 ++++++
8 files changed, 56 insertions(+)
diff --git a/altoslib/Makefile.am b/altoslib/Makefile.am
index 447830e5..dfae0f69 100644
--- a/altoslib/Makefile.am
+++ b/altoslib/Makefile.am
@@ -207,3 +207,6 @@ bin:
$(JAR): classaltoslib.stamp
jar cf $@ -C bin org
+if STRIP_NONDETERMINISM
+ $(STRIP_NONDETERMINISM) $@
+endif
diff --git a/altosui/Makefile.am b/altosui/Makefile.am
index 7cc1f4ea..eec15786 100644
--- a/altosui/Makefile.am
+++ b/altosui/Makefile.am
@@ -255,12 +255,18 @@ $(JAR): classaltosui.stamp Manifest.txt $(JAVA_ICONS) $(ALTOSLIB_CLASS) $(ALTOSU
$(ICONJAR) \
-C classes altosui \
-C ../libaltos libaltosJNI
+if STRIP_NONDETERMINISM
+ $(STRIP_NONDETERMINISM) $@
+endif
$(FATJAR): classaltosui.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) $(JAVA_ICONS)
jar cfm $@ Manifest-fat.txt \
$(ICONJAR) \
-C classes altosui \
-C ../libaltos libaltosJNI
+if STRIP_NONDETERMINISM
+ $(STRIP_NONDETERMINISM) $@
+endif
Manifest.txt: Makefile
echo 'Main-Class: altosui.AltosUI' > $@
diff --git a/altosuilib/Makefile.am b/altosuilib/Makefile.am
index c00144f8..3b2e49d4 100644
--- a/altosuilib/Makefile.am
+++ b/altosuilib/Makefile.am
@@ -101,3 +101,6 @@ $(JAVAROOT):
$(JAR): classaltosuilib.stamp $(ICONS)
jar cf $@ $(ICONJAR) -C $(JAVAROOT) .
+if STRIP_NONDETERMINISM
+ $(STRIP_NONDETERMINISM) $@
+endif
diff --git a/configure.ac b/configure.ac
index 466f5369..a2d84ce6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -395,6 +395,25 @@ if test "x$HAVE_ASCIIDOCTOR_PDF" = "xno"; then
fi
AM_CONDITIONAL([ASCIIDOCTOR_PDF], [test x$HAVE_ASCIIDOCTOR_PDF != xno])
+AC_ARG_WITH([strip-nondeterminism],
+ [AS_HELP_STRING([--with-strip-nondeterminism],
+ [Name of non-deterministic build data stripping tool])],
+ [],
+ [with_strip_nondeterminism=auto])
+
+if test "x$with_strip_nondeterminism" != "xno"; then
+ if test "x$with_strip_nondeterminism" = "xauto"; then
+ with_strip_nondeterminism="strip-nondeterminism"
+ AC_CHECK_PROG([HAVE_STRIP_NONDETERMINISM],[$with_strip_nondeterminism], yes, no)
+ else
+ HAVE_STRIP_NONDETERMINISM=yes
+ fi
+else
+ HAVE_STRIP_NONDETERMINISM=no
+fi
+AM_CONDITIONAL([STRIP_NONDETERMINISM], [test x$HAVE_STRIP_NONDETERMINISM != xno])
+AC_SUBST(STRIP_NONDETERMINISM, "$with_strip_nondeterminism")
+
PKG_CHECK_MODULES([JANSSON], [jansson])
AC_ARG_WITH([readline],
@@ -572,6 +591,7 @@ echo " STlink support..............: ${HAVE_STLINK}"
echo " Newlib-nano support.........: ${NEWLIB_NANO}"
echo " i386 and amd64 libaltos.....: ${MULTI_ARCH}"
echo " install shared mime info....: ${INSTALL_SHARED_MIME_INFO}"
+echo " Strip jar timestamps........: ${STRIP_NONDETERMINISM}"
echo ""
echo " Java"
echo " freetts.....................: ${FREETTS}"
diff --git a/map-server/altos-mapd/Makefile.am b/map-server/altos-mapd/Makefile.am
index 39f67536..315a33d5 100644
--- a/map-server/altos-mapd/Makefile.am
+++ b/map-server/altos-mapd/Makefile.am
@@ -42,12 +42,18 @@ classes/altosmapd:
$(JAR): classaltosmapd.stamp Manifest.txt $(ALTOSLIB_CLASS)
jar cfm $@ Manifest.txt \
-C classes altosmapd
+if STRIP_NONDETERMINISM
+ $(STRIP_NONDETERMINISM) $@
+endif
altosmapddir=$(datadir)/java
$(FATJAR): classaltosmapd.stamp Manifest-fat.txt $(ALTOSLIB_CLASS)
jar cfm $@ Manifest-fat.txt \
-C classes altosmapd
+if STRIP_NONDETERMINISM
+ $(STRIP_NONDETERMINISM) $@
+endif
altos-mapd: Makefile
echo "#!/bin/sh" > $@
diff --git a/map-server/altos-mapj/Makefile.am b/map-server/altos-mapj/Makefile.am
index f447adb6..98d4f170 100644
--- a/map-server/altos-mapj/Makefile.am
+++ b/map-server/altos-mapj/Makefile.am
@@ -31,12 +31,18 @@ classes/altosmap:
$(JAR): classaltosmap.stamp Manifest.txt $(ALTOSLIB_CLASS)
jar cfm $@ Manifest.txt \
-C classes altosmap
+if STRIP_NONDETERMINISM
+ $(STRIP_NONDETERMINISM) $@
+endif
altosmapdir=$(datadir)/java
$(FATJAR): classaltosmap.stamp Manifest-fat.txt $(ALTOSLIB_CLASS)
jar cfm $@ Manifest-fat.txt \
-C classes altosmap
+if STRIP_NONDETERMINISM
+ $(STRIP_NONDETERMINISM) $@
+endif
altos-mapj: Makefile
echo "#!/bin/sh" > $@
diff --git a/micropeak/Makefile.am b/micropeak/Makefile.am
index f01c5c9f..7e9b490d 100644
--- a/micropeak/Makefile.am
+++ b/micropeak/Makefile.am
@@ -222,12 +222,18 @@ $(JAR): classmicropeak.stamp Manifest.txt $(JAVA_ICONS) $(ALTOSLIB_CLASS) $(ALTO
$(ICONJAR) \
-C classes org \
-C ../libaltos libaltosJNI
+if STRIP_NONDETERMINISM
+ $(STRIP_NONDETERMINISM) $@
+endif
$(FATJAR): classmicropeak.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(JAVA_ICONS)
jar cfm $@ Manifest-fat.txt \
$(ICONJAR) \
-C classes org \
-C ../libaltos libaltosJNI
+if STRIP_NONDETERMINISM
+ $(STRIP_NONDETERMINISM) $@
+endif
classaltosui.stamp: $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS)
diff --git a/telegps/Makefile.am b/telegps/Makefile.am
index 3443b288..ae1e83e9 100644
--- a/telegps/Makefile.am
+++ b/telegps/Makefile.am
@@ -227,12 +227,18 @@ $(JAR): classtelegps.stamp Manifest.txt $(JAVA_ICONS) $(ALTOSLIB_CLASS) $(ALTOSU
$(ICONJAR) \
-C classes org \
-C ../libaltos libaltosJNI
+if STRIP_NONDETERMINISM
+ $(STRIP_NONDETERMINISM) $@
+endif
$(FATJAR): classtelegps.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(JAVA_ICONS)
jar cfm $@ Manifest-fat.txt \
$(ICONJAR) \
-C classes org \
-C ../libaltos libaltosJNI
+if STRIP_NONDETERMINISM
+ $(STRIP_NONDETERMINISM) $@
+endif
libaltos.so: build-libaltos
-rm -f "$@"
--
2.20.1
|