You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

12945 lines
537 KiB

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
;;; Copyright © 2016, 2017 Roel Janssen <roel@gnu.org>
;;; Copyright © 2017, 2019 Carlo Zancanaro <carlo@zancanaro.id.au>
;;; Copyright © 2017-2020 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
;;; Copyright © 2016, 2017, 2018 Alex Vong <alexvong1995@gmail.com>
;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018, 2019 Gábor Boskovits <boskovits@gmail.com>
;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com>
;;; Copyright © 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2019, 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; 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 hg-download)
#:use-module (guix git-download)
#:use-module (guix svn-download)
#:use-module (guix utils)
#:use-module (guix build-system ant)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#: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 certs)
#:use-module (gnu packages cpio)
#:use-module (gnu packages cups)
#:use-module (gnu packages compression)
#:use-module (gnu packages elf)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages gawk)
#:use-module (gnu packages gettext)
#:use-module (gnu packages gl)
#:use-module (gnu packages ghostscript) ;lcms
#:use-module (gnu packages gnome)
#:use-module (gnu packages groovy)
#:use-module (gnu packages gtk)
#:use-module (gnu packages guile)
#:use-module (gnu packages icu4c)
#:use-module (gnu packages image)
#:use-module (gnu packages java-compression)
#:use-module (gnu packages libffi)
#:use-module (gnu packages linux) ;alsa
#:use-module (gnu packages maths)
#:use-module (gnu packages maven)
#:use-module (gnu packages maven-parent-pom)
#:use-module (gnu packages nss)
#:use-module (gnu packages onc-rpc)
#:use-module (gnu packages web)
#:use-module (gnu packages wget)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages perl)
#:use-module (gnu packages popt)
#:use-module (gnu packages kerberos)
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg)
#:use-module (gnu packages texinfo)
#:use-module ((srfi srfi-1) #:select (fold alist-delete))
#:use-module (srfi srfi-11)
#:use-module (ice-9 match))
;;;
;;; Java bootstrap toolchain.
;;;
;; The Java bootstrap begins with Jikes, a Java compiler written in C++. We
;; use it to build a simple version of GNU Classpath, the Java standard
;; library. We chose version 0.93 because it is the last version that can be
;; built with Jikes. With Jikes and this version of GNU Classpath we can
;; build JamVM, a Java Virtual Machine. We build version 1.5.1 because it is
;; the last version of JamVM that works with a version of GNU classpath that
;; does not require ECJ. These three packages make up the bootstrap JDK.
;; This is sufficient to build an older version of Ant, which is needed to
;; build an older version of ECJ, an incremental Java compiler, both of which
;; are written in Java.
;;
;; ECJ is needed to build the latest release (0.99) and the development
;; version of GNU Classpath. The development version of GNU Classpath has
;; much more support for Java 1.6 than the latest release, but we need to
;; build 0.99 first to get a working version of javah. ECJ, the development
;; version of GNU Classpath, and the latest version of JamVM make up the
;; second stage JDK with which we can build the OpenJDK with the Icedtea 1.x
;; build framework. We then build the more recent JDKs Icedtea 2.x and
;; Icedtea 3.x.
(define-public libantlr3c
(package
(name "libantlr3c")
(version "3.4")
(source
(origin
(method url-fetch)
(uri
(string-append "https://www.antlr3.org/download/C/"
name "-" version ".tar.gz"))
(sha256
(base32 "0lpbnb4dq4azmsvlhp6khq1gy42kyqyjv8gww74g5lm2y6blm4fa"))))
(build-system gnu-build-system)
(arguments
`(#:configure-flags (list "--enable-debuginfo" "--disable-static")
#:phases (modify-phases %standard-phases
(replace 'configure
(lambda* (#:key build target native-inputs inputs outputs
(configure-flags '()) out-of-source? system
#:allow-other-keys)
(let ((configure (assoc-ref %standard-phases 'configure))
(enable-64bit? (member system '("aarch64-linux"
"x86_64-linux"
"mips64el-linux"))))
(configure #:build build #:target target
#:native-inputs native-inputs
#:inputs inputs #:outputs outputs
#:configure-flags `(,(if enable-64bit?
"--enable-64bit"
'())
,@configure-flags)
#:out-of-source? out-of-source?)))))))
(synopsis "ANTLR C Library")
(description "LIBANTLR3C provides run-time C libraries for ANTLR3 (ANother
Tool for Language Recognition v3).")
(home-page "https://www.antlr3.org/")
(license license:bsd-3)))
(define jikes
(package
(name "jikes")
(version "1.22")
(source (origin
(method url-fetch)
(uri (string-append "mirror://sourceforge/jikes/Jikes/"
version "/jikes-" version ".tar.bz2"))
(sha256
(base32
"1qqldrp74pzpy5ly421srqn30qppmm9cvjiqdngk8hf47dv2rc0c"))))
(build-system gnu-build-system)
(home-page "http://jikes.sourceforge.net/")
(synopsis "Compiler for the Java language")
(description "Jikes is a compiler that translates Java source files as
defined in The Java Language Specification into the bytecoded instruction set
and binary format defined in The Java Virtual Machine Specification.")
(license license:ibmpl1.0)))
(define-public drip
;; Last release is from 2014, with a few important commits afterwards.
(let ((commit "a4bd00df0199e78243847f06cc04ecaea31f8f08"))
(package
(name "drip")
(version (git-version "0.2.4" "1" commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ninjudd/drip")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"0wzmjwfyldr3jn49517xd8yn7dgdk8h88qkga3kjyg1zc375ylg2"))))
(build-system gnu-build-system)
(native-inputs
`(("jdk" ,icedtea "jdk")))
(arguments
`(#:tests? #f ; No tests.
#:phases
(modify-phases %standard-phases
(delete 'configure)
(add-before 'install 'fix-wrapper
(lambda* (#:key inputs #:allow-other-keys)
(let ((jps (string-append (assoc-ref inputs "jdk") "/bin/jps")))
(substitute* "bin/drip"
(("jps") jps)
(("brew update && brew upgrade drip") "guix pull && guix install drip")
;; No need to make:
(("\\(cd -- \"\\$drip_dir\" && make -s\\) \\|\\| exit 1") "")
;; No need to include source:
(("\\[\\[ -r \\$drip_dir/src/org/flatland/drip/Main\\.java \\]\\]")
"true"))
#t)))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin"))
(share (string-append out "/share/drip")))
(mkdir-p bin)
(for-each
(lambda (file)
(install-file (string-append "bin/" file) bin))
'("drip" "drip_daemon" "drip_proxy"))
(install-file "drip.jar" share)
(substitute* (string-append bin "/drip")
(("drip_dir=\\$bin_dir/..")
(string-append "drip_dir=" share)))
#t))))))
(home-page "https://github.com/ninjudd/drip")
(synopsis "Faster Java Virtual Machine launching")
(description "Drip is a launcher for the Java Virtual Machine that
provides much faster startup times than the @command{java} command. The @command{drip}
script is intended to be a drop-in replacement for the @command{java} command,
only faster.")
(license license:epl1.0))))
;; This is the last version of GNU Classpath that can be built without ECJ.
(define classpath-bootstrap
(package
(name "classpath")
(version "0.93")
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnu/classpath/classpath-"
version ".tar.gz"))
(sha256
(base32
"0i99wf9xd3hw1sj2sazychb9prx8nadxh2clgvk3zlmb28v0jbfz"))
(patches (search-patches "classpath-aarch64-support.patch"))))
(build-system gnu-build-system)
(arguments
`(#:configure-flags
(list (string-append "JAVAC="
(assoc-ref %build-inputs "jikes")
"/bin/jikes")
"--disable-Werror"
"--disable-gmp"
"--disable-gtk-peer"
"--disable-gconf-peer"
"--disable-plugin"
"--disable-dssi"
"--disable-alsa"
"--disable-gjdoc")
#:phases
(modify-phases %standard-phases
;; XXX: This introduces a memory leak as we remove a call to free up
;; memory for the file name string. This was necessary because of a
;; runtime error that would have prevented us from building
;; ant-bootstrap later. See https://issues.guix.gnu.org/issue/36685
;; for the gnarly details.
(add-after 'unpack 'remove-call-to-free
(lambda _
(substitute* "native/jni/java-io/java_io_VMFile.c"
(("result = cpio_isFileExists.*" m)
(string-append m "\n//")))
#t))
(add-after 'install 'install-data
(lambda _ (invoke "make" "install-data"))))))
(native-inputs
`(("jikes" ,jikes)
("fastjar" ,fastjar)
("libltdl" ,libltdl)
("pkg-config" ,pkg-config)))
(home-page "https://www.gnu.org/software/classpath/")
(synopsis "Essential libraries for Java")
(description "GNU Classpath is a project to create core class libraries
for use with runtimes, compilers and tools for the Java programming
language.")
;; GPLv2 or later, with special linking exception.
(license license:gpl2+)))
;; This is the last version of JamVM that works with a version of GNU
;; classpath that does not require ECJ.
(define jamvm-1-bootstrap
(package
(name "jamvm")
(version "1.5.1")
(source (origin
(method url-fetch)
(uri (string-append "mirror://sourceforge/jamvm/jamvm/"
"JamVM%20" version "/jamvm-"
version ".tar.gz"))
(patches (search-patches "jamvm-arm.patch"))
(sha256
(base32
"06lhi03l3b0h48pc7x58bk9my2nrcf1flpmglvys3wyad6yraf36"))
(snippet
'(begin
;; Remove precompiled software.
(delete-file "lib/classes.zip")
#t))))
(build-system gnu-build-system)
(arguments
`(#:configure-flags
(list (string-append "--with-classpath-install-dir="
(assoc-ref %build-inputs "classpath"))
"--disable-int-caching"
"--enable-runtime-reloc-checks"
"--enable-ffi")))
(inputs
`(("classpath" ,classpath-bootstrap)
("jikes" ,jikes)
("libffi" ,libffi)
("zip" ,zip)
("zlib" ,zlib)))
(home-page "http://jamvm.sourceforge.net/")
(synopsis "Small Java Virtual Machine")
(description "JamVM is a Java Virtual Machine conforming to the JVM
specification edition 2 (blue book). It is extremely small. However, unlike
other small VMs it supports the full spec, including object finalisation and
JNI.")
(license license:gpl2+)))
(define ant-bootstrap
(package
(name "ant-bootstrap")
;; The 1.10.x series requires Java 8. 1.9.0 and later use generics, which
;; are not supported. The 1.8.x series is the last to use only features
;; supported by Jikes.
(version "1.8.4")
(source (origin
(method url-fetch)
(uri (string-append "mirror://apache/"
"ant/source/apache-ant-"
version "-src.tar.bz2"))
(sha256
(base32
"1cg0lga887qz5iizh6mlkxp01lciymrhmp7wzxpl6zpnldxmzrjx"))))
(build-system gnu-build-system)
(arguments
`(#:imported-modules ((guix build syscalls)
,@%gnu-build-system-modules)
#:modules ((srfi srfi-1)
(guix build gnu-build-system)
(guix build utils)
(guix build syscalls))
#:tests? #f ; no "check" target
#:phases
(modify-phases %standard-phases
(delete 'bootstrap)
(delete 'configure)
(replace 'build
(lambda* (#:key inputs #:allow-other-keys)
(setenv "JAVA_HOME" (assoc-ref inputs "jamvm"))
(setenv "JAVACMD"
(string-append (assoc-ref inputs "jamvm")
"/bin/jamvm"))
(setenv "JAVAC"
(string-append (assoc-ref inputs "jikes")
"/bin/jikes"))
(setenv "CLASSPATH"
(string-append (assoc-ref inputs "jamvm")
"/lib/rt.jar"))
;; Ant complains if this file doesn't exist.
(setenv "HOME" "/tmp")
(with-output-to-file "/tmp/.ant.properties"
(lambda _ (display "")))
;; Use jikes instead of javac for <javac ...> tags in build.xml
(setenv "ANT_OPTS" "-Dbuild.compiler=jikes")
;; jikes produces lots of warnings, but they are not very
;; interesting, so we silence them.
(setenv "$BOOTJAVAC_OPTS" "-nowarn")
;; Without these JamVM options the build may freeze.
(substitute* "bootstrap.sh"
(("^\"\\$\\{JAVACMD\\}\" " m)
,@(if (string-prefix? "armhf" (or (%current-system)
(%current-target-system)))
`((string-append m "-Xnocompact "))
`((string-append m "-Xnocompact -Xnoinlining ")))))
;; Disable tests because we are bootstrapping and thus don't have
;; any of the dependencies required to build and run the tests.
(substitute* "build.xml"
(("depends=\"jars,test-jar\"") "depends=\"jars\""))
(invoke "bash" "bootstrap.sh"
(string-append "-Ddist.dir="
(assoc-ref %outputs "out")))))
(add-after 'build 'strip-jar-timestamps ;based on ant-build-system
(lambda* (#:key outputs #:allow-other-keys)
(define (repack-archive jar)
(let* ((dir (mkdtemp! "jar-contents.XXXXXX"))
(manifest (string-append dir "/META-INF/MANIFESTS.MF")))
(with-directory-excursion dir
(invoke "unzip" jar))
(delete-file jar)
;; XXX: copied from (gnu build install)
(for-each (lambda (file)
(let ((s (lstat file)))
(unless (eq? (stat:type s) 'symlink)
(utime file 0 0 0 0))))
(find-files dir #:directories? #t))
;; It is important that the manifest appears first.
(with-directory-excursion dir
(let* ((files (find-files "." ".*" #:directories? #t))
;; To ensure that the reference scanner can
;; detect all store references in the jars
;; we disable compression with the "-0" option.
(command (if (file-exists? manifest)
`("zip" "-0" "-X" ,jar ,manifest
,@files)
`("zip" "-0" "-X" ,jar ,@files))))
(apply invoke command)))))
(for-each repack-archive
(find-files
(string-append (assoc-ref %outputs "out") "/lib")
"\\.jar$"))
#t))
(delete 'install))))
(native-inputs
`(("jikes" ,jikes)
("jamvm" ,jamvm-1-bootstrap)
("unzip" ,unzip)
("zip" ,zip)))
(home-page "https://ant.apache.org")
(synopsis "Build tool for Java")
(description
"Ant is a platform-independent build tool for Java. It is similar to
make but is implemented using the Java language, requires the Java platform,
and is best suited to building Java projects. Ant uses XML to describe the
build process and its dependencies, whereas Make uses Makefile format.")
(license license:asl2.0)))
;; Version 3.2.2 is the last version without a dependency on a full-fledged
;; compiler for Java 1.5.
(define ecj-bootstrap
(package
(name "ecj-bootstrap")
(version "3.2.2")
(source (origin
(method url-fetch)
(uri (string-append "http://archive.eclipse.org/eclipse/"
"downloads/drops/R-" version
"-200702121330/ecjsrc.zip"))
(sha256
(base32
"05hj82kxd23qaglsjkaqcj944riisjha7acf7h3ljhrjyljx8307"))))
;; It would be so much easier if we could use the ant-build-system, but we
;; cannot as we don't have ant at this point. We use ecj for
;; bootstrapping the JDK.
(build-system gnu-build-system)
(arguments
`(#:modules ((guix build gnu-build-system)
(guix build utils)
(srfi srfi-1))
#:tests? #f ; there are no tests
#:phases
(modify-phases %standard-phases
(replace 'configure
(lambda* (#:key inputs #:allow-other-keys)
(setenv "CLASSPATH"
(string-join
(cons (string-append (assoc-ref inputs "jamvm")
"/lib/rt.jar")
(find-files (string-append
(assoc-ref inputs "ant-bootstrap")
"/lib")
"\\.jar$"))
":"))
#t))
(replace 'build
(lambda* (#:key inputs #:allow-other-keys)
;; The unpack phase enters the "org" directory by mistake.
(chdir "..")
;; Create a simple manifest to make ecj executable.
(with-output-to-file "manifest"
(lambda _
(display "Manifest-Version: 1.0
Main-Class: org.eclipse.jdt.internal.compiler.batch.Main\n")))
;; Compile it all!
(and (apply invoke "jikes"
(find-files "." "\\.java$"))
(invoke "fastjar" "cvfm"
"ecj-bootstrap.jar" "manifest" "."))))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((share (string-append (assoc-ref outputs "out")
"/share/java/")))
(mkdir-p share)
(install-file "ecj-bootstrap.jar" share)
#t))))))
(native-inputs
`(("ant-bootstrap" ,ant-bootstrap)
("unzip" ,unzip)
("jikes" ,jikes)
("jamvm" ,jamvm-1-bootstrap)
("fastjar" ,fastjar)))
(home-page "https://eclipse.org")
(synopsis "Eclipse Java development tools core batch compiler")
(description "This package provides the Eclipse Java core batch compiler
for bootstrapping purposes. The @dfn{Eclipse compiler for Java} (ecj) is a
requirement for all GNU Classpath releases after version 0.93.")
(license license:epl1.0)))
(define ecj-javac-wrapper
(package (inherit ecj-bootstrap)
(name "ecj-javac-wrapper")
(source #f)
(build-system trivial-build-system)
(arguments
`(#:modules ((guix build utils))
#:builder
(begin
(use-modules (guix build utils))
(let* ((bin (string-append (assoc-ref %outputs "out") "/bin"))
(target (string-append bin "/javac"))
(guile (string-append (assoc-ref %build-inputs "guile")
"/bin/guile"))
(ecj (string-append (assoc-ref %build-inputs "ecj-bootstrap")
"/share/java/ecj-bootstrap.jar"))
(java (string-append (assoc-ref %build-inputs "jamvm")
"/bin/jamvm"))
(bootcp (let ((jvmlib (string-append (assoc-ref %build-inputs "classpath")
"/share/classpath")))
(string-append jvmlib "/glibj.zip:"
jvmlib "/tools.zip"))))
(mkdir-p bin)
(with-output-to-file target
(lambda _
(format #t "#!~a --no-auto-compile\n!#\n" guile)
(write
`(begin (use-modules (ice-9 match)
(ice-9 receive)
(ice-9 hash-table)
(srfi srfi-1)
(srfi srfi-26))
(define defaults
'(("-bootclasspath" ,bootcp)
("-source" "1.5")
("-target" "1.5")
("-cp" ".")))
(define (main args)
(let ((classpath (getenv "CLASSPATH")))
(setenv "CLASSPATH"
(string-join (list ,ecj
,(string-append (assoc-ref %build-inputs "jamvm")
"/lib/rt.jar")
(or classpath ""))
":")))
(receive (vm-args other-args)
;; Separate VM arguments from arguments to ECJ.
(partition (cut string-prefix? "-J" <>)
(fold (lambda (default acc)
(if (member (first default) acc)
acc (append default acc)))
args defaults))
(apply system* ,java
(append
;; Remove "-J" prefix
(map (cut string-drop <> 2) vm-args)
'("org.eclipse.jdt.internal.compiler.batch.Main")
(cons "-nowarn" other-args)))))
;; Entry point
(let ((args (cdr (command-line))))
(if (null? args)
(format (current-error-port) "javac: no arguments given!\n")
(main args)))))))
(chmod target #o755)
#t))))
(native-inputs
`(("guile" ,guile-2.2)
("ecj-bootstrap" ,ecj-bootstrap)
("jamvm" ,jamvm-1-bootstrap)
("classpath" ,classpath-bootstrap)))
(description "This package provides a wrapper around the @dfn{Eclipse
compiler for Java} (ecj) with a command line interface that is compatible with
the standard javac executable.")))
;; The classpath-bootstrap was built without a virtual machine, so it does not
;; provide a wrapper for javah. We cannot build the development version of
;; Classpath without javah.
(define classpath-0.99
(package (inherit classpath-bootstrap)
(version "0.99")
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnu/classpath/classpath-"
version ".tar.gz"))
(sha256
(base32
"1j7cby4k66f1nvckm48xcmh352b1d1b33qk7l6hi7dp9i9zjjagr"))
(patches (search-patches "classpath-aarch64-support.patch"))))
(arguments
`(#:configure-flags
(list (string-append "--with-ecj-jar="
(assoc-ref %build-inputs "ecj-bootstrap")
"/share/java/ecj-bootstrap.jar")
(string-append "JAVAC="
(assoc-ref %build-inputs "ecj-javac-wrapper")
"/bin/javac")
(string-append "JAVA="
(assoc-ref %build-inputs "jamvm")
"/bin/jamvm")
"GCJ_JAVAC_TRUE=no"
"ac_cv_prog_java_works=yes" ; trust me
"--disable-Werror"
"--disable-gmp"
"--disable-gtk-peer"
"--disable-gconf-peer"
"--disable-plugin"
"--disable-dssi"
"--disable-alsa"
"--disable-gjdoc")
#:phases
(modify-phases %standard-phases
(add-after 'install 'install-data
(lambda _ (invoke "make" "install-data"))))))
(native-inputs
`(("ecj-bootstrap" ,ecj-bootstrap)
("ecj-javac-wrapper" ,ecj-javac-wrapper)
("fastjar" ,fastjar)
("jamvm" ,jamvm-1-bootstrap)
("classpath" ,classpath-bootstrap)
("libltdl" ,libltdl)
("pkg-config" ,pkg-config)))))
;; We need this because classpath-bootstrap does not provide all of the tools
;; we need to build classpath-devel.
(define classpath-jamvm-wrappers
(package (inherit classpath-0.99)
(name "classpath-jamvm-wrappers")
(source #f)
(build-system trivial-build-system)
(arguments
`(#:modules ((guix build utils))
#:builder
(begin
(use-modules (guix build utils))
(let* ((bash (assoc-ref %build-inputs "bash"))
(jamvm (assoc-ref %build-inputs "jamvm"))
(classpath (assoc-ref %build-inputs "classpath"))
(bin (string-append (assoc-ref %outputs "out")
"/bin/")))
(mkdir-p bin)
(for-each (lambda (tool)
(with-output-to-file (string-append bin tool)
(lambda _
,@(if (string-prefix? "armhf" (or (%current-system)
(%current-target-system)))
`((format #t "#!~a/bin/sh
~a/bin/jamvm -Xnocompact -classpath ~a/share/classpath/tools.zip \
gnu.classpath.tools.~a.~a $@"
bash jamvm classpath tool
(if (string=? "native2ascii" tool)
"Native2ASCII" "Main")))
`((format #t "#!~a/bin/sh
~a/bin/jamvm -Xnocompact -Xnoinlining -classpath ~a/share/classpath/tools.zip \
gnu.classpath.tools.~a.~a $@"
bash jamvm classpath tool
(if (string=? "native2ascii" tool)
"Native2ASCII" "Main"))))))
(chmod (string-append bin tool) #o755))
(list "javah"
"rmic"
"rmid"
"orbd"
"rmiregistry"
"native2ascii"))
#t))))
(native-inputs
`(("bash" ,bash)
("jamvm" ,jamvm-1-bootstrap)
("classpath" ,classpath-0.99)))
(inputs '())
(synopsis "Executables from GNU Classpath")
(description "This package provides wrappers around the tools provided by
the GNU Classpath library. They are executed by the JamVM virtual
machine.")))
;; The last release of GNU Classpath is 0.99 and it happened in 2012. Since
;; then Classpath has gained much more support for Java 1.6.
(define-public classpath-devel
(let ((commit "e7c13ee0cf2005206fbec0eca677f8cf66d5a103")
(revision "1"))
(package (inherit classpath-bootstrap)
(version (string-append "0.99-" revision "." (string-take commit 9)))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://git.savannah.gnu.org/git/classpath.git")
(commit commit)))
(file-name (string-append "classpath-" version "-checkout"))
(sha256
(base32
"1v2rww76ww322mpg3s12a1kkc6gkp31bm9gcxs532h0wq285fiw4"))))
(arguments
`(#:make-flags
;; Ensure that the initial heap size is smaller than the maximum
;; size. By default only Xmx is set, which can lead to invalid
;; memory settings on some machines with a lot of memory.
'("JAVAC_MEM_OPT=-J-Xms512M -J-Xmx768M")
#:configure-flags
(list (string-append "--with-ecj-jar="
(assoc-ref %build-inputs "ecj-bootstrap")
"/share/java/ecj-bootstrap.jar")
(string-append "--with-javac="
(assoc-ref %build-inputs "ecj-javac-wrapper")
"/bin/javac")
(string-append "JAVA="
(assoc-ref %build-inputs "jamvm")
"/bin/jamvm")
"GCJ_JAVAC_TRUE=no"
"ac_cv_prog_java_works=yes" ; trust me
"--disable-Werror"
"--disable-gmp"
"--disable-gtk-peer"
"--disable-gconf-peer"
"--disable-plugin"
"--disable-dssi"
"--disable-alsa"
"--disable-gjdoc")
#:phases
(modify-phases %standard-phases
;; XXX The bootstrap phase executes autogen.sh, which fails after
;; complaining about the lack of gettext.
(replace 'bootstrap
(lambda _ (invoke "autoreconf" "-vif")))
(add-after 'unpack 'remove-unsupported-annotations
(lambda _
(substitute* (find-files "java" "\\.java$")
(("@Override") ""))
#t))
(add-after 'install 'install-data
(lambda _ (invoke "make" "install-data"))))))
(native-inputs
`(("autoconf" ,autoconf)
("automake" ,automake)
("libtool" ,libtool)
("gettext" ,gettext-minimal)
("texinfo" ,texinfo)
("classpath-jamvm-wrappers" ,classpath-jamvm-wrappers) ; for javah
("ecj-bootstrap" ,ecj-bootstrap)
("ecj-javac-wrapper" ,ecj-javac-wrapper)
("fastjar" ,fastjar)
("jamvm" ,jamvm-1-bootstrap)
("libltdl" ,libltdl)
("pkg-config" ,pkg-config))))))
(define jamvm
(package (inherit jamvm-1-bootstrap)
(version "2.0.0")
(source (origin
(method url-fetch)
(uri (string-append "mirror://sourceforge/jamvm/jamvm/"
"JamVM%20" version "/jamvm-"
version ".tar.gz"))
(sha256
(base32
"1nl0zxz8y5x8gwsrm7n32bry4dx8x70p8z3s9jbdvs8avyb8whkn"))
(patches
(search-patches "jamvm-2.0.0-disable-branch-patching.patch"))
(snippet
'(begin
;; Remove precompiled software.
(delete-file "src/classlib/gnuclasspath/lib/classes.zip")
#t))))
(build-system gnu-build-system)
(arguments
`(#:configure-flags
(list (string-append "--with-classpath-install-dir="
(assoc-ref %build-inputs "classpath")))))
(inputs
`(("classpath" ,classpath-devel)
("ecj-javac-wrapper" ,ecj-javac-wrapper)
("zip" ,zip)
("zlib" ,zlib)))))
(define ecj-javac-wrapper-final
(package (inherit ecj-javac-wrapper)
(native-inputs
`(("guile" ,guile-2.2)
("ecj-bootstrap" ,ecj-bootstrap)
("jamvm" ,jamvm)
("classpath" ,classpath-devel)))))
;; The bootstrap JDK consisting of jamvm, classpath-devel,
;; ecj-javac-wrapper-final cannot build Icedtea 2.x directly, because it's
;; written in Java 7. It can, however, build the unmaintained Icedtea 1.x,
;; which uses Java 6 only.
(define-public icedtea-6
(package
(name "icedtea")
(version "1.13.13")
(source (origin
(method url-fetch)
(uri (string-append
"http://icedtea.wildebeest.org/download/source/icedtea6-"
version ".tar.xz"))
(sha256
(base32
"0bg9sb4f7qbq77c0zf9m17p47ga0kf0r9622g9p12ysg26jd1ksg"))
(modules '((guix build utils)))
(snippet
'(begin
(substitute* "Makefile.in"
;; do not leak information about the build host
(("DISTRIBUTION_ID=\"\\$\\(DIST_ID\\)\"")
"DISTRIBUTION_ID=\"\\\"guix\\\"\""))
#t))))
(build-system gnu-build-system)
(outputs '("out" ; Java Runtime Environment
"jdk" ; Java Development Kit
"doc")) ; all documentation
(arguments
`(;; There are many failing tests and many are known to fail upstream.
#:tests? #f
;; The DSOs use $ORIGIN to refer to each other, but (guix build
;; gremlin) doesn't support it yet, so skip this phase.
#:validate-runpath? #f
#:modules ((guix build utils)
(guix build gnu-build-system)
(srfi srfi-19))
#:configure-flags
`("--enable-bootstrap"
"--enable-nss"
"--without-rhino"
"--with-parallel-jobs"
"--disable-downloading"
"--disable-tests"
,(string-append "--with-ecj="
(assoc-ref %build-inputs "ecj")
"/share/java/ecj-bootstrap.jar")
,(string-append "--with-jar="
(assoc-ref %build-inputs "fastjar")
"/bin/fastjar")
,(string-append "--with-jdk-home="
(assoc-ref %build-inputs "classpath"))
,(string-append "--with-java="
(assoc-ref %build-inputs "jamvm")
"/bin/jamvm"))
#:phases
(modify-phases %standard-phases
(replace 'unpack
(lambda* (#:key source inputs #:allow-other-keys)
(invoke "tar" "xvf" source)
(chdir (string-append "icedtea6-" ,version))
(mkdir "openjdk")
(copy-recursively (assoc-ref inputs "openjdk-src") "openjdk")
;; The convenient OpenJDK source bundle is no longer
;; available for download, so we have to take the sources
;; from the Mercurial repositories and change the Makefile
;; to avoid tests for the OpenJDK zip archive.
(with-directory-excursion "openjdk"
(for-each (lambda (part)
(mkdir part)
(copy-recursively
(assoc-ref inputs
(string-append part "-src"))
part))
'("jdk" "corba"
"langtools" "jaxp" "jaxws")))
(with-directory-excursion "openjdk"
(invoke "tar" "xvf" (assoc-ref inputs "hotspot-src"))
(rename-file "hg-checkout" "hotspot"))
(substitute* "patches/freetypeversion.patch"
(("REQUIRED_FREETYPE_VERSION = 2.2.1")
"REQUIRED_FREETYPE_VERSION = 2.10.1"))
(substitute* "Makefile.in"
(("echo \"ERROR: No up-to-date OpenJDK zip available\"; exit -1;")
"echo \"trust me\";")
;; The contents of the bootstrap directory must be
;; writeable but when copying from the store they are
;; not.
(("mkdir -p lib/rt" line)
(string-append line "; chmod -R u+w $(BOOT_DIR)")))
(invoke "chmod" "-R" "u+w" "openjdk")))
(add-after 'unpack 'use-classpath
(lambda* (#:key inputs #:allow-other-keys)
(let ((jvmlib (assoc-ref inputs "classpath"))
(jamvm (assoc-ref inputs "jamvm")))
;; Classpath does not provide rt.jar.
(substitute* "Makefile.in"
(("\\$\\(SYSTEM_JDK_DIR\\)/jre/lib/rt.jar")
(string-append jvmlib "/share/classpath/glibj.zip")))
;; Make sure we can find all classes.
(setenv "CLASSPATH"
(string-append jvmlib "/share/classpath/glibj.zip:"
jvmlib "/share/classpath/tools.zip:"
jamvm "/lib/rt.jar"))
(setenv "JAVACFLAGS"
(string-append "-cp "
jvmlib "/share/classpath/glibj.zip:"
jvmlib "/share/classpath/tools.zip")))
#t))
(add-after 'unpack 'patch-patches
(lambda _
;; 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"))))
#t))
(add-after 'unpack 'patch-paths
(lambda* (#:key inputs #:allow-other-keys)
;; 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 inputs "coreutils") "/bin/"))
(binbin (string-append
(assoc-ref inputs "binutils") "/bin/"))
(grepbin (string-append
(assoc-ref 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 inputs "gcc") "/bin/"))
(("DEF_OBJCOPY *=.*objcopy")
(string-append "DEF_OBJCOPY = " (which "objcopy"))))
;; fix path to alsa header
(substitute* "openjdk/jdk/make/common/shared/Sanity.gmk"
(("ALSA_INCLUDE=/usr/include/alsa/version.h")
(string-append "ALSA_INCLUDE="
(assoc-ref inputs "alsa-lib")
"/include/alsa/version.h")))
;; 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 *=.*(n|g)awk")
(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"))
#t)))
(add-before 'configure 'set-additional-paths
(lambda* (#:key inputs #:allow-other-keys)
(setenv "CPATH"
(string-append (assoc-ref inputs "libxrender")
"/include/X11/extensions" ":"
(assoc-ref inputs "libxtst")
"/include/X11/extensions" ":"
(assoc-ref inputs "libxinerama")
"/include/X11/extensions" ":"
(or (getenv "CPATH") "")))
(setenv "ALT_CUPS_HEADERS_PATH"
(string-append (assoc-ref inputs "cups")
"/include"))
(setenv "ALT_FREETYPE_HEADERS_PATH"
(string-append (assoc-ref inputs "freetype")
"/include"))
(setenv "ALT_FREETYPE_LIB_PATH"
(string-append (assoc-ref inputs "freetype")
"/lib"))
#t))
(add-before 'build 'disable-os-version-check
;; allow build on linux major version change
(lambda _
(setenv "DISABLE_HOTSPOT_OS_VERSION_CHECK" "ok")
#t))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((doc (string-append (assoc-ref outputs "doc")
"/share/doc/icedtea"))
(jre (assoc-ref outputs "out"))
(jdk (assoc-ref outputs "jdk")))
(copy-recursively "openjdk.build/docs" doc)
(copy-recursively "openjdk.build/j2re-image" jre)
(copy-recursively "openjdk.build/j2sdk-image" jdk))
#t)))))
(native-inputs
`(("ant" ,ant-bootstrap)
("alsa-lib" ,alsa-lib)
("attr" ,attr)
("classpath" ,classpath-devel)
("coreutils" ,coreutils)
("cpio" ,cpio)
("cups" ,cups)
("ecj" ,ecj-bootstrap)
("ecj-javac" ,ecj-javac-wrapper-final)
("fastjar" ,fastjar)
("fontconfig" ,fontconfig)
("freetype" ,freetype)
("gtk" ,gtk+-2)
("gawk" ,gawk)
("giflib" ,giflib)
("grep" ,grep)
("jamvm" ,jamvm)
("lcms" ,lcms)
("libjpeg" ,libjpeg-turbo)
("libnsl" ,libnsl)
("libpng" ,libpng)
("libtool" ,libtool)
("libx11" ,libx11)
("libxcomposite" ,libxcomposite)
("libxi" ,libxi)
("libxinerama" ,libxinerama)
("libxrender" ,libxrender)
("libxslt" ,libxslt) ;for xsltproc
("libxt" ,libxt)
("libxtst" ,libxtst)
("mit-krb5" ,mit-krb5)
("nss" ,nss)
("nss-certs" ,nss-certs)
("perl" ,perl)
("pkg-config" ,pkg-config)
("procps" ,procps) ;for "free", even though I'm not sure we should use it
("unzip" ,unzip)
("wget" ,wget)
("which" ,which)
("zip" ,zip)
("zlib" ,zlib)
("openjdk-src"
,(origin
(method hg-fetch)
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/")
(changeset "jdk6-b41")))
(sha256
(base32
"14q47yfg586fs64w30g8mk92m5dkxsvr36zzh0ra99xk5x0x96mv"))))
("jdk-src"
,(origin
(method hg-fetch)
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/jdk/")
(changeset "jdk6-b41")))
(sha256
(base32
"165824nhg1k1dx6zs9dny0j49rmk35jw5b13dmz8c77jfajml4v9"))))
("hotspot-src"
,(origin
(method hg-fetch)
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/hotspot/")
(changeset "jdk6-b41")))
(sha256
(base32
"07lc1z4k5dj9nrc1wvwmpvxr3xgxrdkdh53xb95skk5ij49yagfd"))
(patches
(search-patches "icedtea-6-hotspot-gcc-segfault-workaround.patch"))))
("corba-src"
,(origin
(method hg-fetch)
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/corba/")
(changeset "jdk6-b41")))
(sha256
(base32
"1p9g1r9dnax2iwp7yb59qx7m4nmshqhwmrb2b8jj8zgbd9dl2i3q"))))
("langtools-src"
,(origin
(method hg-fetch)
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/langtools/")
(changeset "jdk6-b41")))
(sha256
(base32
"1x52wd67fynbbd9ild6fb4wvba3f5hhwk03qdjfazd0a1qr37z3d"))))
("jaxp-src"
,(origin
(method hg-fetch)
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/jaxp/")
(changeset "jdk6-b41")))
(sha256
(base32
"0shlqrvzpr4nrkmv215lbxnby63s3yvbdh1yxcayznsyqwa4nlxm"))))
("jaxws-src"
,(origin
(method hg-fetch)
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/jaxws/")
(changeset "jdk6-b41")))
(sha256
(base32
"0835lkw8vib1xhp8lxnybhlvzdh699hbi4mclxanydjk63zbpxk0"))))))
(home-page "http://icedtea.classpath.org")
(synopsis "Java development kit")
(description
"This package provides the OpenJDK built with the IcedTea build harness.
This version of the OpenJDK is no longer maintained and is only used for
bootstrapping purposes.")
;; IcedTea is released under the GPL2 + Classpath exception, which is the
;; same license as both GNU Classpath and OpenJDK.
(license license:gpl2+)))
(define-public icedtea-7
(let* ((version "2.6.13")
(drop (lambda (name hash)
(origin
(method url-fetch)
(uri (string-append
"http://icedtea.classpath.org/download/drops"
"/icedtea7/" version "/" name ".tar.bz2"))
(sha256 (base32 hash))))))
(package
(name "icedtea")
(version version)
(source (origin
(method url-fetch)
(uri (string-append
"http://icedtea.wildebeest.org/download/source/icedtea-"
version ".tar.xz"))
(sha256
(base32
"1w331rdqx1dcx2xb0fmjmrkdc71xqn20fxsgw8by4xhiblh88khh"))
(modules '((guix build utils)))
(snippet
'(begin
(substitute* "Makefile.in"
;; do not leak information about the build host
(("DISTRIBUTION_ID=\"\\$\\(DIST_ID\\)\"")
"DISTRIBUTION_ID=\"\\\"guix\\\"\""))
#t))))
(build-system gnu-build-system)
(outputs '("out" ; Java Runtime Environment
"jdk" ; Java Development Kit
"doc")) ; all documentation
(arguments
`(;; There are many test failures. Some are known to
;; fail upstream, others relate to not having an X
;; server running at test time, yet others are a
;; complete mystery to me.
;; hotspot: passed: 241; failed: 45; error: 2
;; langtools: passed: 1,934; failed: 26
;; jdk: unknown
#:tests? #f
;; The DSOs use $ORIGIN to refer to each other, but (guix build
;; gremlin) doesn't support it yet, so skip this phase.
#:validate-runpath? #f
;; Apparently, the C locale is needed for some of the tests.
#:locale "C"
#:modules ((guix build utils)
(guix build gnu-build-system)
(ice-9 match)
(ice-9 popen)
(srfi srfi-19)
(srfi srfi-26))
#:configure-flags
;; TODO: package pcsc and sctp, and add to inputs
`("--disable-system-pcsc"
"--disable-system-sctp"
"--enable-bootstrap"
"--enable-nss"
"--without-rhino"
"--disable-downloading"
"--disable-tests" ;they are run in the check phase instead
"--with-openjdk-src-dir=./openjdk.src"
,(string-append "--with-jdk-home="
(assoc-ref %build-inputs "jdk")))
#:phases
(modify-phases %standard-phases
(replace 'unpack
(lambda* (#:key source inputs #:allow-other-keys)
(let ((target (string-append "icedtea-" ,version))
(unpack (lambda* (name #:optional dir)
(let ((dir (or dir
(string-drop-right name 5))))
(mkdir dir)
(invoke "tar" "xvf"
(assoc-ref inputs name)
"-C" dir
"--strip-components=1")))))
(mkdir target)
(invoke "tar" "xvf" source
"-C" target "--strip-components=1")
(chdir target)
(unpack "openjdk-src" "openjdk.src")
(with-directory-excursion "openjdk.src"
(for-each unpack
(filter (cut string-suffix? "-drop" <>)
(map (match-lambda
((name . _) name))
inputs))))
#t)))
(add-after 'unpack 'patch-bitrot
(lambda _
(substitute* '("patches/boot/revert-6973616.patch"
"openjdk.src/jdk/make/common/shared/Defs-versions.gmk")
(("REQUIRED_FREETYPE_VERSION = 2.2.1")
"REQUIRED_FREETYPE_VERSION = 2.10.1"))
;; As of attr 2.4.48 this header is no longer
;; included. It is provided by the libc instead.
(substitute* '("configure"
"openjdk.src/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c")
(("attr/xattr.h") "sys/xattr.h"))
#t))
(add-after 'unpack 'fix-x11-extension-include-path
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "openjdk.src/jdk/make/sun/awt/mawt.gmk"
(((string-append "\\$\\(firstword \\$\\(wildcard "
"\\$\\(OPENWIN_HOME\\)"
"/include/X11/extensions\\).*$"))
(string-append (assoc-ref inputs "libxrender")
"/include/X11/extensions"
" -I" (assoc-ref inputs "libxtst")
"/include/X11/extensions"
" -I" (assoc-ref inputs "libxinerama")
"/include/X11/extensions"))
(("\\$\\(wildcard /usr/include/X11/extensions\\)\\)") ""))
#t))
(add-after 'unpack 'patch-paths
(lambda _
;; buildtree.make generates shell scripts, so we need to replace
;; the generated shebang
(substitute* '("openjdk.src/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.src/jdk/make/common/shared/Defs-linux.gmk"
"openjdk.src/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/"))
(("DEF_OBJCOPY *=.*objcopy")
(string-append "DEF_OBJCOPY = " (which "objcopy"))))
;; fix path to alsa header
(substitute* "openjdk.src/jdk/make/common/shared/Sanity.gmk"
(("ALSA_INCLUDE=/usr/include/alsa/version.h")
(string-append "ALSA_INCLUDE="
(assoc-ref %build-inputs "alsa-lib")
"/include/alsa/version.h")))
;; fix hard-coded utility paths
(substitute* '("openjdk.src/jdk/make/common/shared/Defs-utils.gmk"
"openjdk.src/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 *=.*(n|g)awk")
(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.src/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")))
#t))
(add-before 'configure 'set-additional-paths
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "openjdk.src/jdk/make/common/shared/Sanity.gmk"
(("ALSA_INCLUDE=/usr/include/alsa/version.h")
(string-append "ALSA_INCLUDE="
(assoc-ref inputs "alsa-lib")
"/include/alsa/version.h")))
(setenv "CC" "gcc")
(setenv "CPATH"
(string-append (assoc-ref inputs "libxcomposite")
"/include/X11/extensions" ":"
(assoc-ref inputs "libxrender")
"/include/X11/extensions" ":"
(assoc-ref inputs "libxtst")
"/include/X11/extensions" ":"
(assoc-ref inputs "libxinerama")
"/include/X11/extensions" ":"
(or (getenv "CPATH") "")))
(setenv "ALT_OBJCOPY" (which "objcopy"))
(setenv "ALT_CUPS_HEADERS_PATH"
(string-append (assoc-ref inputs "cups")
"/include"))
(setenv "ALT_FREETYPE_HEADERS_PATH"
(string-append (assoc-ref inputs "freetype")
"/include"))
(setenv "ALT_FREETYPE_LIB_PATH"
(string-append (assoc-ref inputs "freetype")
"/lib"))
#t))
(add-before 'build 'disable-os-version-check
;; allow build on linux major version change
(lambda _
(setenv "DISABLE_HOTSPOT_OS_VERSION_CHECK" "ok")
#t))
(add-before 'check 'fix-test-framework
(lambda _
;; Fix PATH in test environment
(substitute* "test/jtreg/com/sun/javatest/regtest/Main.java"
(("PATH=/bin:/usr/bin")
(string-append "PATH=" (getenv "PATH"))))
(substitute* "test/jtreg/com/sun/javatest/util/SysEnv.java"
(("/usr/bin/env") (which "env")))
(substitute* "openjdk.src/hotspot/test/test_env.sh"
(("/bin/rm") (which "rm"))
(("/bin/cp") (which "cp"))
(("/bin/mv") (which "mv")))
#t))
(add-before 'check 'fix-hotspot-tests
(lambda _
(with-directory-excursion "openjdk.src/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"))))
#t))
(add-before 'check 'fix-jdk-tests
(lambda _
(with-directory-excursion "openjdk.src/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"))))
#t))
(replace '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 ()
(let ((line (read-line port)))
(cond
((eof-object? line) #t)
((regexp-exec error-pattern line)
(error "test failed"))
(else (loop)))))))
(run-test (lambda (test)
(invoke "make" test)
(call-with-input-file
(string-append "test/" test ".log")
checker))))
(when #f ; skip tests
(run-test "check-hotspot")
(run-test "check-langtools")
(run-test "check-jdk"))
#t)))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((doc (string-append (assoc-ref outputs "doc")
"/share/doc/icedtea"))
(jre (assoc-ref outputs "out"))
(jdk (assoc-ref outputs "jdk")))
(copy-recursively "openjdk.build/docs" doc)
(copy-recursively "openjdk.build/j2re-image" jre)
(copy-recursively "openjdk.build/j2sdk-image" jdk))
#t))
;; Some of the libraries in the lib/amd64 folder link to libjvm.so.
;; But that shared object is located in the server/ folder, so it
;; cannot be found. This phase creates a symbolic link in the
;; lib/amd64 folder so that the other libraries can find it.
;;
;; See:
;; https://lists.gnu.org/archive/html/guix-devel/2017-10/msg00169.html
;;
;; FIXME: Find the bug in the build system, so that this symlink is
;; not needed.
(add-after 'install 'install-libjvm
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((lib-path (string-append (assoc-ref outputs "out")
;; See 'INSTALL_ARCH_DIR' in
;; 'configure'.
,(match (%current-system)
("i686-linux"
"/lib/i386")
("x86_64-linux"
"/lib/amd64")
("armhf-linux"
"/lib/arm")
("aarch64-linux"
"/lib/aarch64")
;; We need a catch-all, dropping
;; '-linux' works in most cases.
(_
(string-append
"/lib/"
(string-drop-right
(%current-system) 6)))))))
(symlink (string-append lib-path "/server/libjvm.so")
(string-append lib-path "/libjvm.so")))
#t))
;; By default IcedTea only generates an empty keystore. In order to
;; be able to use certificates in Java programs we need to generate a
;; keystore from a set of certificates. For convenience we use the
;; certificates from the nss-certs package.
(add-after 'install 'install-keystore
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((keystore "cacerts")
(certs-dir (string-append (assoc-ref inputs "nss-certs")
"/etc/ssl/certs"))
(keytool (string-append (assoc-ref outputs "jdk")
"/bin/keytool")))
(define (extract-cert file target)
(call-with-input-file file
(lambda (in)
(call-with-output-file target
(lambda (out)
(let loop ((line (read-line in 'concat))
(copying? #f))
(cond
((eof-object? line) #t)
((string-prefix? "-----BEGIN" line)
(display line out)
(loop (read-line in 'concat) #t))
((string-prefix? "-----END" line)
(display line out)
#t)
(else
(when copying? (display line out))
(loop (read-line in 'concat) copying?)))))))))
(define (import-cert cert)
(format #t "Importing certificate ~a\n" (basename cert))
(let ((temp "tmpcert"))
(extract-cert cert temp)
(let ((port (open-pipe* OPEN_WRITE keytool
"-import"
"-alias" (basename cert)
"-keystore" keystore
"-storepass" "changeit"
"-file" temp)))
(display "yes\n" port)
(when (not (zero? (status:exit-val (close-pipe port))))
(format #t "failed to import ~a\n" cert)))
(delete-file temp)))
;; This is necessary because the certificate directory contains
;; files with non-ASCII characters in their names.
(setlocale LC_ALL "en_US.utf8")
(setenv "LC_ALL" "en_US.utf8")
(for-each import-cert (find-files certs-dir "\\.pem$"))
(mkdir-p (string-append (assoc-ref outputs "out")
"/lib/security"))
(mkdir-p (string-append (assoc-ref outputs "jdk")
"/jre/lib/security"))
;; The cacerts files we are going to overwrite are chmod'ed as
;; read-only (444) in icedtea-8 (which derives from this
;; package). We have to change this so we can overwrite them.
(chmod (string-append (assoc-ref outputs "out")
"/lib/security/" keystore) #o644)
(chmod (string-append (assoc-ref outputs "jdk")
"/jre/lib/security/" keystore) #o644)
(install-file keystore
(string-append (assoc-ref outputs "out")
"/lib/security"))
(install-file keystore
(string-append (assoc-ref outputs "jdk")
"/jre/lib/security"))
#t))))))
(native-inputs
`(("openjdk-src"
,(drop "openjdk"
"0l34ikyf62hbzlf9032alzkkqvf7bpmckz4gvirvph755w7gka8l"))
("corba-drop"
,(drop "corba"
"050gv2jbg1pi6qkn8w18bwpbklfa5b0kymjvan9pncddbj8m84fz"))
("jaxp-drop"
,(drop "jaxp"
"1k6yldwnxfzdg5926r1nlfv8d1r1j7rlp2nkz6gqh05vgyamnfhl"))
("jaxws-drop"
,(drop "jaxws"
"110j7jlz47x2gg6f7653x12mssan5kvj9l9h1m1c8c92drfxbqyk"))
("jdk-drop"
,(drop "jdk"
"0d1mca38ksxvdskp9im3pp7fdijhj1n3lwq9w13r9s4v3qyskgdd"))
("langtools-drop"
,(drop "langtools"
"0nq5236fzxn3p6x8cgncl56mzcmsj07q9gymysnws4c8byc6n0qj"))
("hotspot-drop"
,(origin
(method url-fetch)
(uri (string-append
"http://icedtea.classpath.org/downloads/drops"
"/icedtea7/" version "/hotspot.tar.bz2"))
(sha256
(base32
"17bdv39n4lh8l5737c96f3xgamx4y305m067p01cywgp7zaddqws"))
(patches (search-patches
"icedtea-7-hotspot-gcc-segfault-workaround.patch"))))
("ant" ,ant-bootstrap)
("attr" ,attr)
("coreutils" ,coreutils)
("diffutils" ,diffutils) ;for tests
("gawk" ,gawk)
("grep" ,grep)
("libtool" ,libtool)
("pkg-config" ,pkg-config)
("wget" ,wget)
("which" ,which)
("cpio" ,cpio)
("zip" ,zip)
("unzip" ,unzip)
("fastjar" ,fastjar)
("libxslt" ,libxslt) ;for xsltproc
("nss-certs" ,nss-certs)
("perl" ,perl)
("procps" ,procps) ;for "free", even though I'm not sure we should use it
("jdk" ,icedtea-6 "jdk")))
(inputs
`(("alsa-lib" ,alsa-lib)
("cups" ,cups)
("libx11" ,libx11)
("libxcomposite" ,libxcomposite)
("libxt" ,libxt)
("libxtst" ,libxtst)
("libxi" ,libxi)
("libxinerama" ,libxinerama)
("libxrender" ,libxrender)
("libjpeg" ,libjpeg-turbo)
("libpng" ,libpng)
("mit-krb5" ,mit-krb5)
("nss" ,nss)
("giflib" ,giflib)
("fontconfig" ,fontconfig)
("freetype" ,freetype)
("lcms" ,lcms)
("zlib" ,zlib)
("gtk" ,gtk+-2)))
(home-page "http://icedtea.classpath.org")
(synopsis "Java development kit")
(description
"This package provides the Java development kit OpenJDK built with the
IcedTea build harness.")
;; 'configure' lists "mips" and "mipsel", but not "mips64el'.
(supported-systems (delete "mips64el-linux" %supported-systems))
;; IcedTea is released under the GPL2 + Classpath exception, which is the
;; same license as both GNU Classpath and OpenJDK.
(license license:gpl2+))))
(define-public icedtea-8
(let* ((version "3.7.0")
(drop (lambda (name hash)
(origin
(method url-fetch)
(uri (string-append
"http://icedtea.classpath.org/download/drops"
"/icedtea8/" version "/" name ".tar.xz"))
(sha256 (base32 hash))))))
(package (inherit icedtea-7)
(version "3.7.0")
(source (origin
(method url-fetch)
(uri (string-append
"http://icedtea.wildebeest.org/download/source/icedtea-"
version ".tar.xz"))
(sha256
(base32
"09yqzn8rpccs7cyv89hhy5zlznpgqw5x3jz0w1ccp0cz1vgs8l5w"))
(modules '((guix build utils)))
(snippet
'(begin
(substitute* '("configure"
"acinclude.m4")
;; Do not embed build time
(("(DIST_ID=\"Custom build).*$" _ prefix)
(string-append prefix "\"\n"))
;; Do not leak information about the build host
(("DIST_NAME=\"\\$build_os\"")
"DIST_NAME=\"guix\""))
#t))))
(arguments
`(#:imported-modules
((guix build ant-build-system)
(guix build syscalls)
,@%gnu-build-system-modules)
,@(substitute-keyword-arguments (package-arguments icedtea-7)
((#:modules modules)
`((guix build utils)
(guix build gnu-build-system)
((guix build ant-build-system) #:prefix ant:)
(ice-9 match)
(ice-9 popen)
(srfi srfi-19)
(srfi srfi-26)))
((#:configure-flags flags)
`(let ((jdk (assoc-ref %build-inputs "jdk")))
`( ;;"--disable-bootstrap"
"--enable-bootstrap"
"--enable-nss"
"--disable-downloading"
"--disable-system-pcsc"
"--disable-system-sctp"
"--disable-tests" ;they are run in the check phase instead
"--with-openjdk-src-dir=./openjdk.src"
,(string-append "--with-jdk-home=" jdk))))
((#:phases phases)
`(modify-phases ,phases
(delete 'fix-x11-extension-include-path)
(delete 'patch-paths)
(delete 'set-additional-paths)
(delete 'patch-patches)
(delete 'patch-bitrot)
;; Prevent the keytool from recording the current time when
;; adding certificates at build time.
(add-after 'unpack 'patch-keystore
(lambda _
(substitute* "openjdk.src/jdk/src/share/classes/sun/security/provider/JavaKeyStore.java"
(("date = new Date\\(\\);")
"\
date = (System.getenv(\"SOURCE_DATE_EPOCH\") != null) ?\
new Date(Long.parseLong(System.getenv(\"SOURCE_DATE_EPOCH\"))) :\
new Date();"))
#t))
(add-after 'unpack 'patch-jni-libs
;; Hardcode dynamically loaded libraries.
(lambda _
(let* ((library-path (search-path-as-string->list
(getenv "LIBRARY_PATH")))
(find-library (lambda (name)
(search-path
library-path
(string-append "lib" name ".so")))))
(for-each
(lambda (file)
(catch 'decoding-error
(lambda ()
(substitute* file
(("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)"
_ name version)
(format #f "\"~a\"" (find-library name)))
(("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name)
(format #f "\"~a\"" (find-library name)))))
(lambda _
;; Those are safe to skip.
(format (current-error-port)
"warning: failed to substitute: ~a~%"
file))))
(find-files "openjdk.src/jdk/src/solaris/native"
"\\.c|\\.h"))
#t)))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((doc (string-append (assoc-ref outputs "doc")
"/share/doc/icedtea"))
(jre (assoc-ref outputs "out"))
(jdk (assoc-ref outputs "jdk")))
(copy-recursively "openjdk.build/docs" doc)
(copy-recursively "openjdk.build/images/j2re-image" jre)
(copy-recursively "openjdk.build/images/j2sdk-image" jdk)
;; Install the nss.cfg file to JRE to enable SSL/TLS
;; support via NSS.
(copy-file (string-append jdk "/jre/lib/security/nss.cfg")
(string-append jre "/lib/security/nss.cfg"))
#t)))
(add-after 'install 'strip-jar-timestamps
(assoc-ref ant:%standard-phases 'strip-jar-timestamps)))))))
(native-inputs
`(("jdk" ,icedtea-7 "jdk")
("openjdk-src"
,(drop "openjdk"
"1mj6xgmw31i6qd30qi9dmv7160fbcfq5ikz1jwjihdg2793il19p"))
("aarch32-drop"
,(drop "aarch32"
"1wb8k5zm40zld0986dvmlh5xh3gyixbg9h26sl662zy92amhmyyg"))
("corba-drop"
,(drop "corba"
"11ma4zz0599cy70xd219v7a8vin7p96xrhhz3wsaw6cjhkzpagah"))
("jaxp-drop"
,(drop "jaxp"
"14m1y0z0fbm5z5zjw3vnq85py8dma84bi3f9cw8rhdyc6skk8q4i"))
("jaxws-drop"
,(drop "jaxws"
"09andnm6xaasnp963hgx42yiflifiljp9z7z85jrfyc5z8a5whmf"))
("jdk-drop"
,(drop "jdk"
"0s6lcpc0zckz2fnq98aqf28nz9y3wbi41a3kyaqqa2abwbkm1zwl"))
("langtools-drop"
,(drop "langtools"
"15wizy123vhk40chl1b4p552jf2pw2hdww0myf11qab425axz4nw"))
("hotspot-drop"
,(origin
(method url-fetch)
(uri (string-append
"http://icedtea.classpath.org/download/drops"
"/icedtea8/" version "/hotspot.tar.xz"))
(sha256
(base32
"1ciz1w9j0kz7s1dxdhyqq71nla9icyz6qvn0b9z2zgkklqa98qmm"))
(patches (search-patches
"icedtea-7-hotspot-gcc-segfault-workaround.patch"))))
("nashorn-drop"
,(drop "nashorn"
"19pzl3ppaw8j6r5cnyp8qiw3hxijh3hdc46l39g5yfhdl4pr4hpa"))
("shenandoah-drop"
,(drop "shenandoah"
"0k33anxdzw1icn072wynfmmdjhsv50hay0j1sfkfxny12rb3vgdy"))
,@(fold alist-delete (package-native-inputs icedtea-7)
'("jdk" "openjdk-src" "corba-drop" "jaxp-drop" "jaxws-drop"
"jdk-drop" "langtools-drop" "hotspot-drop")))))))
(define-public openjdk9
(package
(name "openjdk")
(version "9.181")
(source (origin
(method url-fetch)
(uri "https://hg.openjdk.java.net/jdk/jdk/archive/3cc80be736f2.tar.bz2")
(file-name (string-append name "-" version ".tar.bz2"))
(sha256
(base32
"01ihmyf7k5z17wbr7xig7y40l9f01d5zjgkcmawn1102hw5kchpq"))
(modules '((guix build utils)))
(snippet
`(begin
(for-each delete-file
(find-files "." ".*.(bin|exe|jar)$"))
#t))))
(build-system gnu-build-system)
(outputs '("out" "jdk" "doc"))
(arguments
`(#:tests? #f; require jtreg
#:make-flags '("all")
#:imported-modules
((guix build syscalls)
,@%gnu-build-system-modules)
#:phases
(modify-phases %standard-phases
(add-after 'patch-source-shebangs 'fix-java-shebangs
(lambda _
;; This file was "fixed" by patch-source-shebangs, but it requires
;; this exact first line.
(substitute* "jdk/make/data/blacklistedcertsconverter/blacklisted.certs.pem"
(("^#!.*") "#! java BlacklistedCertsConverter SHA-256\n"))
#t))
(replace 'configure
(lambda* (#:key inputs outputs #:allow-other-keys)
;; TODO: unbundle libpng and lcms
(invoke "bash" "./configure"
(string-append "--with-freetype=" (assoc-ref inputs "freetype"))
"--disable-freetype-bundling"
"--disable-warnings-as-errors"
"--disable-hotspot-gtest"
"--with-giflib=system"
"--with-libjpeg=system"
(string-append "--prefix=" (assoc-ref outputs "out")))
#t))
(add-before 'build 'write-source-revision-file
(lambda _
(with-output-to-file ".src-rev"
(lambda _
(display ,version)))
#t))
(replace 'build
(lambda* (#:key make-flags parallel-build? #:allow-other-keys)
(apply invoke "make"
`(,@(if parallel-build?
(list (string-append "JOBS="
(number->string (parallel-job-count))))
'())
,@make-flags))))
;; Some of the libraries in the lib/ folder link to libjvm.so.
;; But that shared object is located in the server/ folder, so it
;; cannot be found. This phase creates a symbolic link in the
;; lib/ folder so that the other libraries can find it.
;;
;; See:
;; https://lists.gnu.org/archive/html/guix-devel/2017-10/msg00169.html
;;
;; FIXME: Find the bug in the build system, so that this symlink is
;; not needed.
(add-after 'install 'install-libjvm
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((lib-out (string-append (assoc-ref outputs "out")
"/lib"))
(lib-jdk (string-append (assoc-ref outputs "jdk")
"/lib")))
(symlink (string-append lib-jdk "/server/libjvm.so")
(string-append lib-jdk "/libjvm.so"))
(symlink (string-append lib-out "/server/libjvm.so")
(string-append lib-out "/libjvm.so")))
#t))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(jdk (assoc-ref outputs "jdk"))
(doc (assoc-ref outputs "doc"))
(images (car (find-files "build" ".*-server-release"
#:directories? #t))))
(copy-recursively (string-append images "/images/jdk") jdk)
(copy-recursively (string-append images "/images/jre") out)
(copy-recursively (string-append images "/images/docs") doc))
#t))
(add-after 'install 'strip-zip-timestamps
(lambda* (#:key outputs #:allow-other-keys)
(use-modules (guix build syscalls))
(for-each (lambda (zip)
(let ((dir (mkdtemp! "zip-contents.XXXXXX")))
(with-directory-excursion dir
(invoke "unzip" zip))
(delete-file zip)
(for-each (lambda (file)
(let ((s (lstat file)))
(unless (eq? (stat:type s) 'symlink)
(format #t "reset ~a~%" file)
(utime file 0 0 0 0))))
(find-files dir #:directories? #t))
(with-directory-excursion dir
(let ((files (find-files "." ".*" #:directories? #t)))
(apply invoke "zip" "-0" "-X" zip files)))))
(find-files (assoc-ref outputs "doc") ".*.zip$"))
#t)))))
(inputs
`(("alsa-lib" ,alsa-lib)
("cups" ,cups)
("fontconfig" ,fontconfig)
("freetype" ,freetype)
("giflib" ,giflib)
("lcms" ,lcms)
("libelf" ,libelf)
("libjpeg" ,libjpeg-turbo)
("libice" ,libice)
("libpng" ,libpng)
("libx11" ,libx11)
("libxcomposite" ,libxcomposite)
("libxi" ,libxi)
("libxinerama" ,libxinerama)
("libxrender" ,libxrender)
("libxt" ,libxt)
("libxtst" ,libxtst)))
(native-inputs
`(("icedtea-8" ,icedtea-8)
("icedtea-8:jdk" ,icedtea-8 "jdk")
;; XXX: The build system fails with newer versions of GNU Make.
("make@4.2" ,gnu-make-4.2)
("unzip" ,unzip)
("which" ,which)
("zip" ,zip)))
(home-page "https://openjdk.java.net/projects/jdk9/")
(synopsis "Java development kit")
(description
"This package provides the Java development kit OpenJDK.")
(license license:gpl2+)))
(define-public openjdk10
(package
(inherit openjdk9)
(name "openjdk")
(version "10.46")
(source (origin
(method url-fetch)
(uri "http://hg.openjdk.java.net/jdk/jdk/archive/6fa770f9f8ab.tar.bz2")
(file-name (string-append name "-" version ".tar.bz2"))
(sha256
(base32
"0zywq2203b4hx4jms9vbwvjcj1d3k2v3qpx4s33729fkpmid97r4"))
(patches (search-patches
"openjdk-10-idlj-reproducibility.patch"))
(modules '((guix build utils)))
(snippet
`(begin
(for-each delete-file (find-files "." ".*.(bin|exe|jar)$"))
#t))))
(arguments
(substitute-keyword-arguments (package-arguments openjdk9)
((#:phases phases)
`(modify-phases ,phases
(replace 'fix-java-shebangs
(lambda _
;; This file was "fixed" by patch-source-shebangs, but it requires
;; this exact first line.
(substitute* "make/data/blacklistedcertsconverter/blacklisted.certs.pem"
(("^#!.*") "#! java BlacklistedCertsConverter SHA-256\n"))
#t))
(replace 'configure
(lambda* (#:key inputs outputs #:allow-other-keys)
(invoke "bash" "./configure"
(string-append "--with-freetype=" (assoc-ref inputs "freetype"))
"--disable-freetype-bundling"
"--disable-warnings-as-errors"
"--disable-hotspot-gtest"
"--with-giflib=system"
"--with-libjpeg=system"
"--with-native-debug-symbols=zipped"
(string-append "--prefix=" (assoc-ref outputs "out")))
#t))))))
(native-inputs
`(("openjdk9" ,openjdk9)
("openjdk9:jdk" ,openjdk9 "jdk")
("make@4.2" ,gnu-make-4.2)
("unzip" ,unzip)
("which" ,which)
("zip" ,zip)))))
(define-public openjdk11
(package
(name "openjdk")
(version "11.28")
(source (origin
(method url-fetch)
(uri "http://hg.openjdk.java.net/jdk/jdk/archive/76072a077ee1.tar.bz2")
(file-name (string-append name "-" version ".tar.bz2"))
(sha256
(base32
"0v705w1s9lrqalzahir78pk397rkk9gfvzq821yv8h3xha0bqi6w"))
(modules '((guix build utils)))
(snippet
`(begin
(for-each delete-file (find-files "." ".*.(bin|exe|jar)$"))
#t))))
(build-system gnu-build-system)
(outputs '("out" "jdk" "doc"))
(arguments
`(#:imported-modules
((guix build syscalls)
(ice-9 binary-ports)
(rnrs bytevectors)
,@%gnu-build-system-modules)
#:tests? #f; requires jtreg
;; TODO package jtreg
#:configure-flags
`("--disable-option-checking" ; --enable-fast-install default flag errors otherwise
"--disable-warnings-as-errors"
;; make validate-runpath pass, see: http://issues.guix.info/issue/32894
"--with-native-debug-symbols=zipped"
;; do not use the bundled libraries
"--with-giflib=system"
"--with-lcms=system"
"--with-libjpeg=system"
"--with-libpng=system"
"--with-version-pre="
;; allow the build system to locate the system freetype
,(string-append "--with-freetype-include="
(assoc-ref %build-inputs "freetype") "/include")
,(string-append "--with-freetype-lib="
(assoc-ref %build-inputs "freetype") "/lib"))
#:phases
(modify-phases %standard-phases
(add-after 'patch-source-shebangs 'fix-java-shebangs
(lambda _
;; This file was "fixed" by patch-source-shebangs, but it requires
;; this exact first line.
(substitute* "make/data/blacklistedcertsconverter/blacklisted.certs.pem"
(("^#!.*") "#! java BlacklistedCertsConverter SHA-256\n"))
#t))
(add-before 'build 'write-source-revision-file
(lambda _
(with-output-to-file ".src-rev"
(lambda _
(display ,version)))
#t))
(replace 'build
(lambda* (#:key parallel-build? make-flags #:allow-other-keys)
(apply invoke "make" "all"
`(,@(if parallel-build?
(list (string-append "JOBS="
(number->string (parallel-job-count))))
'())
,@make-flags))))
;; jdk 11 does not build jre by default any more
;; building it anyways
;; for further information see:
;; https://github.com/AdoptOpenJDK/openjdk-build/issues/356
(add-after 'build 'build-jre
(lambda* (#:key parallel-build? make-flags #:allow-other-keys)
(apply invoke "make" "legacy-jre-image"
`(,@(if parallel-build?
(list (string-append "JOBS="
(number->string (parallel-job-count))))
'())
,@make-flags))))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(jdk (assoc-ref outputs "jdk"))
(doc (assoc-ref outputs "doc"))
(images (car (find-files "build" ".*-server-release"
#:directories? #t))))
(copy-recursively (string-append images "/images/jdk") jdk)
(copy-recursively (string-append images "/images/jre") out)
(copy-recursively (string-append images "/images/docs") doc))
#t))
;; Some of the libraries in the lib/ folder link to libjvm.so.
;; But that shared object is located in the server/ folder, so it
;; cannot be found. This phase creates a symbolic link in the
;; lib/ folder so that the other libraries can find it.
;;
;; See:
;; https://lists.gnu.org/archive/html/guix-devel/2017-10/msg00169.html
;;
;; FIXME: Find the bug in the build system, so that this symlink is
;; not needed.
(add-after 'install 'install-libjvm
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((lib-out (string-append (assoc-ref outputs "out")
"/lib"))
(lib-jdk (string-append (assoc-ref outputs "jdk")
"/lib")))
(symlink (string-append lib-jdk "/server/libjvm.so")
(string-append lib-jdk "/libjvm.so"))
(symlink (string-append lib-out "/server/libjvm.so")
(string-append lib-out "/libjvm.so")))
#t))
(add-after 'install 'strip-character-data-timestamps
(lambda* (#:key outputs #:allow-other-keys)
(use-modules (guix build syscalls))
(let ((archive (string-append
(assoc-ref outputs "jdk") "/lib/src.zip"))
(dir (mkdtemp! "zip-contents.XXXXXX")))
(with-directory-excursion dir
(invoke "unzip" archive))
(delete-file archive)
(with-directory-excursion dir
(let ((char-data-files (find-files "." "CharacterData.*")))
(for-each (lambda (file)
(substitute* file
(((string-append "This file was generated "
"AUTOMATICALLY from a template "
"file.*"))
(string-append "This file was generated "
"AUTOMATICALLY from a template "
"file"))))
char-data-files)))
(with-directory-excursion dir
(let ((files (find-files "." ".*" #:directories? #t)))
(apply invoke "zip" "-0" "-X" archive files))))))
(add-after 'strip-character-data-timestamps 'strip-archive-timestamps
(lambda* (#:key outputs #:allow-other-keys)
(use-modules (guix build syscalls)
(ice-9 binary-ports)
(rnrs bytevectors))
(letrec ((repack-archive
(lambda (archive)
(let ((dir (mkdtemp! "zip-contents.XXXXXX")))
(with-directory-excursion dir
(invoke "unzip" archive))
(delete-file archive)
(for-each (compose repack-archive canonicalize-path)
(find-files dir "(ct.sym|.*.jar)$"))
(let ((reset-file-timestamp
(lambda (file)
(let ((s (lstat file)))
(unless (eq? (stat:type s) 'symlink)
(format #t "reset ~a~%" file)
(utime file 0 0 0 0))))))
(for-each reset-file-timestamp
(find-files dir #:directories? #t)))
(with-directory-excursion dir
(let ((files (find-files "." ".*" #:directories? #t)))
(apply invoke "zip" "-0" "-X" archive files)))))))
(for-each repack-archive
(find-files (assoc-ref outputs "doc") ".*.zip$"))
(for-each repack-archive
(find-files (assoc-ref outputs "jdk")
".*.(zip|jar|diz)$"))
(repack-archive (string-append (assoc-ref outputs "jdk") "/lib/ct.sym"))
(let ((repack-jmod
(lambda (file-name)
(call-with-input-file file-name
(lambda (file)
(let ((header #vu8(#x4a #x4d #x01 #x00)))
(if (equal? (get-bytevector-n
file (bytevector-length header))
header)
(let* ((header-length (bytevector-length header))
(temp-file (mkstemp!
(string-copy
"temp-file.XXXXXX")))
(temp-filename (port-filename temp-file))
(content-length
(- (stat:size (stat file))
header-length)))
(sendfile temp-file file content-length header-length)
(delete-file file-name)
(close-port temp-file)
(repack-archive (canonicalize-path temp-filename))
(call-with-output-file file-name
(lambda (file)
(put-bytevector file header)
(call-with-input-file temp-filename
(lambda (temp-file)
(sendfile
file temp-file
(stat:size (stat temp-file)) 0)))))))))))))
(for-each repack-jmod
(find-files (assoc-ref outputs "jdk") ".*.jmod$")))
#t)))
(add-after 'install 'remove-timestamp-from-api-summary
(lambda* (#:key outputs #:allow-other-keys)
(substitute* (string-append (assoc-ref outputs "doc")
"/api/overview-summary.html")
(("Generated by javadoc \\(11-internal\\).*$")
"Generated by javadoc (11-internal) -->\n"))
#t)))))
(inputs
`(("alsa-lib" ,alsa-lib)
("cups" ,cups)
("fontconfig" ,fontconfig)
("freetype" ,freetype)
("giflib" ,giflib)
("lcms" ,lcms)
("libjpeg" ,libjpeg-turbo)
("libpng" ,libpng)
("libx11" ,libx11)
("libxext" ,libxext)
("libxrender" ,libxrender)
("libxt" ,libxt)
("libxtst" ,libxtst)))
(native-inputs
`(("autoconf" ,autoconf)
("openjdk10" ,openjdk10)
("openjdk10:jdk" ,openjdk10 "jdk")
("make" ,gnu-make-4.2)
("pkg-config" ,pkg-config)
("unzip" ,unzip)
("which" ,which)
("zip" ,zip)))
(home-page "https://openjdk.java.net/projects/jdk/11/")
(synopsis "Java development kit")
(description
"This package provides the Java development kit OpenJDK.")
(license license:gpl2+)))
(define-public openjdk12
(package
(inherit openjdk11)
(name "openjdk")
(version "12.33")
(source (origin
(method url-fetch)
(uri "http://hg.openjdk.java.net/jdk/jdk/archive/0276cba45aac.tar.bz2")
(file-name (string-append name "-" version ".tar.bz2"))
(sha256
(base32
"0mbhdrk12b6878kby0flnbak7444dlpm0ihlmf92vk59y1c02bc2"))
(modules '((guix build utils)))
(snippet
`(begin
(for-each delete-file (find-files "." ".*.(bin|exe|jar)$"))
#t))))
(inputs
`(("alsa-lib" ,alsa-lib)
("cups" ,cups)
("fontconfig" ,fontconfig)
("freetype" ,freetype)
("giflib" ,giflib)
("lcms" ,lcms)
("libjpeg" ,libjpeg-turbo)
("libpng" ,libpng)
("libx11" ,libx11)
("libxext" ,libxext)
("libxrandr" ,libxrandr)
("libxrender" ,libxrender)
("libxt" ,libxt)
("libxtst" ,libxtst)))
(native-inputs
`(("autoconf" ,autoconf)
("openjdk11" ,openjdk11)
("openjdk11:jdk" ,openjdk11 "jdk")
("make@4.2" ,gnu-make-4.2)
("pkg-config" ,pkg-config)
("unzip" ,unzip)
("which" ,which)
("zip" ,zip)))
(home-page "https://openjdk.java.net/projects/jdk/12")))
(define-public openjdk13
(package
(inherit openjdk12)
(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|exe|jar)$"))
#t))))
(inputs
`(("alsa-lib" ,alsa-lib)
("cups" ,cups)
("fontconfig" ,fontconfig)
("freetype" ,freetype)
("giflib" ,giflib)
("lcms" ,lcms)
("libjpeg" ,libjpeg-turbo)
("libpng" ,libpng)
("libx11" ,libx11)
("libxext" ,libxext)
("libxrandr" ,libxrandr)
("libxrender" ,libxrender)
("libxt" ,libxt)
("libxtst" ,libxtst)))
(native-inputs
`(("autoconf" ,autoconf)
("openjdk12:jdk" ,openjdk12 "jdk")
("make@4.2" ,gnu-make-4.2)
("pkg-config" ,pkg-config)
("unzip" ,unzip)
("which" ,which)
("zip" ,zip)))
(home-page "https://openjdk.java.net/projects/jdk/13")))
(define-public openjdk14
(package
(inherit openjdk13)
(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"))
(modules '((guix build utils)))
(snippet
`(begin
;; The m4 macro uses 'help' to search for builtins, which is
;; not available in bash-minimal
(substitute* "make/autoconf/basics.m4"
(("if help") "if command -v"))
(for-each delete-file (find-files "." ".*.(bin|exe|jar)$"))
#t))))
(inputs
`(("alsa-lib" ,alsa-lib)
("cups" ,cups)
("fontconfig" ,fontconfig)
("freetype" ,freetype)
("giflib" ,giflib)
("lcms" ,lcms)
("libjpeg" ,libjpeg-turbo)
("libpng" ,libpng)
("libx11" ,libx11)
("libxext" ,libxext)
("libxrandr" ,libxrandr)
("libxrender" ,libxrender)
("libxt" ,libxt)
("libxtst" ,libxtst)))
(native-inputs
`(("autoconf" ,autoconf)
("make@4.2" ,gnu-make-4.2)
("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)
(define-public ant/java8
(package (inherit ant-bootstrap)
(name "ant")
(version "1.10.1")
(source (origin
(method url-fetch)
(uri (string-append "mirror://apache/ant/source/apache-ant-"
version "-src.tar.gz"))
(sha256
(base32
"10p3dh77lkzzzcy32dk9azljixzadp46fggjfbvgkl8mmb8cxxv8"))
(modules '((guix build utils)))
(snippet
'(begin
(for-each delete-file
(find-files "lib/optional" "\\.jar$"))
#t))))
(arguments
(substitute-keyword-arguments (package-arguments ant-bootstrap)
((#:phases phases)
`(modify-phases ,phases
(add-after 'unpack 'remove-scripts
;; Remove bat / cmd scripts for DOS as well as the antRun and runant
;; wrappers.
(lambda _
(for-each delete-file
(find-files "src/script"
"(.*\\.(bat|cmd)|runant.*|antRun.*)"))
#t))
(replace 'build
(lambda* (#:key inputs outputs #:allow-other-keys)
(setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
;; Disable tests to avoid dependency on hamcrest-core, which needs
;; Ant to build. This is necessary in addition to disabling the
;; "check" phase, because the dependency on "test-jar" would always
;; result in the tests to be run.
(substitute* "build.xml"
(("depends=\"jars,test-jar\"") "depends=\"jars\""))
(invoke "bash" "bootstrap.sh"
(string-append "-Ddist.dir="
(assoc-ref outputs "out")))))))))
(native-inputs
`(("jdk" ,icedtea-8 "jdk")
("zip" ,zip)
("unzip" ,unzip)))))
;; The 1.9.x series is the last that can be built with GCJ. The 1.10.x series
;; requires Java 8.
(define-public ant
(package (inherit ant/java8)
(version "1.9.9")
(source (origin
(method url-fetch)
(uri (string-append "mirror://apache/ant/source/apache-ant-"
version "-src.tar.gz"))
(sha256
(base32
"1k28mka0m3isy9yr8gz84kz1f3f879rwaxrd44vdn9xbfwvwk86n"))))
(native-inputs
`(("jdk" ,icedtea-7 "jdk")
("zip" ,zip)
("unzip" ,unzip)))))
(define-public ant-apache-bcel
(package
(inherit ant/java8)
(name "ant-apache-bcel")
(arguments
(substitute-keyword-arguments (package-arguments ant/java8)
((#:phases phases)
`(modify-phases ,phases
(add-after 'unpack 'link-bcel
(lambda* (#:key inputs #:allow-other-keys)
(for-each (lambda (file)
(symlink file
(string-append "lib/optional/"
(basename file))))
(find-files (assoc-ref inputs "java-commons-bcel")
"\\.jar$"))
#t))
(add-after 'build 'install
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(share (string-append out "/share/java"))
(bin (string-append out "/bin"))
(lib (string-append out "/lib")))
(mkdir-p share)
(install-file (string-append lib "/ant-apache-bcel.jar") share)
(delete-file-recursively bin)
(delete-file-recursively lib)
#t)))))))
(inputs
`(("java-commons-bcel" ,java-commons-bcel)
,@(package-inputs ant/java8)))))
(define-public ant-junit
(package
(inherit ant/java8)
(name "ant-junit")
(arguments
(substitute-keyword-arguments (package-arguments ant/java8)
((#:phases phases)
`(modify-phases ,phases
(add-after 'unpack 'link-junit
(lambda* (#:key inputs #:allow-other-keys)
(for-each (lambda (file)
(symlink file
(string-append "lib/optional/"
(basename file))))
(find-files (assoc-ref inputs "java-junit")
"\\.jar$"))
#t))
(add-after 'build 'install
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(share (string-append out "/share/java"))
(bin (string-append out "/bin"))
(lib (string-append out "/lib")))
(mkdir-p share)
(install-file (string-append lib "/ant-junit.jar") share)
(delete-file-recursively bin)
(delete-file-recursively lib)
#t)))))))
(inputs
`(("java-junit" ,java-junit)
,@(package-inputs ant/java8)))))
(define-public java-openjfx-build
(package
(name "java-openjfx-build")
;; This is a java-8 version
(version "8.202")
(source (origin
(method hg-fetch)
(uri (hg-reference
(url "http://hg.openjdk.java.net/openjfx/8u-dev/rt")
(changeset (string-append
(string-join (string-split version #\.) "u")
"-ga"))))
(file-name (string-append name "-" version "-checkout"))
(modules '((guix build utils)))
(snippet
'(begin
;; Delete included gradle jar
(delete-file-recursively "gradle/wrapper")
#t))
(sha256
(base32
"0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))
(patches (search-patches "java-openjfx-build-jdk_version.patch"))))
(build-system ant-build-system)
(arguments
`(#:jar-name "java-openjfx.jar"
#:source-dir "buildSrc/src/main/java"
#:test-dir "buildSrc/src/test"
#:phases
(modify-phases %standard-phases
(add-before 'configure 'generate-jsl-parser
(lambda _
(invoke "antlr3" "-o"
"buildSrc/src/main/java/com/sun/scenario/effect/compiler"
"buildSrc/src/main/antlr/JSL.g"))))))
(inputs
`(("antlr3" ,antlr3)
("java-stringtemplate" ,java-stringtemplate)))
(native-inputs
`(("java-junit" ,java-junit)
("java-hamcrest-core" ,java-hamcrest-core)))
(home-page "https://openjfx.io")
(synopsis "Graphical application toolkit in Java")
(description "OpenJFX is a client application platform for desktop,
mobile and embedded systems built on Java. Its goal is to produce a
modern, efficient, and fully featured toolkit for developing rich client
applications. This package contains base classes for the OpenJFX
distribution and helper classes for building other parts of the
distribution.")
(license license:gpl2))) ;gpl2 only, with classpath exception
(define-public java-openjfx-base
(package (inherit java-openjfx-build)
(name "java-openjfx-base")
(arguments
`(#:jar-name "java-openjfx-base.jar"
#:source-dir "modules/base/src/main/java:modules/base/src/main/java8:modules/base/src/main/version-info"
#:test-dir "modules/base/src/test"
#:phases
(modify-phases %standard-phases
(add-before 'check 'remove-empty-file
(lambda _
(with-directory-excursion "modules/base/src/test/java"
;; These files are completely commented, but junit expects them to
;; contain a class, so tests fail.
(delete-file
"com/sun/javafx/property/adapter/PropertyDescriptorTest.java")
(delete-file
"com/sun/javafx/property/adapter/ReadOnlyPropertyDescriptorTest.java")
(delete-file "javafx/beans/property/PropertiesTest.java")
(delete-file
"javafx/beans/property/adapter/ReadOnlyJavaBeanPropertyBuilder_General_Test.java")
;; This one fails
(delete-file "com/sun/javafx/runtime/VersionInfoTest.java"))
#t)))))
(propagated-inputs
`(("java-openjfx-build" ,java-openjfx-build)))
(description "OpenJFX is a client application platform for desktop,
mobile and embedded systems built on Java. Its goal is to produce a
modern, efficient, and fully featured toolkit for developing rich client
applications. This package contains base classes for the OpenJFX
distribution.")))
(define-public java-openjfx-graphics
(package (inherit java-openjfx-build)
(name "java-openjfx-graphics")
(arguments
`(#:jar-name "java-openjfx-graphics.jar"
#:source-dir "modules/graphics/src/main/java"
#:tests? #f; require X
#:test-dir "modules/graphics/src/test"))
(propagated-inputs
`(("java-openjfx-base" ,java-openjfx-base)
("java-swt" ,java-swt)))
(description "OpenJFX is a client application platform for desktop,
mobile and embedded systems built on Java. Its goal is to produce a
modern, efficient, and fully featured toolkit for developing rich client
applications. This package contains graphics-related classes for the
OpenJFX distribution.")))
(define-public java-openjfx-media
(package (inherit java-openjfx-build)
(name "java-openjfx-media")
(propagated-inputs
`(("java-openjxf-graphics" ,java-openjfx-graphics)))
(arguments
`(#:jar-name "java-openjfx-media.jar"
#:source-dir "modules/media/src/main/java"
#:tests? #f)); no tests
(description "OpenJFX is a client application platform for desktop,
mobile and embedded systems built on Java. Its goal is to produce a
modern, efficient, and fully featured toolkit for developing rich client
applications. This package contains media-related classes for the
OpenJFX distribution.")))
(define-public javacc-4
(package
(name "javacc")
(version "4.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/javacc/javacc")
(commit "release_41")))
(file-name (string-append "javacc-" version "-checkout"))
(sha256
(base32
"07ysav7j8r1c6h8qxrgqk6lwdp74ly0ad1935lragxml0qqc3ka0"))
(modules '((guix build utils)))
;; delete bundled jars
(snippet '(begin (delete-file-recursively "lib") #t))))
(build-system ant-build-system)
;; Tests fail with
;; /tmp/guix-build-javacc-4.1.drv-0/source/test/javacodeLA/build.xml:60:
;; JAVACODE failed
(arguments
`(#:tests? #f
#:phases
(modify-phases %standard-phases
;; Delete tests to avoid build failure (we don't run them anyway).
(add-after 'unpack 'delete-tests
(lambda _
(for-each delete-file
'("src/org/javacc/JavaCCTestCase.java"
"src/org/javacc/parser/ExpansionTest.java"
"src/org/javacc/parser/OptionsTest.java"
"src/org/javacc/jjtree/JJTreeOptionsTest.java"))
(for-each delete-file-recursively
'("src/org/javacc/parser/test"
"src/org/javacc/jjdoc/test"))
#t))
(replace 'install (install-jars "bin/lib")))))
(home-page "https://javacc.org/")
(synopsis "Java parser generator")
(description "Java Compiler Compiler (JavaCC) is the most popular parser
generator for use with Java applications. A parser generator is a tool that
reads a grammar specification and converts it to a Java program that can
recognize matches to the grammar. In addition to the parser generator itself,
JavaCC provides other standard capabilities related to parser generation such
as tree building (via a tool called JJTree included with JavaCC), actions,
debugging, etc.")
(license license:bsd-3)))
;; javacc-3, as javacc-4 is not properly bootstrapped: is contains a javacc.jar
;; in the bootstrap/ directory.
(define-public javacc-3
(package
(inherit javacc-4)
(version "3.2")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/javacc/javacc.git")
(commit "release_32")))
(file-name (string-append "javacc-" version "-checkout"))
(sha256
(base32
"1pyf1xyh8gk83nxqn2v2mdws32l68ydznha41cxa4l2kkbq1v1g3"))))
(arguments
`(#:tests? #f
#:phases
(modify-phases %standard-phases
(add-before 'build 'set-java-version
(lambda _
</