From 7b82e1cdbed4c3a44ecbb99f754580a9e6a1b0ae Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 15 May 2020 00:15:25 +0200 Subject: [PATCH] gnu: openjdk11: Build in parallel. * gnu/packages/java.scm (openjdk11)[arguments]: Remove #:parallel-build?, #:parallel-tests?, and #:make-flags options; add "write-source-revision-file"; replace "build" phase; do not set GUIX_LD_WRAPPER_ALLOW_IMPURITIES; pass JOBS variable to make in "build" and "build-jre" phases. --- gnu/packages/java.scm | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index f76dfc8681..d74f0af9d9 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -2013,11 +2013,6 @@ (define-public openjdk11 ,@%gnu-build-system-modules) #:tests? #f; requires jtreg ;; TODO package jtreg - ;; disable parallel builds, as the openjdk build system does not like -j - #:parallel-build? #f - #:parallel-tests? #f - ;; reenable parallel builds and tests by adding the flags manually - #:make-flags (list (string-append "JOBS=" (number->string (parallel-job-count)))) #:configure-flags `("--disable-option-checking" ; --enable-fast-install default flag errors otherwise "--disable-warnings-as-errors" @@ -2034,7 +2029,6 @@ (define-public openjdk11 (assoc-ref %build-inputs "freetype") "/include") ,(string-append "--with-freetype-lib=" (assoc-ref %build-inputs "freetype") "/lib")) - ;; TODO #:phases (modify-phases %standard-phases (add-after 'patch-source-shebangs 'fix-java-shebangs @@ -2044,22 +2038,32 @@ (define-public openjdk11 (substitute* "make/data/blacklistedcertsconverter/blacklisted.certs.pem" (("^#!.*") "#! java BlacklistedCertsConverter SHA-256\n")) #t)) - (replace 'build + (add-before 'build 'write-source-revision-file (lambda _ (with-output-to-file ".src-rev" (lambda _ (display ,version))) - (setenv "GUIX_LD_WRAPPER_ALLOW_IMPURITIES" "yes") - (invoke "make" "all") #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 _ - (invoke "make" "legacy-jre-image") - #t)) + (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"))