1
Fork 0
mirror of https://https.git.savannah.gnu.org/git/guix.git/ synced 2025-07-16 03:50:45 +02:00

gnu: opendjk11: Remove trailing #t and use gexps.

* gnu/packages/java.scm (openjdk11): Properly punctuate comments.
[source]: Remove trailing #t in snippet.
[configure-flags]: Use gexps and this-package-input.
[phases]: Delete trailing #t and use gexps to refer to outputs.
This commit is contained in:
Maxim Cournoyer 2022-09-26 16:37:45 -04:00
parent 79b8e52e64
commit e33ab2dd9e
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -1781,49 +1781,50 @@ new Date();"))
"0di91nnms2iq1svgq72r5y17am17r4vh2lq43k0bkcwpc84d6nd8")) "0di91nnms2iq1svgq72r5y17am17r4vh2lq43k0bkcwpc84d6nd8"))
(modules '((guix build utils))) (modules '((guix build utils)))
(snippet (snippet
`(begin '(for-each delete-file (find-files "." ".*.(bin|exe|jar)$")))))
(for-each delete-file (find-files "." ".*.(bin|exe|jar)$"))
#t))))
(build-system gnu-build-system) (build-system gnu-build-system)
(outputs '("out" "jdk" "doc")) (outputs '("out" "jdk" "doc"))
(arguments (arguments
`(#:imported-modules ((guix build syscalls) (list
#:imported-modules `((guix build syscalls)
,@%gnu-build-system-modules) ,@%gnu-build-system-modules)
#:disallowed-references ,(list (gexp-input openjdk10) #:disallowed-references (list (gexp-input openjdk10)
(gexp-input openjdk10 "jdk")) (gexp-input openjdk10 "jdk"))
#:tests? #f; requires jtreg #:tests? #f ; requires jtreg
;; TODO package jtreg ;; TODO package jtreg
#:configure-flags #:configure-flags
`(;; Add flags for compilation with gcc >= 10 #~(list
,(string-append "--with-extra-cflags=-fcommon" ;; Add flags for compilation with gcc >= 10.
#$(string-append "--with-extra-cflags=-fcommon"
" -fno-delete-null-pointer-checks" " -fno-delete-null-pointer-checks"
" -fno-lifetime-dse") " -fno-lifetime-dse")
"--disable-option-checking" ; --enable-fast-install default flag errors otherwise ;; Otherwise, the '--enable-fast-install' causes an error.
"--disable-option-checking"
"--disable-warnings-as-errors" "--disable-warnings-as-errors"
;; make validate-runpath pass, see: http://issues.guix.info/issue/32894 ;; Make validate-runpath pass (see:
;; http://issues.guix.info/issue/32894).
"--with-native-debug-symbols=zipped" "--with-native-debug-symbols=zipped"
;; do not use the bundled libraries ;; Do not use the bundled libraries.
"--with-giflib=system" "--with-giflib=system"
"--with-lcms=system" "--with-lcms=system"
"--with-libjpeg=system" "--with-libjpeg=system"
"--with-libpng=system" "--with-libpng=system"
"--with-version-pre=" "--with-version-pre="
;; allow the build system to locate the system freetype ;; Allow the build system to locate the system freetype.
,(string-append "--with-freetype-include=" (string-append "--with-freetype-include="
(assoc-ref %build-inputs "freetype") "/include") #$(this-package-input "freetype") "/include")
,(string-append "--with-freetype-lib=" (string-append "--with-freetype-lib="
(assoc-ref %build-inputs "freetype") "/lib")) #$(this-package-input "freetype") "/lib"))
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'patch-source-shebangs 'fix-java-shebangs (add-after 'patch-source-shebangs 'fix-java-shebangs
(lambda _ (lambda _
;; This file was "fixed" by patch-source-shebangs, but it requires ;; This file was "fixed" by patch-source-shebangs, but it requires
;; this exact first line. ;; this exact first line.
(substitute* "make/data/blockedcertsconverter/blocked.certs.pem" (substitute* "make/data/blockedcertsconverter/blocked.certs.pem"
(("^#!.*") "#! java BlockedCertsConverter SHA-256\n")) (("^#!.*") "#! java BlockedCertsConverter SHA-256\n"))))
#t))
(add-after 'unpack 'patch-jni-libs (add-after 'unpack 'patch-jni-libs
;; Hardcode dynamically loaded libraries. ;; Hardcode dynamically loaded libraries.
(lambda _ (lambda _
@ -1858,14 +1859,12 @@ new Date();"))
"warning: failed to substitute: ~a~%" "warning: failed to substitute: ~a~%"
file)))) file))))
(find-files "." (find-files "."
"\\.c$|\\.h$")) "\\.c$|\\.h$")))))
#t)))
(add-before 'build 'write-source-revision-file (add-before 'build 'write-source-revision-file
(lambda _ (lambda _
(with-output-to-file ".src-rev" (with-output-to-file ".src-rev"
(lambda _ (lambda _
(display ,version))) (display #$version)))))
#t))
(replace 'build (replace 'build
(lambda* (#:key parallel-build? make-flags #:allow-other-keys) (lambda* (#:key parallel-build? make-flags #:allow-other-keys)
(apply invoke "make" "all" (apply invoke "make" "all"
@ -1874,10 +1873,9 @@ new Date();"))
(number->string (parallel-job-count)))) (number->string (parallel-job-count))))
'()) '())
,@make-flags)))) ,@make-flags))))
;; jdk 11 does not build jre by default any more ;; jdk 11 does not build jre by default any more; so explicitly build
;; building it anyways ;; it (see:
;; for further information see: ;; https://github.com/AdoptOpenJDK/openjdk-build/issues/356).
;; https://github.com/AdoptOpenJDK/openjdk-build/issues/356
(add-after 'build 'build-jre (add-after 'build 'build-jre
(lambda* (#:key parallel-build? make-flags #:allow-other-keys) (lambda* (#:key parallel-build? make-flags #:allow-other-keys)
(apply invoke "make" "legacy-jre-image" (apply invoke "make" "legacy-jre-image"
@ -1887,16 +1885,15 @@ new Date();"))
'()) '())
,@make-flags)))) ,@make-flags))))
(replace 'install (replace 'install
(lambda* (#:key outputs #:allow-other-keys) (lambda _
(let ((out (assoc-ref outputs "out")) (let ((images (car (find-files "build" ".*-server-release"
(jdk (assoc-ref outputs "jdk"))
(doc (assoc-ref outputs "doc"))
(images (car (find-files "build" ".*-server-release"
#:directories? #t)))) #:directories? #t))))
(copy-recursively (string-append images "/images/jdk") jdk) (copy-recursively (string-append images "/images/jdk")
(copy-recursively (string-append images "/images/jre") out) #$output:jdk)
(copy-recursively (string-append images "/images/docs") doc)) (copy-recursively (string-append images "/images/jre")
#t)) #$output)
(copy-recursively (string-append images "/images/docs")
#$output:doc))))
;; Some of the libraries in the lib/ folder link to libjvm.so. ;; Some of the libraries in the lib/ folder link to libjvm.so.
;; But that shared object is located in the server/ folder, so it ;; But that shared object is located in the server/ folder, so it
;; cannot be found. This phase creates a symbolic link in the ;; cannot be found. This phase creates a symbolic link in the
@ -1908,21 +1905,17 @@ new Date();"))
;; FIXME: Find the bug in the build system, so that this symlink is ;; FIXME: Find the bug in the build system, so that this symlink is
;; not needed. ;; not needed.
(add-after 'install 'install-libjvm (add-after 'install 'install-libjvm
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda _
(let* ((lib-out (string-append (assoc-ref outputs "out") (let ((lib-out (string-append #$output "/lib"))
"/lib")) (lib-jdk (string-append #$output:jdk "/lib")))
(lib-jdk (string-append (assoc-ref outputs "jdk")
"/lib")))
(symlink (string-append lib-jdk "/server/libjvm.so") (symlink (string-append lib-jdk "/server/libjvm.so")
(string-append lib-jdk "/libjvm.so")) (string-append lib-jdk "/libjvm.so"))
(symlink (string-append lib-out "/server/libjvm.so") (symlink (string-append lib-out "/server/libjvm.so")
(string-append lib-out "/libjvm.so"))) (string-append lib-out "/libjvm.so")))))
#t))
(add-after 'install 'strip-character-data-timestamps (add-after 'install 'strip-character-data-timestamps
(lambda* (#:key outputs #:allow-other-keys) (lambda _
(use-modules (guix build syscalls)) (use-modules (guix build syscalls))
(let ((archive (string-append (let ((archive (string-append #$output:jdk "/lib/src.zip"))
(assoc-ref outputs "jdk") "/lib/src.zip"))
(dir (mkdtemp! "zip-contents.XXXXXX"))) (dir (mkdtemp! "zip-contents.XXXXXX")))
(with-directory-excursion dir (with-directory-excursion dir
(invoke "unzip" archive)) (invoke "unzip" archive))
@ -1942,7 +1935,7 @@ new Date();"))
(let ((files (find-files "." ".*" #:directories? #t))) (let ((files (find-files "." ".*" #:directories? #t)))
(apply invoke "zip" "-0" "-X" archive files)))))) (apply invoke "zip" "-0" "-X" archive files))))))
(add-after 'strip-character-data-timestamps 'strip-archive-timestamps (add-after 'strip-character-data-timestamps 'strip-archive-timestamps
(lambda* (#:key outputs #:allow-other-keys) (lambda _
(use-modules (guix build syscalls) (use-modules (guix build syscalls)
(ice-9 binary-ports) (ice-9 binary-ports)
(rnrs bytevectors)) (rnrs bytevectors))
@ -1966,11 +1959,10 @@ new Date();"))
(let ((files (find-files "." ".*" #:directories? #t))) (let ((files (find-files "." ".*" #:directories? #t)))
(apply invoke "zip" "-0" "-X" archive files))))))) (apply invoke "zip" "-0" "-X" archive files)))))))
(for-each repack-archive (for-each repack-archive
(find-files (assoc-ref outputs "doc") ".*.zip$")) (find-files #$output:doc ".*.zip$"))
(for-each repack-archive (for-each repack-archive
(find-files (assoc-ref outputs "jdk") (find-files #$output:jdk ".*.(zip|jar|diz)$"))
".*.(zip|jar|diz)$")) (repack-archive (string-append #$output:jdk "/lib/ct.sym"))
(repack-archive (string-append (assoc-ref outputs "jdk") "/lib/ct.sym"))
(let ((repack-jmod (let ((repack-jmod
(lambda (file-name) (lambda (file-name)
(call-with-input-file file-name (call-with-input-file file-name
@ -2000,15 +1992,13 @@ new Date();"))
file temp-file file temp-file
(stat:size (stat temp-file)) 0))))))))))))) (stat:size (stat temp-file)) 0)))))))))))))
(for-each repack-jmod (for-each repack-jmod
(find-files (assoc-ref outputs "jdk") ".*.jmod$"))) (find-files #$output:jdk ".*.jmod$"))))))
#t)))
(add-after 'install 'remove-timestamp-from-api-summary (add-after 'install 'remove-timestamp-from-api-summary
(lambda* (#:key outputs #:allow-other-keys) (lambda _
(substitute* (string-append (assoc-ref outputs "doc") (substitute* (string-append #$output:doc
"/api/overview-summary.html") "/api/overview-summary.html")
(("Generated by javadoc \\(11-internal\\).*$") (("Generated by javadoc \\(11-internal\\).*$")
"Generated by javadoc (11-internal) -->\n")) "Generated by javadoc (11-internal) -->\n")))))))
#t)))))
(inputs (inputs
`(("alsa-lib" ,alsa-lib) `(("alsa-lib" ,alsa-lib)
("cups" ,cups) ("cups" ,cups)