unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH]: Add IcedTea 6
@ 2015-01-27 15:33 Ricardo Wurmus
  2015-01-27 21:55 ` Ludovic Courtès
  0 siblings, 1 reply; 11+ messages in thread
From: Ricardo Wurmus @ 2015-01-27 15:33 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1897 bytes --]

Hi Guix,

attached is a patch that gives us the liberated OpenJDK in the form of
IcedTea (version 6).  IcedTea 6 is built with GCJ.  Unfortunately, it
needs Ant, which cannot be built with GCJ, so it depends on a binary
bootstrap Ant.

There are a couple of issues with this patch set that I'm aware of:

* IcedTea 6 is built without JavaScript support as this would require
  Rhino.

* I'm not happy with replacing the unpack phase and I don't like to
  refer to the OpenJDK source tarball by its full name
  "openjdk-6-src-b34-20_jan_2015.tar.xz".  Is there a way around this?

* The test suite has been disabled.  I have been able to fix most issues
  relating to the build environment (mostly hardcoded paths and
  corrupted PATH variable), but even then many tests fail.  One group of
  tests depends on a shell wrapper around Xvfb, which is currently not
  part of the xorg-server package.  A considerable number of tests fails
  upstream (see http://builder.classpath.org/icedtea/icedtea6/test/ for
  logs).

* All this patching of tests is really not pretty.  I'm not sure if
  there's a better or more concise way to achieve this.  I also don't
  know which of these steps should better be implemented as snippets.

* The patch to
  openjdk/jdk/src/share/classes/java/util/CurrencyData.properties
  really should be implemented upstream.

* the make check-* targets do not return a non-zero status code upon
  failure.  This doesn't affect us now because tests are disabled
  anyway, but using (and (zero? ...)) is just wishful thinking.

* the synopsis tells us about IcedTea (the build harness), but actually
  what we get after the build is a liberated OpenJDK.  The same problem
  affects the description, which probably should describe the purpose of
  OpenJDK instead.

I would be happy to receive comments on the above issues (or others that
you find with the patch).

~~ Ricardo


[-- Attachment #2: 0001-gnu-Add-IcedTea-6.patch --]
[-- Type: text/x-patch, Size: 20724 bytes --]

From 13490591fe7ad774e8ec95626113138d828366fb Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Tue, 23 Dec 2014 12:32:25 +0100
Subject: [PATCH] gnu: Add IcedTea 6

* gnu/packages/java.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
---
 gnu-system.am         |   1 +
 gnu/packages/java.scm | 407 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 408 insertions(+)
 create mode 100644 gnu/packages/java.scm

diff --git a/gnu-system.am b/gnu-system.am
index 5fc42ba..6e6e221 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -147,6 +147,7 @@ GNU_SYSTEM_MODULES =				\
   gnu/packages/inkscape.scm			\
   gnu/packages/irssi.scm			\
   gnu/packages/iso-codes.scm			\
+  gnu/packages/java.scm				\
   gnu/packages/jrnl.scm				\
   gnu/packages/kde.scm				\
   gnu/packages/ld-wrapper.scm			\
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
new file mode 100644
index 0000000..f0ac63e
--- /dev/null
+++ b/gnu/packages/java.scm
@@ -0,0 +1,407 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages java)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix build-system gnu)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages attr)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages cpio)
+  #:use-module (gnu packages cups)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages gawk)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages gnuzilla) ;nss
+  #:use-module (gnu packages ghostscript) ;lcms
+  #:use-module (gnu packages gnome)
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages image)
+  #:use-module (gnu packages linux) ;alsa
+  #:use-module (gnu packages wget)
+  #:use-module (gnu packages which)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages perl)
+  #:use-module (gnu packages mit-krb5)
+  #:use-module (gnu packages xml)
+  #:use-module (gnu packages xorg)
+  #:use-module (gnu packages zip)
+  #:use-module (gnu packages texinfo))
+
+(define-public icedtea6
+  (package
+    (name "icedtea6")
+    (version "1.13.6")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://icedtea.wildebeest.org/download/source/icedtea6-"
+                    version ".tar.xz"))
+              (sha256
+               (base32
+                "16ac3f7kkln5skg202vllagkhjxrwd47h56diwzhfidhwjlz7410"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(;; There are many failing tests.
+       ;;
+       ;; * Hotspot VM tests:
+       ;;   FAILED: compiler/7082949/Test7082949.java
+       ;;   FAILED: compiler/7088020/Test7088020.java
+       ;;   FAILED: runtime/6929067/Test6929067.sh
+       ;;   FAILED: serviceability/sa/jmap-hashcode/Test8028623.java
+       ;;   => Test results: passed: 161; failed: 4
+       ;;
+       ;; * langtools tests:
+       ;;   FAILED: com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
+       ;;   FAILED: tools/javac/6627362/T6627362.java
+       ;;   FAILED: tools/javac/7003595/T7003595.java
+       ;;   FAILED: tools/javac/7024568/T7024568.java
+       ;;   FAILED: tools/javap/4111861/T4111861.java
+       ;;   FAILED: tools/javap/ListTest.java
+       ;;   FAILED: tools/javap/OptionTest.java
+       ;;   FAILED: tools/javap/T4884240.java
+       ;;   FAILED: tools/javap/T4975569.java
+       ;;     --> fails because of insignificant whitespace differences
+       ;;         in output of javap
+       ;;   FAILED: tools/javap/T6868539.java
+       ;;   => Test results: passed: 1,445; failed: 10
+       ;;
+       ;; * JDK tests:
+       ;;   Tests are incomplete because of a segfault after this test:
+       ;;     javax/crypto/spec/RC5ParameterSpec/RC5ParameterSpecEquals.java
+       ;;   A bug report has already been filed upstream:
+       ;;     http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2188
+       ;;
+       ;;   The tests require xvfb-run, a wrapper script around Xvfb, which
+       ;;   has not been packaged yet.  Without it many AWT tests fail, so I
+       ;;   made no attempts to make a list of failing JDK tests.  At least
+       ;;   222 tests are failing of which at least 132 are AWT tests.
+       #:tests? #f
+       #:configure-flags
+       (let* ((gcjdir (assoc-ref %build-inputs "gcj"))
+              (ecj    (string-append gcjdir "/share/java/ecj.jar"))
+              (jdk    (string-append gcjdir "/lib/jvm/"))
+              (gcj    (string-append gcjdir "/bin/gcj")))
+         `("--enable-bootstrap"
+           "--enable-nss"
+           "--without-rhino"
+           "--disable-downloading"
+           "--disable-tests" ;they are run in the check phase instead
+           ,(string-append "--with-openjdk-src-dir=" "./openjdk")
+           ,(string-append "--with-javac=" jdk "/bin/javac")
+           ,(string-append "--with-ecj-jar=" ecj)
+           ,(string-append "--with-gcj=" gcj)
+           ,(string-append "--with-jdk-home=" jdk)
+           ,(string-append "--with-java=" jdk "/bin/java")))
+       #:phases
+       (alist-replace
+        'unpack
+        (lambda* (#:key source inputs #:allow-other-keys)
+          (let ((target (string-append ,name "-" ,version)))
+            (and (zero? (system* "tar" "xvf" source))
+                 (zero? (system* "tar" "xvjf" (assoc-ref inputs "ant-bootstrap")))
+                 (chdir target))
+            (mkdir "openjdk")
+            (with-directory-excursion "openjdk"
+              (copy-file (assoc-ref inputs "openjdk6-src")
+                         "openjdk-6-src-b34-20_jan_2015.tar.xz")
+              (system* "tar" "xvf" "openjdk-6-src-b34-20_jan_2015.tar.xz"))))
+        (alist-cons-after
+         'unpack 'patch-paths
+         (lambda _
+           (patch-shebang "../apache-ant-1.9.4/bin/ant")
+
+           (substitute* "Makefile.in"
+             ;; link against libgcj to avoid linker error
+             (("-o native-ecj")
+              "-lgcj -o native-ecj")
+             ;; do not leak information about the build host
+             (("DISTRIBUTION_ID=\"\\$\\(DIST_ID\\)\"")
+              "DISTRIBUTION_ID=\"\\\"guix\\\"\""))
+
+           ;; shebang in patches so that they apply cleanly
+           (substitute* '("patches/jtreg-jrunscript.patch"
+                          "patches/hotspot/hs23/drop_unlicensed_test.patch")
+             (("#!/bin/sh") (string-append "#!" (which "sh"))))
+
+           ;; fix path to alsa header in patch
+           (substitute* "patches/openjdk/6799141-split_out_versions.patch"
+             (("ALSA_INCLUDE=/usr/include/alsa/version.h")
+              (string-append "ALSA_INCLUDE="
+                             (assoc-ref %build-inputs "alsa-lib")
+                             "/include/alsa/version.h")))
+
+           ;; buildtree.make generates shell scripts, so we need to replace
+           ;; the generated shebang
+           (substitute* '("openjdk/hotspot/make/linux/makefiles/buildtree.make")
+             (("/bin/sh") (which "bash")))
+
+           (let ((corebin (string-append
+                           (assoc-ref %build-inputs "coreutils") "/bin/"))
+                 (binbin  (string-append
+                           (assoc-ref %build-inputs "binutils") "/bin/"))
+                 (grepbin (string-append
+                           (assoc-ref %build-inputs "grep") "/bin/")))
+             (substitute* '("openjdk/jdk/make/common/shared/Defs-linux.gmk"
+                            "openjdk/corba/make/common/shared/Defs-linux.gmk")
+               (("UNIXCOMMAND_PATH  = /bin/")
+                (string-append "UNIXCOMMAND_PATH = " corebin))
+               (("USRBIN_PATH  = /usr/bin/")
+                (string-append "USRBIN_PATH = " corebin))
+               (("DEVTOOLS_PATH *= */usr/bin/")
+                (string-append "DEVTOOLS_PATH = " corebin))
+               (("COMPILER_PATH *= */usr/bin/")
+                (string-append "COMPILER_PATH = "
+                               (assoc-ref %build-inputs "gcc") "/bin/")))
+
+             ;; fix hard-coded utility paths
+             (substitute* '("openjdk/jdk/make/common/shared/Defs-utils.gmk"
+                            "openjdk/corba/make/common/shared/Defs-utils.gmk")
+               (("ECHO *=.*echo")
+                (string-append "ECHO = " (which "echo")))
+               (("^GREP *=.*grep")
+                (string-append "GREP = " (which "grep")))
+               (("EGREP *=.*egrep")
+                (string-append "EGREP = " (which "egrep")))
+               (("CPIO *=.*cpio")
+                (string-append "CPIO = " (which "cpio")))
+               (("READELF *=.*readelf")
+                (string-append "READELF = " (which "readelf")))
+               (("^ *AR *=.*ar")
+                (string-append "AR = " (which "ar")))
+               (("^ *TAR *=.*tar")
+                (string-append "TAR = " (which "tar")))
+               (("AS *=.*as")
+                (string-append "AS = " (which "as")))
+               (("LD *=.*ld")
+                (string-append "LD = " (which "ld")))
+               (("STRIP *=.*strip")
+                (string-append "STRIP = " (which "strip")))
+               (("NM *=.*nm")
+                (string-append "NM = " (which "nm")))
+               (("^SH *=.*sh")
+                (string-append "SH = " (which "bash")))
+               (("^FIND *=.*find")
+                (string-append "FIND = " (which "find")))
+               (("LDD *=.*ldd")
+                (string-append "LDD = " (which "ldd")))
+               (("NAWK *=.*nawk")
+                (string-append "NAWK = " (which "gawk")))
+               (("NAWK *=.*gawk")
+                (string-append "NAWK = " (which "gawk")))
+               (("XARGS *=.*xargs")
+                (string-append "XARGS = " (which "xargs")))
+               (("UNZIP *=.*unzip")
+                (string-append "UNZIP = " (which "unzip")))
+               (("ZIPEXE *=.*zip")
+                (string-append "ZIPEXE = " (which "zip")))
+               (("SED *=.*sed")
+                (string-append "SED = " (which "sed"))))
+
+             ;; Some of these timestamps cause problems as they are more than
+             ;; 10 years ago, failing the build process.
+             (substitute*
+                 "openjdk/jdk/src/share/classes/java/util/CurrencyData.properties"
+               (("AZ=AZM;2005-12-31-20-00-00;AZN") "AZ=AZN")
+               (("MZ=MZM;2006-06-30-22-00-00;MZN") "MZ=MZN")
+               (("RO=ROL;2005-06-30-21-00-00;RON") "RO=RON")
+               (("TR=TRL;2004-12-31-22-00-00;TRY") "TR=TRY"))))
+          (alist-cons-before
+           'configure 'set-paths
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let* ((gcjdir  (assoc-ref %build-inputs "gcj"))
+                    (gcjlib  (string-append gcjdir "/lib"))
+                    (antpath (string-append (getcwd) "/../apache-ant-1.9.4")))
+               (setenv "CC" (which "gcc"))
+               (setenv "CPATH"
+                       (string-append (assoc-ref %build-inputs "libxrender")
+                                      "/include/X11/extensions" ":"
+                                      (assoc-ref %build-inputs "libxtst")
+                                      "/include/X11/extensions" ":"
+                                      (assoc-ref %build-inputs "libxinerama")
+                                      "/include/X11/extensions" ":"
+                                      (or (getenv "CPATH") "")))
+               (setenv "ALT_CUPS_HEADERS_PATH"
+                       (string-append (assoc-ref %build-inputs "cups")
+                                      "/include"))
+               (setenv "ALT_FREETYPE_HEADERS_PATH"
+                       (string-append (assoc-ref %build-inputs "freetype")
+                                      "/include"))
+               (setenv "ALT_FREETYPE_LIB_PATH"
+                       (string-append (assoc-ref %build-inputs "freetype")
+                                      "/lib"))
+               (setenv "LD_LIBRARY_PATH"
+                       (string-append antpath "/lib" ":" gcjlib))
+               (setenv "PATH" (string-append antpath "/bin:"
+                                             (getenv "PATH")))))
+           (alist-cons-before
+            'check 'fix-tests
+            (lambda _
+              ;; Fix PATH in test environment
+              (substitute* "src/jtreg/com/sun/javatest/regtest/Main.java"
+                (("PATH=/bin:/usr/bin")
+                 (string-append "PATH=" (getenv "PATH"))))
+              (substitute* "src/jtreg/com/sun/javatest/util/SysEnv.java"
+                (("/usr/bin/env") (which "env")))
+
+              ;; Hotspot tests
+              (with-directory-excursion "openjdk/hotspot/test/"
+                (substitute* "jprt.config"
+                  (("PATH=\"\\$\\{path4sdk\\}\"")
+                   (string-append "PATH=" (getenv "PATH")))
+                  (("make=/usr/bin/make")
+                   (string-append "make=" (which "make"))))
+                (substitute* '("runtime/6626217/Test6626217.sh"
+                               "runtime/7110720/Test7110720.sh")
+                  (("/bin/rm") (which "rm"))
+                  (("/bin/cp") (which "cp"))
+                  (("/bin/mv") (which "mv"))))
+
+              ;; JDK tests
+              (with-directory-excursion "openjdk/jdk/test/"
+                (substitute* "com/sun/jdi/JdbReadTwiceTest.sh"
+                  (("/bin/pwd") (which "pwd")))
+                (substitute* "com/sun/jdi/ShellScaffold.sh"
+                  (("/bin/kill") (which "kill")))
+                (substitute* "start-Xvfb.sh"
+                  (("/usr/bin/X11/Xvfb") (which "Xvfb"))
+                  (("/usr/bin/nohup")    (which "nohup")))
+                (substitute* "javax/security/auth/Subject/doAs/Test.sh"
+                  (("/bin/rm") (which "rm")))
+                (substitute* "tools/launcher/MultipleJRE.sh"
+                  (("echo \"#!/bin/sh\"")
+                   (string-append "echo \"#!" (which "rm") "\""))
+                  (("/usr/bin/zip") (which "zip")))
+                (substitute* "com/sun/jdi/OnThrowTest.java"
+                  (("#!/bin/sh") (string-append "#!" (which "sh"))))
+                (substitute* "java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java"
+                  (("/usr/bin/uptime") (which "uptime")))
+                (substitute* "java/lang/ProcessBuilder/Basic.java"
+                  (("/usr/bin/env") (which "env"))
+                  (("/bin/false") (which "false"))
+                  (("/bin/true") (which "true"))
+                  (("/bin/cp") (which "cp"))
+                  (("/bin/sh") (which "sh")))
+                (substitute* "java/lang/ProcessBuilder/FeelingLucky.java"
+                  (("/bin/sh") (which "sh")))
+                (substitute* "java/lang/ProcessBuilder/Zombies.java"
+                  (("/usr/bin/perl") (which "perl"))
+                  (("/bin/ps") (which "ps"))
+                  (("/bin/true") (which "true")))
+                (substitute* "java/lang/Runtime/exec/ConcurrentRead.java"
+                  (("/usr/bin/tee") (which "tee")))
+                (substitute* "java/lang/Runtime/exec/ExecWithDir.java"
+                  (("/bin/true") (which "true")))
+                (substitute* "java/lang/Runtime/exec/ExecWithInput.java"
+                  (("/bin/cat") (which "cat")))
+                (substitute* "java/lang/Runtime/exec/ExitValue.java"
+                  (("/bin/sh") (which "sh"))
+                  (("/bin/true") (which "true"))
+                  (("/bin/kill") (which "kill")))
+                (substitute* "java/lang/Runtime/exec/LotsOfDestroys.java"
+                  (("/usr/bin/echo") (which "echo")))
+                (substitute* "java/lang/Runtime/exec/LotsOfOutput.java"
+                  (("/usr/bin/cat") (which "cat")))
+                (substitute* "java/lang/Runtime/exec/SleepyCat.java"
+                  (("/bin/cat") (which "cat"))
+                  (("/bin/sleep") (which "sleep"))
+                  (("/bin/sh") (which "sh")))
+                (substitute* "java/lang/Runtime/exec/StreamsSurviveDestroy.java"
+                  (("/bin/cat") (which "cat")))
+                (substitute* "java/rmi/activation/CommandEnvironment/SetChildEnv.java"
+                  (("/bin/chmod") (which "chmod")))
+                (substitute* "java/util/zip/ZipFile/Assortment.java"
+                  (("/bin/sh") (which "sh")))))
+            (alist-replace
+             'check
+             (lambda _
+               (and (zero? (system* "make" "check-hotspot"))
+                    (zero? (system* "make" "check-langtools"))
+                    (zero? (system* "make" "check-jdk"))))
+             (alist-replace
+              'install
+              (lambda _
+                (copy-recursively "openjdk.build" %output))
+              %standard-phases))))))))
+    (native-inputs
+     `(("ant-bootstrap"
+        ,(origin
+           (method url-fetch)
+           (uri "https://www.apache.org/dist/ant/binaries/apache-ant-1.9.4-bin.tar.bz2")
+           (sha256
+            (base32
+             "1kw801p8h5x4f0g8i5yknppssrj5a3xy1aqrkpfnk22bd1snbh90"))))
+       ("alsa-lib" ,alsa-lib)
+       ("attr" ,attr)
+       ("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("coreutils" ,coreutils)
+       ("diffutils" ,diffutils) ;for tests
+       ("gawk" ,gawk)
+       ("grep" ,grep)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)
+       ("cups" ,cups)
+       ("wget" ,wget)
+       ("which" ,which)
+       ("cpio" ,cpio)
+       ("zip" ,zip)
+       ("unzip" ,unzip)
+       ("fastjar" ,fastjar)
+       ("libxslt" ,libxslt) ;for xsltproc
+       ("mit-krb5" ,mit-krb5)
+       ("nss" ,nss)
+       ("libx11" ,libx11)
+       ("libxt" ,libxt)
+       ("libxtst" ,libxtst)
+       ("libxi" ,libxi)
+       ("libxinerama" ,libxinerama)
+       ("libxrender" ,libxrender)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("giflib" ,giflib)
+       ("perl" ,perl)
+       ("procps" ,procps) ;for "free", even though I'm not sure we should use it
+       ("openjdk6-src"
+        ,(origin
+           (method url-fetch)
+           (uri "https://java.net/downloads/openjdk6/openjdk-6-src-b34-20_jan_2015.tar.xz")
+           (sha256
+            (base32
+             "0lafxvi255r22pjljkj9x6liacqdgin8smdmh6nzkdjjw7hv9l8k"))))
+       ("lcms" ,lcms)
+       ("zlib" ,zlib)
+       ("gtk" ,gtk+-2)
+       ("fontconfig" ,fontconfig)
+       ("freetype" ,freetype)
+       ("gcj" ,gcj-4.8)))
+    (home-page "http://icedtea.classpath.org")
+    (synopsis "A harness to build OpenJDK using Free Software build tools")
+    (description
+     "The IcedTea project provides a harness to build the source code from
+http://openjdk.java.net using Free Software build tools along with additional
+features such as a Free Software plugin and web start implementation and an
+LLVM-based JIT.")
+    ;; IcedTea is released under the GPL2 + Classpath exception, which is the
+    ;; same license as both GNU Classpath and OpenJDK.
+    (license license:gpl2+)))
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH]: Add IcedTea 6
  2015-01-27 15:33 [PATCH]: Add IcedTea 6 Ricardo Wurmus
@ 2015-01-27 21:55 ` Ludovic Courtès
  2015-01-28 15:47   ` Ricardo Wurmus
  0 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2015-01-27 21:55 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> attached is a patch that gives us the liberated OpenJDK in the form of
> IcedTea (version 6).  IcedTea 6 is built with GCJ.  Unfortunately, it
> needs Ant, which cannot be built with GCJ, so it depends on a binary
> bootstrap Ant.

OK.

> There are a couple of issues with this patch set that I'm aware of:
>
> * IcedTea 6 is built without JavaScript support as this would require
>   Rhino.
>
> * I'm not happy with replacing the unpack phase and I don't like to
>   refer to the OpenJDK source tarball by its full name
>   "openjdk-6-src-b34-20_jan_2015.tar.xz".  Is there a way around this?

You can just call it whatever you want in the 2nd argument to
‘copy-file’, no?

> * The test suite has been disabled.  I have been able to fix most issues
>   relating to the build environment (mostly hardcoded paths and
>   corrupted PATH variable), but even then many tests fail.  One group of
>   tests depends on a shell wrapper around Xvfb, which is currently not
>   part of the xorg-server package.  A considerable number of tests fails
>   upstream (see http://builder.classpath.org/icedtea/icedtea6/test/ for
>   logs).

OK.  I guess you did your best, we’re no substitute for upstream hackers
anyway.  ;-)

> * All this patching of tests is really not pretty.  I'm not sure if
>   there's a better or more concise way to achieve this.  I also don't
>   know which of these steps should better be implemented as snippets.
>
> * The patch to
>   openjdk/jdk/src/share/classes/java/util/CurrencyData.properties
>   really should be implemented upstream.
>
> * the make check-* targets do not return a non-zero status code upon
>   failure.  This doesn't affect us now because tests are disabled
>   anyway, but using (and (zero? ...)) is just wishful thinking.
>
> * the synopsis tells us about IcedTea (the build harness), but actually
>   what we get after the build is a liberated OpenJDK.  The same problem
>   affects the description, which probably should describe the purpose of
>   OpenJDK instead.

Yeah, probably.

> From 13490591fe7ad774e8ec95626113138d828366fb Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
> Date: Tue, 23 Dec 2014 12:32:25 +0100
> Subject: [PATCH] gnu: Add IcedTea 6
>
> * gnu/packages/java.scm: New file.
> * gnu-system.am (GNU_SYSTEM_MODULES): Add it.

[...]

> +     `(;; There are many failing tests.

You can add that many are known to fail upstream.

[...]

> +        'unpack
> +        (lambda* (#:key source inputs #:allow-other-keys)
> +          (let ((target (string-append ,name "-" ,version)))
> +            (and (zero? (system* "tar" "xvf" source))
> +                 (zero? (system* "tar" "xvjf" (assoc-ref inputs "ant-bootstrap")))
> +                 (chdir target))
> +            (mkdir "openjdk")
> +            (with-directory-excursion "openjdk"
> +              (copy-file (assoc-ref inputs "openjdk6-src")
> +                         "openjdk-6-src-b34-20_jan_2015.tar.xz")
> +              (system* "tar" "xvf" "openjdk-6-src-b34-20_jan_2015.tar.xz"))))

(zero? (system* ...))

> +           (substitute* "Makefile.in"
> +             ;; link against libgcj to avoid linker error
> +             (("-o native-ecj")
> +              "-lgcj -o native-ecj")
> +             ;; do not leak information about the build host
> +             (("DISTRIBUTION_ID=\"\\$\\(DIST_ID\\)\"")
> +              "DISTRIBUTION_ID=\"\\\"guix\\\"\""))

This could go to ‘snippet’ because it’s independent of the inputs used
for the build, but do whatever seems most appropriate to you in terms of
structure.

[...]

> +              ;; JDK tests
> +              (with-directory-excursion "openjdk/jdk/test/"
> +                (substitute* "com/sun/jdi/JdbReadTwiceTest.sh"
> +                  (("/bin/pwd") (which "pwd")))
> +                (substitute* "com/sun/jdi/ShellScaffold.sh"
> +                  (("/bin/kill") (which "kill")))
> +                (substitute* "start-Xvfb.sh"
> +                  (("/usr/bin/X11/Xvfb") (which "Xvfb"))
> +                  (("/usr/bin/nohup")    (which "nohup")))
> +                (substitute* "javax/security/auth/Subject/doAs/Test.sh"
> +                  (("/bin/rm") (which "rm")))

Maybe something coarser would work as well:

  (substitute* (find-files "openjdk/jdk/test" ".")
    (("/usr/bin/([[:graphic:]]+)" _ command)
     (or (which command) command))
    (("/bin/([[:graphic:]]+)" _ command)
     (or (which command) command)))
    
WDYT?

> +            (alist-replace
> +             'check
> +             (lambda _
> +               (and (zero? (system* "make" "check-hotspot"))
> +                    (zero? (system* "make" "check-langtools"))
> +                    (zero? (system* "make" "check-jdk"))))

Maybe add a comment that the check- targets always return zero?

> +    (synopsis "A harness to build OpenJDK using Free Software build tools")

“Java development kit”?

> +    (description
> +     "The IcedTea project provides a harness to build the source code from
> +http://openjdk.java.net using Free Software build tools along with additional
> +features such as a Free Software plugin and web start implementation and an
> +LLVM-based JIT.")

No good idea here.  :-)

I remember spending hours on this in my Nix days, so a big thanks, and
congratulations for getting this far!

Ludo’.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: Add IcedTea 6
  2015-01-27 21:55 ` Ludovic Courtès
@ 2015-01-28 15:47   ` Ricardo Wurmus
  2015-01-28 16:13     ` Ludovic Courtès
  0 siblings, 1 reply; 11+ messages in thread
From: Ricardo Wurmus @ 2015-01-28 15:47 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès writes:
>> * I'm not happy with replacing the unpack phase and I don't like to
>>   refer to the OpenJDK source tarball by its full name
>>   "openjdk-6-src-b34-20_jan_2015.tar.xz".  Is there a way around this?
>
> You can just call it whatever you want in the 2nd argument to
> ‘copy-file’, no?

Of course!  I just stopped thinking at some point, I suppose.  (Or it's
a remnant from my initial attempts with IcedTea7 which expects tarballs
of particular names to exist.)

>> From 13490591fe7ad774e8ec95626113138d828366fb Mon Sep 17 00:00:00 2001
>> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
>> Date: Tue, 23 Dec 2014 12:32:25 +0100
>> Subject: [PATCH] gnu: Add IcedTea 6
>>
>> * gnu/packages/java.scm: New file.
>> * gnu-system.am (GNU_SYSTEM_MODULES): Add it.
>
> [...]
>
>> +     `(;; There are many failing tests.
>
> You can add that many are known to fail upstream.

Done.

>
>> +        'unpack
>> +        (lambda* (#:key source inputs #:allow-other-keys)
>> +          (let ((target (string-append ,name "-" ,version)))
>> +            (and (zero? (system* "tar" "xvf" source))
>> +                 (zero? (system* "tar" "xvjf" (assoc-ref inputs "ant-bootstrap")))
>> +                 (chdir target))
>> +            (mkdir "openjdk")
>> +            (with-directory-excursion "openjdk"
>> +              (copy-file (assoc-ref inputs "openjdk6-src")
>> +                         "openjdk-6-src-b34-20_jan_2015.tar.xz")
>> +              (system* "tar" "xvf" "openjdk-6-src-b34-20_jan_2015.tar.xz"))))
>
> (zero? (system* ...))

Done.  Now all three steps (unpacking IcedTea, unpacking ant and
unpacking the OpenJDK sources) are checked for non-zero.

>> +           (substitute* "Makefile.in"
>> +             ;; link against libgcj to avoid linker error
>> +             (("-o native-ecj")
>> +              "-lgcj -o native-ecj")
>> +             ;; do not leak information about the build host
>> +             (("DISTRIBUTION_ID=\"\\$\\(DIST_ID\\)\"")
>> +              "DISTRIBUTION_ID=\"\\\"guix\\\"\""))
>
> This could go to ‘snippet’ because it’s independent of the inputs used
> for the build, but do whatever seems most appropriate to you in terms of
> structure.

I made this a snippet.  Other things that would be good as snippets
(such as the patch to remove the timestamps) can only be done after the
build has started, because IcedTea patches the unpacked sources quite a
bit.

>> +              ;; JDK tests
>> +              (with-directory-excursion "openjdk/jdk/test/"
>> +                (substitute* "com/sun/jdi/JdbReadTwiceTest.sh"
>> +                  (("/bin/pwd") (which "pwd")))
>> +                (substitute* "com/sun/jdi/ShellScaffold.sh"
>> +                  (("/bin/kill") (which "kill")))
>> +                (substitute* "start-Xvfb.sh"
>> +                  (("/usr/bin/X11/Xvfb") (which "Xvfb"))
>> +                  (("/usr/bin/nohup")    (which "nohup")))
>> +                (substitute* "javax/security/auth/Subject/doAs/Test.sh"
>> +                  (("/bin/rm") (which "rm")))
>
> Maybe something coarser would work as well:
>
>   (substitute* (find-files "openjdk/jdk/test" ".")
>     (("/usr/bin/([[:graphic:]]+)" _ command)
>      (or (which command) command))
>     (("/bin/([[:graphic:]]+)" _ command)
>      (or (which command) command)))
>     
> WDYT?

I tried this but ran into a couple of problems.  Not all instances of
/bin are bad.  There are many places in the tests where /bin follows a
variable (and these are totally fine).  I also don't want to patch
shebangs twice.  The character class would have to be picked carefully
as well, because commands are sometimes quoted or inside braces etc.

Here's what I used before I gave up ([^[:space:]] instead of
[[:graphic:]] because the latter does not seem to exist and because it
would catch all sorts of unwanted characters if it did):

 (substitute* (find-files "." "\\.(sh|java)$")
   (("[^!](/usr)?/bin/([^[:space:]]+)" _ _ command)
    (or (which command) command)))

To come up with a reliable and maintainable regular expression is a
little messier than I anticipated.  I find it more precise to only fix
those instances that actually cause problems.

>> +            (alist-replace
>> +             'check
>> +             (lambda _
>> +               (and (zero? (system* "make" "check-hotspot"))
>> +                    (zero? (system* "make" "check-langtools"))
>> +                    (zero? (system* "make" "check-jdk"))))
>
> Maybe add a comment that the check- targets always return zero?

I rewrote this to instead check the generated test logs in test/ for
lines starting with "Error:" or "FAILED:".  To disable tests I wrapped
it in an (or #t ...) as the argument #:tests? #f does not disable a
custom check phase.

             'check
             (lambda _
               ;; The "make check-*" targets always return zero, so we need to
               ;; check for errors in the associated log files to determine
               ;; whether any tests have failed.
               (use-modules (ice-9 rdelim))
               (let* ((error-pattern (make-regexp "^(Error|FAILED):.*"))
                      (checker (lambda (port)
                                 (let loop ((_ #t))
                                  (let ((line (read-line port)))
                                    (cond
                                     ((eof-object? line) #t)
                                     ((regexp-exec error-pattern line) #f)
                                     (else (loop #t)))))))
                      (run-test (lambda (test)
                                  (system* "make" test)
                                  (call-with-input-file
                                      (string-append "test/" test ".log")
                                    checker))))
                 (or #t ; skip tests
                     (and (run-test "check-hotspot")
                          (run-test "check-langtools")
                          (run-test "check-jdk")))))

>> +    (synopsis "A harness to build OpenJDK using Free Software build tools")
>
> “Java development kit”?

Okay.

>> +    (description
>> +     "The IcedTea project provides a harness to build the source code from
>> +http://openjdk.java.net using Free Software build tools along with additional
>> +features such as a Free Software plugin and web start implementation and an
>> +LLVM-based JIT.")
>
> No good idea here.  :-)

How about this:

   "The OpenJDK built with the IcedTea build harness."

It doesn't sound great but it actually says what it is.

~~ Ricardo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: Add IcedTea 6
  2015-01-28 15:47   ` Ricardo Wurmus
@ 2015-01-28 16:13     ` Ludovic Courtès
  2015-01-29  9:47       ` Ricardo Wurmus
  0 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2015-01-28 16:13 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> Ludovic Courtès writes:

[...]

>>> +           (substitute* "Makefile.in"
>>> +             ;; link against libgcj to avoid linker error
>>> +             (("-o native-ecj")
>>> +              "-lgcj -o native-ecj")
>>> +             ;; do not leak information about the build host
>>> +             (("DISTRIBUTION_ID=\"\\$\\(DIST_ID\\)\"")
>>> +              "DISTRIBUTION_ID=\"\\\"guix\\\"\""))
>>
>> This could go to ‘snippet’ because it’s independent of the inputs used
>> for the build, but do whatever seems most appropriate to you in terms of
>> structure.
>
> I made this a snippet.  Other things that would be good as snippets
> (such as the patch to remove the timestamps) can only be done after the
> build has started, because IcedTea patches the unpacked sources quite a
> bit.

OK.

[...]

> I tried this but ran into a couple of problems.  Not all instances of
> /bin are bad.  There are many places in the tests where /bin follows a
> variable (and these are totally fine).  I also don't want to patch
> shebangs twice.  The character class would have to be picked carefully
> as well, because commands are sometimes quoted or inside braces etc.
>
> Here's what I used before I gave up ([^[:space:]] instead of
> [[:graphic:]] because the latter does not seem to exist and because it
> would catch all sorts of unwanted characters if it did):
>
>  (substitute* (find-files "." "\\.(sh|java)$")
>    (("[^!](/usr)?/bin/([^[:space:]]+)" _ _ command)
>     (or (which command) command)))

OK.  Well, let’s keep it the way you initially wrote it.

>>> +            (alist-replace
>>> +             'check
>>> +             (lambda _
>>> +               (and (zero? (system* "make" "check-hotspot"))
>>> +                    (zero? (system* "make" "check-langtools"))
>>> +                    (zero? (system* "make" "check-jdk"))))
>>
>> Maybe add a comment that the check- targets always return zero?
>
> I rewrote this to instead check the generated test logs in test/ for
> lines starting with "Error:" or "FAILED:".  To disable tests I wrapped
> it in an (or #t ...) as the argument #:tests? #f does not disable a
> custom check phase.
>
>              'check
>              (lambda _
>                ;; The "make check-*" targets always return zero, so we need to
>                ;; check for errors in the associated log files to determine
>                ;; whether any tests have failed.
>                (use-modules (ice-9 rdelim))
>                (let* ((error-pattern (make-regexp "^(Error|FAILED):.*"))
>                       (checker (lambda (port)
>                                  (let loop ((_ #t))

You can make it (let loop () ... (loop)).

>                                   (let ((line (read-line port)))
>                                     (cond
>                                      ((eof-object? line) #t)
>                                      ((regexp-exec error-pattern line) #f)
>                                      (else (loop #t)))))))
>                       (run-test (lambda (test)
>                                   (system* "make" test)
>                                   (call-with-input-file
>                                       (string-append "test/" test ".log")
>                                     checker))))
>                  (or #t ; skip tests
>                      (and (run-test "check-hotspot")
>                           (run-test "check-langtools")
>                           (run-test "check-jdk")))))

OK.

>>> +    (description
>>> +     "The IcedTea project provides a harness to build the source code from
>>> +http://openjdk.java.net using Free Software build tools along with additional
>>> +features such as a Free Software plugin and web start implementation and an
>>> +LLVM-based JIT.")
>>
>> No good idea here.  :-)
>
> How about this:
>
>    "The OpenJDK built with the IcedTea build harness."
>
> It doesn't sound great but it actually says what it is.

Fine with me.

One last thing: perhaps we can directly remove mips64el-linux from
‘supported-platforms’?

OK to push.  

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: Add IcedTea 6
  2015-01-28 16:13     ` Ludovic Courtès
@ 2015-01-29  9:47       ` Ricardo Wurmus
  2015-01-29 22:44         ` Andreas Enge
  0 siblings, 1 reply; 11+ messages in thread
From: Ricardo Wurmus @ 2015-01-29  9:47 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès writes:
>> I rewrote this to instead check the generated test logs in test/ for
>> lines starting with "Error:" or "FAILED:".  To disable tests I wrapped
>> it in an (or #t ...) as the argument #:tests? #f does not disable a
>> custom check phase.
>>
>>              'check
>>              (lambda _
>>                ;; The "make check-*" targets always return zero, so we need to
>>                ;; check for errors in the associated log files to determine
>>                ;; whether any tests have failed.
>>                (use-modules (ice-9 rdelim))
>>                (let* ((error-pattern (make-regexp "^(Error|FAILED):.*"))
>>                       (checker (lambda (port)
>>                                  (let loop ((_ #t))
>
> You can make it (let loop () ... (loop)).

Ah, right.  Fixed.

> One last thing: perhaps we can directly remove mips64el-linux from
> ‘supported-platforms’?

Is it known to not build on mips64el?

> OK to push.  

I pushed without disabling any platform yet.  Based on the build results
I will update the package.

> Thanks,
> Ludo’.

Cheers,
Ricardo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: Add IcedTea 6
  2015-01-29  9:47       ` Ricardo Wurmus
@ 2015-01-29 22:44         ` Andreas Enge
  2015-02-15 12:52           ` Andreas Enge
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Enge @ 2015-01-29 22:44 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

On Thu, Jan 29, 2015 at 10:47:17AM +0100, Ricardo Wurmus wrote:
> I pushed without disabling any platform yet.  Based on the build results
> I will update the package.

It does not build on mips:
   http://hydra.gnu.org/build/224665
My guess would be that the bootstrap binaries are for i?86 platforms.

Andreas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: Add IcedTea 6
  2015-01-29 22:44         ` Andreas Enge
@ 2015-02-15 12:52           ` Andreas Enge
  2015-02-15 13:54             ` Ricardo Wurmus
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Enge @ 2015-02-15 12:52 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Hello,

I just replaced the debian java with the icedtea6 you packaged in my android
project, and it works well! Do you also plan to package ant?

Andreas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: Add IcedTea 6
  2015-02-15 12:52           ` Andreas Enge
@ 2015-02-15 13:54             ` Ricardo Wurmus
  2015-02-15 14:44               ` Andreas Enge
  0 siblings, 1 reply; 11+ messages in thread
From: Ricardo Wurmus @ 2015-02-15 13:54 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel


Andreas Enge writes:

> I just replaced the debian java with the icedtea6 you packaged in my android
> project, and it works well! Do you also plan to package ant?

That's great!  I'm glad it actually works!

I already packaged ant-minimal with only the most basic features
enabled, as most additional features depend on libraries that need ant
in order to build them.  Here's the latest version of my patch to add
the ant-minimal package for which I'm waiting for a final OK before
pushing:

  https://lists.gnu.org/archive/html/guix-devel/2015-02/msg00228.html

~~ Ricardo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: Add IcedTea 6
  2015-02-15 13:54             ` Ricardo Wurmus
@ 2015-02-15 14:44               ` Andreas Enge
  2015-02-15 15:57                 ` Ricardo Wurmus
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Enge @ 2015-02-15 14:44 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Speaking of java, I have a file
   gnu/packages/javac.in
which is under version control, and which is required to compile guix.
It has been introduced there:

commit 74574fd1e3fad5e0c1d061ce194e47dde0f7f175
Author: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date:   Tue Dec 23 12:31:50 2014 +0100

    gnu: Add GCJ
    
    * gnu/packages/gcc.scm (gcj-4.8, ecj-bootstrap-4.8): New variables.
    * gnu/packages/javac.in: New file.

Should this not be handled as a patch to one of these packages?

Andreas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: Add IcedTea 6
  2015-02-15 14:44               ` Andreas Enge
@ 2015-02-15 15:57                 ` Ricardo Wurmus
  2015-02-15 16:05                   ` Andreas Enge
  0 siblings, 1 reply; 11+ messages in thread
From: Ricardo Wurmus @ 2015-02-15 15:57 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel


Andreas Enge writes:

> Speaking of java, I have a file
>    gnu/packages/javac.in
> which is under version control, and which is required to compile guix.

This is a template for a wrapper script around GCJ to convert
javac-style arguments to arguments GCJ can understand.  It's needed to
compile OpenJDK with IcedTea when the only JDK available is GCJ.

There does not appear to be a proper upstream for this script, so after
discussing this we decided not to download the file from the Gentoo
package sources but rather provide it with Guix.

~~ Ricardo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH]: Add IcedTea 6
  2015-02-15 15:57                 ` Ricardo Wurmus
@ 2015-02-15 16:05                   ` Andreas Enge
  0 siblings, 0 replies; 11+ messages in thread
From: Andreas Enge @ 2015-02-15 16:05 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

On Sun, Feb 15, 2015 at 04:57:07PM +0100, Ricardo Wurmus wrote:
> There does not appear to be a proper upstream for this script, so after
> discussing this we decided not to download the file from the Gentoo
> package sources but rather provide it with Guix.

But could you not add it as a patch (under the name
gnu/packages/icedtea6-xxxx.patch) to the icedtea6 sources, instead of
dropping it in the main gnu/packages directory?

Andreas

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-02-15 16:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-27 15:33 [PATCH]: Add IcedTea 6 Ricardo Wurmus
2015-01-27 21:55 ` Ludovic Courtès
2015-01-28 15:47   ` Ricardo Wurmus
2015-01-28 16:13     ` Ludovic Courtès
2015-01-29  9:47       ` Ricardo Wurmus
2015-01-29 22:44         ` Andreas Enge
2015-02-15 12:52           ` Andreas Enge
2015-02-15 13:54             ` Ricardo Wurmus
2015-02-15 14:44               ` Andreas Enge
2015-02-15 15:57                 ` Ricardo Wurmus
2015-02-15 16:05                   ` Andreas Enge

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).