diff mbox series

[bug#55751,3/8] gnu: openjdk11: Make more reproducible.

Message ID 20220601130011.9910-4-dannym@scratchpost.org
State New
Headers show
Series Towards reproducible openjdk | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Danny Milosavljevic June 1, 2022, 1 p.m. UTC
From: Danny Milosavljevic <dannym@scratchpost.org>

* gnu/packages/java.scm (openjdk11)[source]: Add patches.
[arguments]<#:phases>[remove-timestamping]: Add phase.
* gnu/packages/patches/openjdk-11-classlist-reproducibility.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add patches.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/java.scm                         | 21 ++++++++++++++++++-
 ...openjdk-11-classlist-reproducibility.patch | 11 ++++++++++
 3 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/openjdk-11-classlist-reproducibility.patch
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 0a81e0fe75..eaf0e306fb 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1582,6 +1582,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/openjdk-10-module-reproducibility.patch	\
   %D%/packages/patches/openjdk-10-module3-reproducibility.patch	\
   %D%/packages/patches/openjdk-10-module4-reproducibility.patch	\
+  %D%/packages/patches/openjdk-11-classlist-reproducibility.patch	\
   %D%/packages/patches/openjdk-15-xcursor-no-dynamic.patch	\
   %D%/packages/patches/openmpi-mtl-priorities.patch		\
   %D%/packages/patches/openssh-hurd.patch			\
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 37b310141e..5a1e45ca68 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1842,7 +1842,17 @@  (define-public openjdk11
               (snippet
                `(begin
                   (for-each delete-file (find-files "." ".*.(bin|exe|jar)$"))
-                  #t))))
+                  #t))
+              (patches
+               (search-patches ;"openjdk-10-module-reproducibility.patch"
+                        "openjdk-10-module3-reproducibility.patch"
+                        "openjdk-10-module4-reproducibility.patch"
+                        "openjdk-10-char-reproducibility.patch"
+                        "openjdk-11-classlist-reproducibility.patch"
+                        ;"openjdk-10-corba-reproducibility.patch"
+                        ;"openjdk-10-idlj-reproducibility.patch"
+                        "openjdk-10-jar-reproducibility.patch"
+                        "openjdk-10-jtask-reproducibility.patch"))))
     (build-system gnu-build-system)
     (outputs '("out" "jdk" "doc"))
     (arguments
@@ -1869,6 +1879,10 @@  (define-public openjdk11
          "--with-libjpeg=system"
          "--with-libpng=system"
          "--with-version-pre="
+         ;; should be set by SOURCE_DATE_EPOCH handler, but
+         ;; isn't being set. So manually do it.
+         "--with-hotspot-build-time=1970-01-01T00:00:01"
+         "--enable-reproducible-build" ; to be sure
          ;; allow the build system to locate the system freetype
          ,(string-append "--with-freetype-include="
                          (assoc-ref %build-inputs "freetype") "/include")
@@ -1883,6 +1897,11 @@  (define-public openjdk11
              (substitute* "make/data/blockedcertsconverter/blocked.certs.pem"
                (("^#!.*") "#! java BlockedCertsConverter SHA-256\n"))
              #t))
+         (add-after 'unpack 'remove-timestamping
+           (lambda _
+             (substitute* "src/hotspot/share/runtime/abstract_vm_version.cpp"
+              (("__DATE__") "")
+              (("__TIME__") ""))))
          (add-after 'unpack 'patch-jni-libs
            ;; Hardcode dynamically loaded libraries.
            (lambda _
diff --git a/gnu/packages/patches/openjdk-11-classlist-reproducibility.patch b/gnu/packages/patches/openjdk-11-classlist-reproducibility.patch
new file mode 100644
index 0000000000..2ac7c2b664
--- /dev/null
+++ b/gnu/packages/patches/openjdk-11-classlist-reproducibility.patch
@@ -0,0 +1,11 @@ 
+--- jdk-11.0.13-ga/make/GenerateLinkOptData.gmk.orig	2022-04-04 17:18:56.801929954 +0200
++++ jdk-11.0.13-ga/make/GenerateLinkOptData.gmk	2022-04-04 17:19:14.962422622 +0200
+@@ -66,7 +66,7 @@
+ 	    -cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
+ 	    build.tools.classlist.HelloClasslist \
+ 	    $(LOG_DEBUG) 2>&1 > $(JLI_TRACE_FILE)
+-	$(GREP) -v HelloClasslist $@.raw > $@
++	$(GREP) -v HelloClasslist $@.raw |sort > $@
+ 
+ # The jli trace is created by the same recipe as classlist. By declaring these
+ # dependencies, make will correctly rebuild both jli trace and classlist