Subject: [PATCH] openjdk 14 package
From: Michael Zucchi <[email-masked]>
To: [email-masked]
Date: Tue, 28 Apr 2020 10:56:55 +0930
List-Id: <debbugs-submit.debbugs.gnu.org>

This mostly is just a simple copy of openjdk12 with changed links.  
openjdk13 is also included as it must be used to bootstrap openjdk14.

openjdk14 uses "help" as a rather poor choice of autoconf test for the 
availability of a shell builtin and this isn't available in 
bash-minimal, so a small patch is needed to make configure complete.  
I've contacted the openjdk developers with a suggested change but so far 
have had no response after a couple of business days.

From 7f8f90eea8c3eb9d104e7d9a865897f2456d14a3 Mon Sep 17 00:00:00 2001
From: Not Zed <[email-masked]>
Date: Tue, 28 Apr 2020 10:33:46 +0930
Subject: [PATCH]         * gnu/packages/java.scm (openjdk13, opnejdk14)       
  * gnu/packages/patches/openjdk-14-builtins.patch: Added openjdk 13 and      
   14.

---
 gnu/packages/java.scm                         | 93 +++++++++++++++++++
 .../patches/openjdk-14-builtins.patch         | 11 +++
 2 files changed, 104 insertions(+)
 create mode 100644 gnu/packages/patches/openjdk-14-builtins.patch

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index cab90fb4e7..41c2e3c547 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2250,6 +2250,99 @@ new Date();"))
        ("zip" ,zip)))
     (home-page "https://openjdk.java.net/projects/jdk/12")))
 
+(define-public openjdk13
+  (package
+    (inherit openjdk11)
+    (name "openjdk")
+    (version "13.0")
+    (source (origin
+	     (method url-fetch)
+	     (uri "http://hg.openjdk.java.net/jdk/jdk13/archive/9c250a7600e1.tar.bz2")
+	     (file-name (string-append name "-" version ".tar.bz2"))
+	     (sha256
+	      (base32
+	       "0v0ljvx5dyzp96dw4z4ksw3pvasil7783mgnmd1wk9gads5ab8iq"))
+	     (modules '((guix build utils)))
+	     (snippet
+	      `(begin
+		 (for-each delete-file (find-files "." ".*.bin$"))
+		 (for-each delete-file (find-files "." ".*.exe$"))
+		 (for-each delete-file (find-files "." ".*.jar$"))
+		 #t))))
+    (inputs
+     `(("alsa-lib" ,alsa-lib)
+       ("cups" ,cups)
+       ("fontconfig" ,fontconfig)
+       ("freetype" ,freetype)
+       ("giflib" ,giflib)
+       ("lcms" ,lcms)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libx11" ,libx11)
+       ("libxext" ,libxext)
+       ("libxrandr" ,libxrandr)
+       ("libxrender" ,libxrender)
+       ("libxt" ,libxt)
+       ("libxtst" ,libxtst)))
+    ;; openjdk13 must be bootstrapped with java 12 or 13
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("openjdk12" ,openjdk11)
+       ("openjdk12:jdk" ,openjdk12 "jdk")
+       ("pkg-config" ,pkg-config)
+       ("unzip" ,unzip)
+       ("which" ,which)
+       ("zip" ,zip)))
+    (home-page "https://openjdk.java.net/projects/jdk/13")))
+
+(define-public openjdk14
+  (package
+    (inherit openjdk11)
+    (name "openjdk")
+    (version "14.0")
+    (source (origin
+	     (method url-fetch)
+	     (uri "http://hg.openjdk.java.net/jdk/jdk14/archive/bc54620a3848.tar.bz2")
+	     (file-name (string-append name "-" version ".tar.bz2"))
+	     (sha256
+	      (base32
+	       "0z485pk7r1xpw8004g4nrwrzj17sabgx8yfdbxwfvzkjp8qyajch"))
+	     ;; openjdk14 autoconf uses 'help' to search for builtins, not available in bash-minimal
+	     (patches
+	      (search-patches "openjdk-14-builtins.patch"))
+	     (modules '((guix build utils)))
+	     (snippet
+	      `(begin
+		 (for-each delete-file (find-files "." ".*.bin$"))
+		 (for-each delete-file (find-files "." ".*.exe$"))
+		 (for-each delete-file (find-files "." ".*.jar$"))
+		 #t))))
+    (inputs
+     `(("alsa-lib" ,alsa-lib)
+       ("cups" ,cups)
+       ("fontconfig" ,fontconfig)
+       ("freetype" ,freetype)
+       ("giflib" ,giflib)
+       ("lcms" ,lcms)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libx11" ,libx11)
+       ("libxext" ,libxext)
+       ("libxrandr" ,libxrandr)
+       ("libxrender" ,libxrender)
+       ("libxt" ,libxt)
+       ("libxtst" ,libxtst)))
+    ;; openjdk14 must be bootstrapped with java 13 or 14
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("openjdk13" ,openjdk11)
+       ("openjdk13:jdk" ,openjdk13 "jdk")
+       ("pkg-config" ,pkg-config)
+       ("unzip" ,unzip)
+       ("which" ,which)
+       ("zip" ,zip)))
+    (home-page "https://openjdk.java.net/projects/jdk/14")))
+
 (define-public icedtea icedtea-8)
 
 
diff --git a/gnu/packages/patches/openjdk-14-builtins.patch b/gnu/packages/patches/openjdk-14-builtins.patch
new file mode 100644
index 0000000000..0e7e3dcaa9
--- /dev/null
+++ b/gnu/packages/patches/openjdk-14-builtins.patch
@@ -0,0 +1,11 @@
+--- jdk14-bc54620a3848/make/autoconf/basics.m4	2020-02-07 04:40:54.000000000 +1030
++++ jdk14-bc54620a3848-new/make/autoconf/basics.m4	2020-04-24 10:59:33.056098506 +0930
+@@ -583,7 +583,7 @@
+   BASIC_SETUP_TOOL($1, [AC_PATH_PROGS($1, $2, , $3)])
+   if test "x[$]$1" = x; then
+     AC_MSG_NOTICE([Required tool $2 not found in PATH, checking built-in])
+-    if help $2 > /dev/null 2>&1; then
++    if command -v $2 > /dev/null 2>&1; then
+       AC_MSG_NOTICE([Found $2 as shell built-in. Using it])
+       $1="$2"
+     else
-- 
2.26.2