Browse Source

gnu: Add IcedTea 6

* gnu/packages/java.scm: New file.
Ricardo Wurmus 8 years ago
  1. 1
  2. 424


@ -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 \


@ -0,0 +1,424 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Ricardo Wurmus <>
;;; 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
;;; 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 <>.
(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
(name "icedtea6")
(version "1.13.6")
(source (origin
(method url-fetch)
(uri (string-append
version ".tar.xz"))
(modules '((guix build utils)))
'(substitute* ""
;; link against libgcj to avoid linker error
(("-o native-ecj")
"-lgcj -o native-ecj")
;; do not leak information about the build host
(build-system gnu-build-system)
`(;; There are many failing tests and many are known to fail upstream.
;; * Hotspot VM tests:
;; FAILED: compiler/7082949/
;; FAILED: compiler/7088020/
;; FAILED: runtime/6929067/
;; FAILED: serviceability/sa/jmap-hashcode/
;; => Test results: passed: 161; failed: 4
;; * langtools tests:
;; FAILED: com/sun/javadoc/testHtmlDefinitionListTag/
;; FAILED: tools/javac/6627362/
;; FAILED: tools/javac/7003595/
;; FAILED: tools/javac/7024568/
;; FAILED: tools/javap/4111861/
;; FAILED: tools/javap/
;; FAILED: tools/javap/
;; FAILED: tools/javap/
;; FAILED: tools/javap/
;; --> fails because of insignificant whitespace differences
;; in output of javap
;; FAILED: tools/javap/
;; => Test results: passed: 1,445; failed: 10
;; * JDK tests:
;; Tests are incomplete because of a segfault after this test:
;; javax/crypto/spec/RC5ParameterSpec/
;; A bug report has already been filed upstream:
;; 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
(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")))
"--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")))
(lambda* (#:key source inputs #:allow-other-keys)
(and (zero? (system* "tar" "xvf" source))
(zero? (system* "tar" "xvjf"
(assoc-ref inputs "ant-bootstrap")))
(chdir (string-append ,name "-" ,version))
(mkdir "openjdk")
(with-directory-excursion "openjdk"
(copy-file (assoc-ref inputs "openjdk6-src")
(zero? (system* "tar" "xvf" "openjdk6-src.tar.xz"))))))
'unpack 'patch-paths
(lambda _
(patch-shebang "../apache-ant-1.9.4/bin/ant")
;; shebang in patches so that they apply cleanly
(substitute* '("patches/jtreg-jrunscript.patch"
(("#!/bin/sh") (string-append "#!" (which "sh"))))
;; fix path to alsa header in patch
(substitute* "patches/openjdk/6799141-split_out_versions.patch"
(string-append "ALSA_INCLUDE="
(assoc-ref %build-inputs "alsa-lib")
;; 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"
(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"
(("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 *=.*(n|g)awk")
(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.
(("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"))))
'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") "")))
(string-append (assoc-ref %build-inputs "cups")
(string-append (assoc-ref %build-inputs "freetype")
(string-append (assoc-ref %build-inputs "freetype")
(string-append antpath "/lib" ":" gcjlib))
(setenv "PATH" (string-append antpath "/bin:"
(getenv "PATH")))))
'check 'fix-tests
(lambda _
;; Fix PATH in test environment
(substitute* "src/jtreg/com/sun/javatest/regtest/"
(string-append "PATH=" (getenv "PATH"))))
(substitute* "src/jtreg/com/sun/javatest/util/"
(("/usr/bin/env") (which "env")))
;; Hotspot tests
(with-directory-excursion "openjdk/hotspot/test/"
(substitute* "jprt.config"
(string-append "PATH=" (getenv "PATH")))
(string-append "make=" (which "make"))))
(substitute* '("runtime/6626217/"
(("/bin/rm") (which "rm"))
(("/bin/cp") (which "cp"))
(("/bin/mv") (which "mv"))))
;; JDK tests
(with-directory-excursion "openjdk/jdk/test/"
(substitute* "com/sun/jdi/"
(("/bin/pwd") (which "pwd")))
(substitute* "com/sun/jdi/"
(("/bin/kill") (which "kill")))
(substitute* ""
;(("/usr/bin/X11/Xvfb") (which "Xvfb"))
(("/usr/bin/nohup") (which "nohup")))
(substitute* "javax/security/auth/Subject/doAs/"
(("/bin/rm") (which "rm")))
(substitute* "tools/launcher/"
(("echo \"#!/bin/sh\"")
(string-append "echo \"#!" (which "rm") "\""))
(("/usr/bin/zip") (which "zip")))
(substitute* "com/sun/jdi/"
(("#!/bin/sh") (string-append "#!" (which "sh"))))
(substitute* "java/lang/management/OperatingSystemMXBean/"
(("/usr/bin/uptime") (which "uptime")))
(substitute* "java/lang/ProcessBuilder/"
(("/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/"
(("/bin/sh") (which "sh")))
(substitute* "java/lang/ProcessBuilder/"
(("/usr/bin/perl") (which "perl"))
(("/bin/ps") (which "ps"))
(("/bin/true") (which "true")))
(substitute* "java/lang/Runtime/exec/"
(("/usr/bin/tee") (which "tee")))
(substitute* "java/lang/Runtime/exec/"
(("/bin/true") (which "true")))
(substitute* "java/lang/Runtime/exec/"
(("/bin/cat") (which "cat")))
(substitute* "java/lang/Runtime/exec/"
(("/bin/sh") (which "sh"))
(("/bin/true") (which "true"))
(("/bin/kill") (which "kill")))
(substitute* "java/lang/Runtime/exec/"
(("/usr/bin/echo") (which "echo")))
(substitute* "java/lang/Runtime/exec/"
(("/usr/bin/cat") (which "cat")))
(substitute* "java/lang/Runtime/exec/"
(("/bin/cat") (which "cat"))
(("/bin/sleep") (which "sleep"))
(("/bin/sh") (which "sh")))
(substitute* "java/lang/Runtime/exec/"
(("/bin/cat") (which "cat")))
(substitute* "java/rmi/activation/CommandEnvironment/"
(("/bin/chmod") (which "chmod")))
(substitute* "java/util/zip/ZipFile/"
(("/bin/sh") (which "sh")))))
(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 ()
(let ((line (read-line port)))
((eof-object? line) #t)
((regexp-exec error-pattern line) #f)
(else (loop)))))))
(run-test (lambda (test)
(system* "make" test)
(string-append "test/" test ".log")
(or #t ; skip tests
(and (run-test "check-hotspot")
(run-test "check-langtools")
(run-test "check-jdk")))))
(lambda _
(copy-recursively "" %output))
(method url-fetch)
(uri "")
("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
(method url-fetch)
(uri "")
("lcms" ,lcms)
("zlib" ,zlib)
("gtk" ,gtk+-2)
("fontconfig" ,fontconfig)
("freetype" ,freetype)
("gcj" ,gcj-4.8)))
(home-page "")
(synopsis "Java development kit")
"The OpenJDK built with the IcedTea build harness.")
;; IcedTea is released under the GPL2 + Classpath exception, which is the
;; same license as both GNU Classpath and OpenJDK.
(license license:gpl2+)))