Use strip-nondeterminism to fix JAR timestamps
authorKeith Packard <keithp@keithp.com>
Sun, 3 Feb 2019 20:48:45 +0000 (12:48 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 3 Feb 2019 21:02:57 +0000 (13:02 -0800)
.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
altosui/Makefile.am
altosuilib/Makefile.am
configure.ac
map-server/altos-mapd/Makefile.am
map-server/altos-mapj/Makefile.am
micropeak/Makefile.am
telegps/Makefile.am

index 447830e..dfae0f6 100644 (file)
@@ -207,3 +207,6 @@ bin:
 
 $(JAR): classaltoslib.stamp
        jar cf $@ -C bin org
+if STRIP_NONDETERMINISM
+       $(STRIP_NONDETERMINISM) $@
+endif
index 7cc1f4e..eec1578 100644 (file)
@@ -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' > $@
index c00144f..3b2e49d 100644 (file)
@@ -101,3 +101,6 @@ $(JAVAROOT):
 
 $(JAR): classaltosuilib.stamp $(ICONS)
        jar cf $@ $(ICONJAR) -C $(JAVAROOT) .
+if STRIP_NONDETERMINISM
+       $(STRIP_NONDETERMINISM) $@
+endif
index 466f536..a2d84ce 100644 (file)
@@ -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}"
index 39f6753..315a33d 100644 (file)
@@ -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" > $@
index f447adb..98d4f17 100644 (file)
@@ -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" > $@
index f01c5c9..7e9b490 100644 (file)
@@ -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)
 
index 3443b28..ae1e83e 100644 (file)
@@ -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 "$@"