gnu: icedtea-6: Use modify-phases syntax.

* gnu/packages/java.scm (icedtea-6)[arguments]: Use modify-phases
  syntax.
This commit is contained in:
Ricardo Wurmus 2016-07-08 11:28:58 +02:00 committed by Ricardo Wurmus
parent 745ad37a78
commit 9bc84dfea9

View file

@ -281,111 +281,108 @@ (define-public icedtea-6
,(string-append "--with-jdk-home=" jdk) ,(string-append "--with-jdk-home=" jdk)
,(string-append "--with-java=" jdk "/bin/java"))) ,(string-append "--with-java=" jdk "/bin/java")))
#:phases #:phases
(alist-replace (modify-phases %standard-phases
'unpack (replace 'unpack
(lambda* (#:key source inputs #:allow-other-keys) (lambda* (#:key source inputs #:allow-other-keys)
(and (zero? (system* "tar" "xvf" source)) (and (zero? (system* "tar" "xvf" source))
(begin (begin
(chdir (string-append "icedtea6-" ,version)) (chdir (string-append "icedtea6-" ,version))
(mkdir "openjdk.src") (mkdir "openjdk.src")
(with-directory-excursion "openjdk.src" (with-directory-excursion "openjdk.src"
(copy-file (assoc-ref inputs "openjdk6-src") (copy-file (assoc-ref inputs "openjdk6-src")
"openjdk6-src.tar.xz") "openjdk6-src.tar.xz")
(zero? (system* "tar" "xvf" "openjdk6-src.tar.xz")))))) (zero? (system* "tar" "xvf" "openjdk6-src.tar.xz")))))))
(alist-cons-after (add-after 'unpack 'patch-patches
'unpack 'patch-patches (lambda _
(lambda _ ;; shebang in patches so that they apply cleanly
;; shebang in patches so that they apply cleanly (substitute* '("patches/jtreg-jrunscript.patch"
(substitute* '("patches/jtreg-jrunscript.patch" "patches/hotspot/hs23/drop_unlicensed_test.patch")
"patches/hotspot/hs23/drop_unlicensed_test.patch") (("#!/bin/sh") (string-append "#!" (which "sh"))))
(("#!/bin/sh") (string-append "#!" (which "sh"))))
;; fix path to alsa header in patch ;; fix path to alsa header in patch
(substitute* "patches/openjdk/6799141-split_out_versions.patch" (substitute* "patches/openjdk/6799141-split_out_versions.patch"
(("ALSA_INCLUDE=/usr/include/alsa/version.h") (("ALSA_INCLUDE=/usr/include/alsa/version.h")
(string-append "ALSA_INCLUDE=" (string-append "ALSA_INCLUDE="
(assoc-ref %build-inputs "alsa-lib") (assoc-ref %build-inputs "alsa-lib")
"/include/alsa/version.h")))) "/include/alsa/version.h")))))
(alist-cons-after (add-after 'unpack 'patch-paths
'unpack 'patch-paths (lambda _
(lambda _ ;; buildtree.make generates shell scripts, so we need to replace
;; buildtree.make generates shell scripts, so we need to replace ;; the generated shebang
;; the generated shebang (substitute* '("openjdk.src/hotspot/make/linux/makefiles/buildtree.make")
(substitute* '("openjdk.src/hotspot/make/linux/makefiles/buildtree.make") (("/bin/sh") (which "bash")))
(("/bin/sh") (which "bash")))
(let ((corebin (string-append (let ((corebin (string-append
(assoc-ref %build-inputs "coreutils") "/bin/")) (assoc-ref %build-inputs "coreutils") "/bin/"))
(binbin (string-append (binbin (string-append
(assoc-ref %build-inputs "binutils") "/bin/")) (assoc-ref %build-inputs "binutils") "/bin/"))
(grepbin (string-append (grepbin (string-append
(assoc-ref %build-inputs "grep") "/bin/"))) (assoc-ref %build-inputs "grep") "/bin/")))
(substitute* '("openjdk.src/jdk/make/common/shared/Defs-linux.gmk" (substitute* '("openjdk.src/jdk/make/common/shared/Defs-linux.gmk"
"openjdk.src/corba/make/common/shared/Defs-linux.gmk") "openjdk.src/corba/make/common/shared/Defs-linux.gmk")
(("UNIXCOMMAND_PATH = /bin/") (("UNIXCOMMAND_PATH = /bin/")
(string-append "UNIXCOMMAND_PATH = " corebin)) (string-append "UNIXCOMMAND_PATH = " corebin))
(("USRBIN_PATH = /usr/bin/") (("USRBIN_PATH = /usr/bin/")
(string-append "USRBIN_PATH = " corebin)) (string-append "USRBIN_PATH = " corebin))
(("DEVTOOLS_PATH *= */usr/bin/") (("DEVTOOLS_PATH *= */usr/bin/")
(string-append "DEVTOOLS_PATH = " corebin)) (string-append "DEVTOOLS_PATH = " corebin))
(("COMPILER_PATH *= */usr/bin/") (("COMPILER_PATH *= */usr/bin/")
(string-append "COMPILER_PATH = " (string-append "COMPILER_PATH = "
(assoc-ref %build-inputs "gcc") "/bin/")) (assoc-ref %build-inputs "gcc") "/bin/"))
(("DEF_OBJCOPY *=.*objcopy") (("DEF_OBJCOPY *=.*objcopy")
(string-append "DEF_OBJCOPY = " (which "objcopy")))) (string-append "DEF_OBJCOPY = " (which "objcopy"))))
;; fix hard-coded utility paths ;; fix hard-coded utility paths
(substitute* '("openjdk.src/jdk/make/common/shared/Defs-utils.gmk" (substitute* '("openjdk.src/jdk/make/common/shared/Defs-utils.gmk"
"openjdk.src/corba/make/common/shared/Defs-utils.gmk") "openjdk.src/corba/make/common/shared/Defs-utils.gmk")
(("ECHO *=.*echo") (("ECHO *=.*echo")
(string-append "ECHO = " (which "echo"))) (string-append "ECHO = " (which "echo")))
(("^GREP *=.*grep") (("^GREP *=.*grep")
(string-append "GREP = " (which "grep"))) (string-append "GREP = " (which "grep")))
(("EGREP *=.*egrep") (("EGREP *=.*egrep")
(string-append "EGREP = " (which "egrep"))) (string-append "EGREP = " (which "egrep")))
(("CPIO *=.*cpio") (("CPIO *=.*cpio")
(string-append "CPIO = " (which "cpio"))) (string-append "CPIO = " (which "cpio")))
(("READELF *=.*readelf") (("READELF *=.*readelf")
(string-append "READELF = " (which "readelf"))) (string-append "READELF = " (which "readelf")))
(("^ *AR *=.*ar") (("^ *AR *=.*ar")
(string-append "AR = " (which "ar"))) (string-append "AR = " (which "ar")))
(("^ *TAR *=.*tar") (("^ *TAR *=.*tar")
(string-append "TAR = " (which "tar"))) (string-append "TAR = " (which "tar")))
(("AS *=.*as") (("AS *=.*as")
(string-append "AS = " (which "as"))) (string-append "AS = " (which "as")))
(("LD *=.*ld") (("LD *=.*ld")
(string-append "LD = " (which "ld"))) (string-append "LD = " (which "ld")))
(("STRIP *=.*strip") (("STRIP *=.*strip")
(string-append "STRIP = " (which "strip"))) (string-append "STRIP = " (which "strip")))
(("NM *=.*nm") (("NM *=.*nm")
(string-append "NM = " (which "nm"))) (string-append "NM = " (which "nm")))
(("^SH *=.*sh") (("^SH *=.*sh")
(string-append "SH = " (which "bash"))) (string-append "SH = " (which "bash")))
(("^FIND *=.*find") (("^FIND *=.*find")
(string-append "FIND = " (which "find"))) (string-append "FIND = " (which "find")))
(("LDD *=.*ldd") (("LDD *=.*ldd")
(string-append "LDD = " (which "ldd"))) (string-append "LDD = " (which "ldd")))
(("NAWK *=.*(n|g)awk") (("NAWK *=.*(n|g)awk")
(string-append "NAWK = " (which "gawk"))) (string-append "NAWK = " (which "gawk")))
(("XARGS *=.*xargs") (("XARGS *=.*xargs")
(string-append "XARGS = " (which "xargs"))) (string-append "XARGS = " (which "xargs")))
(("UNZIP *=.*unzip") (("UNZIP *=.*unzip")
(string-append "UNZIP = " (which "unzip"))) (string-append "UNZIP = " (which "unzip")))
(("ZIPEXE *=.*zip") (("ZIPEXE *=.*zip")
(string-append "ZIPEXE = " (which "zip"))) (string-append "ZIPEXE = " (which "zip")))
(("SED *=.*sed") (("SED *=.*sed")
(string-append "SED = " (which "sed")))) (string-append "SED = " (which "sed"))))
;; Some of these timestamps cause problems as they are more than ;; Some of these timestamps cause problems as they are more than
;; 10 years ago, failing the build process. ;; 10 years ago, failing the build process.
(substitute* (substitute*
"openjdk.src/jdk/src/share/classes/java/util/CurrencyData.properties" "openjdk.src/jdk/src/share/classes/java/util/CurrencyData.properties"
(("AZ=AZM;2005-12-31-20-00-00;AZN") "AZ=AZN") (("AZ=AZM;2005-12-31-20-00-00;AZN") "AZ=AZN")
(("MZ=MZM;2006-06-30-22-00-00;MZN") "MZ=MZN") (("MZ=MZM;2006-06-30-22-00-00;MZN") "MZ=MZN")
(("RO=ROL;2005-06-30-21-00-00;RON") "RO=RON") (("RO=ROL;2005-06-30-21-00-00;RON") "RO=RON")
(("TR=TRL;2004-12-31-22-00-00;TRY") "TR=TRY")))) (("TR=TRL;2004-12-31-22-00-00;TRY") "TR=TRY")))))
(alist-cons-before (add-before 'configure 'set-additional-paths
'configure 'set-additional-paths
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let* ((gcjdir (assoc-ref %build-inputs "gcj")) (let* ((gcjdir (assoc-ref %build-inputs "gcj"))
(gcjlib (string-append gcjdir "/lib")) (gcjlib (string-append gcjdir "/lib"))
@ -412,125 +409,119 @@ (define-public icedtea-6
"/include")) "/include"))
(setenv "ALT_FREETYPE_LIB_PATH" (setenv "ALT_FREETYPE_LIB_PATH"
(string-append (assoc-ref %build-inputs "freetype") (string-append (assoc-ref %build-inputs "freetype")
"/lib")))) "/lib")))))
(alist-cons-before (add-before 'check 'fix-test-framework
'check 'fix-test-framework (lambda _
(lambda _ ;; Fix PATH in test environment
;; Fix PATH in test environment (substitute* "src/jtreg/com/sun/javatest/regtest/Main.java"
(substitute* "src/jtreg/com/sun/javatest/regtest/Main.java" (("PATH=/bin:/usr/bin")
(("PATH=/bin:/usr/bin") (string-append "PATH=" (getenv "PATH"))))
(string-append "PATH=" (getenv "PATH")))) (substitute* "src/jtreg/com/sun/javatest/util/SysEnv.java"
(substitute* "src/jtreg/com/sun/javatest/util/SysEnv.java" (("/usr/bin/env") (which "env")))
(("/usr/bin/env") (which "env"))) #t))
#t) (add-before 'check 'fix-hotspot-tests
(alist-cons-before (lambda _
'check 'fix-hotspot-tests (with-directory-excursion "openjdk.src/hotspot/test/"
(lambda _ (substitute* "jprt.config"
(with-directory-excursion "openjdk.src/hotspot/test/" (("PATH=\"\\$\\{path4sdk\\}\"")
(substitute* "jprt.config" (string-append "PATH=" (getenv "PATH")))
(("PATH=\"\\$\\{path4sdk\\}\"") (("make=/usr/bin/make")
(string-append "PATH=" (getenv "PATH"))) (string-append "make=" (which "make"))))
(("make=/usr/bin/make") (substitute* '("runtime/6626217/Test6626217.sh"
(string-append "make=" (which "make")))) "runtime/7110720/Test7110720.sh")
(substitute* '("runtime/6626217/Test6626217.sh" (("/bin/rm") (which "rm"))
"runtime/7110720/Test7110720.sh") (("/bin/cp") (which "cp"))
(("/bin/rm") (which "rm")) (("/bin/mv") (which "mv"))))
(("/bin/cp") (which "cp")) #t))
(("/bin/mv") (which "mv")))) (add-before 'check 'fix-jdk-tests
#t) (lambda _
(alist-cons-before (with-directory-excursion "openjdk.src/jdk/test/"
'check 'fix-jdk-tests (substitute* "com/sun/jdi/JdbReadTwiceTest.sh"
(lambda _ (("/bin/pwd") (which "pwd")))
(with-directory-excursion "openjdk.src/jdk/test/" (substitute* "com/sun/jdi/ShellScaffold.sh"
(substitute* "com/sun/jdi/JdbReadTwiceTest.sh" (("/bin/kill") (which "kill")))
(("/bin/pwd") (which "pwd"))) (substitute* "start-Xvfb.sh"
(substitute* "com/sun/jdi/ShellScaffold.sh" ;;(("/usr/bin/X11/Xvfb") (which "Xvfb"))
(("/bin/kill") (which "kill"))) (("/usr/bin/nohup") (which "nohup")))
(substitute* "start-Xvfb.sh" (substitute* "javax/security/auth/Subject/doAs/Test.sh"
;;(("/usr/bin/X11/Xvfb") (which "Xvfb")) (("/bin/rm") (which "rm")))
(("/usr/bin/nohup") (which "nohup"))) (substitute* "tools/launcher/MultipleJRE.sh"
(substitute* "javax/security/auth/Subject/doAs/Test.sh" (("echo \"#!/bin/sh\"")
(("/bin/rm") (which "rm"))) (string-append "echo \"#!" (which "rm") "\""))
(substitute* "tools/launcher/MultipleJRE.sh" (("/usr/bin/zip") (which "zip")))
(("echo \"#!/bin/sh\"") (substitute* "com/sun/jdi/OnThrowTest.java"
(string-append "echo \"#!" (which "rm") "\"")) (("#!/bin/sh") (string-append "#!" (which "sh"))))
(("/usr/bin/zip") (which "zip"))) (substitute* "java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java"
(substitute* "com/sun/jdi/OnThrowTest.java" (("/usr/bin/uptime") (which "uptime")))
(("#!/bin/sh") (string-append "#!" (which "sh")))) (substitute* "java/lang/ProcessBuilder/Basic.java"
(substitute* "java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java" (("/usr/bin/env") (which "env"))
(("/usr/bin/uptime") (which "uptime"))) (("/bin/false") (which "false"))
(substitute* "java/lang/ProcessBuilder/Basic.java" (("/bin/true") (which "true"))
(("/usr/bin/env") (which "env")) (("/bin/cp") (which "cp"))
(("/bin/false") (which "false")) (("/bin/sh") (which "sh")))
(("/bin/true") (which "true")) (substitute* "java/lang/ProcessBuilder/FeelingLucky.java"
(("/bin/cp") (which "cp")) (("/bin/sh") (which "sh")))
(("/bin/sh") (which "sh"))) (substitute* "java/lang/ProcessBuilder/Zombies.java"
(substitute* "java/lang/ProcessBuilder/FeelingLucky.java" (("/usr/bin/perl") (which "perl"))
(("/bin/sh") (which "sh"))) (("/bin/ps") (which "ps"))
(substitute* "java/lang/ProcessBuilder/Zombies.java" (("/bin/true") (which "true")))
(("/usr/bin/perl") (which "perl")) (substitute* "java/lang/Runtime/exec/ConcurrentRead.java"
(("/bin/ps") (which "ps")) (("/usr/bin/tee") (which "tee")))
(("/bin/true") (which "true"))) (substitute* "java/lang/Runtime/exec/ExecWithDir.java"
(substitute* "java/lang/Runtime/exec/ConcurrentRead.java" (("/bin/true") (which "true")))
(("/usr/bin/tee") (which "tee"))) (substitute* "java/lang/Runtime/exec/ExecWithInput.java"
(substitute* "java/lang/Runtime/exec/ExecWithDir.java" (("/bin/cat") (which "cat")))
(("/bin/true") (which "true"))) (substitute* "java/lang/Runtime/exec/ExitValue.java"
(substitute* "java/lang/Runtime/exec/ExecWithInput.java" (("/bin/sh") (which "sh"))
(("/bin/cat") (which "cat"))) (("/bin/true") (which "true"))
(substitute* "java/lang/Runtime/exec/ExitValue.java" (("/bin/kill") (which "kill")))
(("/bin/sh") (which "sh")) (substitute* "java/lang/Runtime/exec/LotsOfDestroys.java"
(("/bin/true") (which "true")) (("/usr/bin/echo") (which "echo")))
(("/bin/kill") (which "kill"))) (substitute* "java/lang/Runtime/exec/LotsOfOutput.java"
(substitute* "java/lang/Runtime/exec/LotsOfDestroys.java" (("/usr/bin/cat") (which "cat")))
(("/usr/bin/echo") (which "echo"))) (substitute* "java/lang/Runtime/exec/SleepyCat.java"
(substitute* "java/lang/Runtime/exec/LotsOfOutput.java" (("/bin/cat") (which "cat"))
(("/usr/bin/cat") (which "cat"))) (("/bin/sleep") (which "sleep"))
(substitute* "java/lang/Runtime/exec/SleepyCat.java" (("/bin/sh") (which "sh")))
(("/bin/cat") (which "cat")) (substitute* "java/lang/Runtime/exec/StreamsSurviveDestroy.java"
(("/bin/sleep") (which "sleep")) (("/bin/cat") (which "cat")))
(("/bin/sh") (which "sh"))) (substitute* "java/rmi/activation/CommandEnvironment/SetChildEnv.java"
(substitute* "java/lang/Runtime/exec/StreamsSurviveDestroy.java" (("/bin/chmod") (which "chmod")))
(("/bin/cat") (which "cat"))) (substitute* "java/util/zip/ZipFile/Assortment.java"
(substitute* "java/rmi/activation/CommandEnvironment/SetChildEnv.java" (("/bin/sh") (which "sh"))))
(("/bin/chmod") (which "chmod"))) #t))
(substitute* "java/util/zip/ZipFile/Assortment.java" (replace 'check
(("/bin/sh") (which "sh")))) (lambda _
#t) ;; The "make check-*" targets always return zero, so we need to
(alist-replace ;; check for errors in the associated log files to determine
'check ;; whether any tests have failed.
(lambda _ (use-modules (ice-9 rdelim))
;; The "make check-*" targets always return zero, so we need to (let* ((error-pattern (make-regexp "^(Error|FAILED):.*"))
;; check for errors in the associated log files to determine (checker (lambda (port)
;; whether any tests have failed. (let loop ()
(use-modules (ice-9 rdelim)) (let ((line (read-line port)))
(let* ((error-pattern (make-regexp "^(Error|FAILED):.*")) (cond
(checker (lambda (port) ((eof-object? line) #t)
(let loop () ((regexp-exec error-pattern line) #f)
(let ((line (read-line port))) (else (loop)))))))
(cond (run-test (lambda (test)
((eof-object? line) #t) (system* "make" test)
((regexp-exec error-pattern line) #f) (call-with-input-file
(else (loop))))))) (string-append "test/" test ".log")
(run-test (lambda (test) checker))))
(system* "make" test) (or #t ; skip tests
(call-with-input-file (and (run-test "check-hotspot")
(string-append "test/" test ".log") (run-test "check-langtools")
checker)))) (run-test "check-jdk"))))))
(or #t ; skip tests (replace 'install
(and (run-test "check-hotspot") (lambda* (#:key outputs #:allow-other-keys)
(run-test "check-langtools") (let ((doc (string-append (assoc-ref outputs "doc")
(run-test "check-jdk"))))) "/share/doc/icedtea"))
(alist-replace (jre (assoc-ref outputs "out"))
'install (jdk (assoc-ref outputs "jdk")))
(lambda* (#:key outputs #:allow-other-keys) (copy-recursively "openjdk.build/docs" doc)
(let ((doc (string-append (assoc-ref outputs "doc") (copy-recursively "openjdk.build/j2re-image" jre)
"/share/doc/icedtea")) (copy-recursively "openjdk.build/j2sdk-image" jdk)))))))
(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)))
%standard-phases)))))))))))
(native-inputs (native-inputs
`(("ant" ,ant) `(("ant" ,ant)
("alsa-lib" ,alsa-lib) ("alsa-lib" ,alsa-lib)