diff options
| author | Ricardo Wurmus <rekado@elephly.net> | 2016-07-08 11:28:59 +0200 |
|---|---|---|
| committer | Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> | 2016-07-22 17:10:25 +0200 |
| commit | f21403e2b6f5a9491937a0cc9f31fc113998ce5e (patch) | |
| tree | 69a38cd411ee8c3493ab689ef8a1f5d3fbbef8fb /gnu/packages/java.scm | |
| parent | 9bc84dfea9560c497c91863e7b5021860bd3c254 (diff) | |
gnu: icedtea-6: Generate keystore.
* gnu/packages/java.scm (icedtea-6)[arguments]: Add phase
"install-keystore".
[native-inputs]: Add nss-certs.
Diffstat (limited to 'gnu/packages/java.scm')
| -rw-r--r-- | gnu/packages/java.scm | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index faa6e5bc1ce..2d50ad84fae 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #:use-module (gnu packages autotools) | 30 | #:use-module (gnu packages autotools) |
| 31 | #:use-module (gnu packages base) | 31 | #:use-module (gnu packages base) |
| 32 | #:use-module (gnu packages bash) | 32 | #:use-module (gnu packages bash) |
| 33 | #:use-module (gnu packages certs) | ||
| 33 | #:use-module (gnu packages cpio) | 34 | #:use-module (gnu packages cpio) |
| 34 | #:use-module (gnu packages cups) | 35 | #:use-module (gnu packages cups) |
| 35 | #:use-module (gnu packages compression) | 36 | #:use-module (gnu packages compression) |
| @@ -262,7 +263,8 @@ build process and its dependencies, whereas Make uses Makefile format.") | |||
| 262 | #:modules ((guix build utils) | 263 | #:modules ((guix build utils) |
| 263 | (guix build gnu-build-system) | 264 | (guix build gnu-build-system) |
| 264 | (ice-9 popen) | 265 | (ice-9 popen) |
| 265 | (ice-9 rdelim)) | 266 | (ice-9 rdelim) |
| 267 | (srfi srfi-19)) | ||
| 266 | 268 | ||
| 267 | #:configure-flags | 269 | #:configure-flags |
| 268 | (let* ((gcjdir (assoc-ref %build-inputs "gcj")) | 270 | (let* ((gcjdir (assoc-ref %build-inputs "gcj")) |
| @@ -521,7 +523,47 @@ build process and its dependencies, whereas Make uses Makefile format.") | |||
| 521 | (jdk (assoc-ref outputs "jdk"))) | 523 | (jdk (assoc-ref outputs "jdk"))) |
| 522 | (copy-recursively "openjdk.build/docs" doc) | 524 | (copy-recursively "openjdk.build/docs" doc) |
| 523 | (copy-recursively "openjdk.build/j2re-image" jre) | 525 | (copy-recursively "openjdk.build/j2re-image" jre) |
| 524 | (copy-recursively "openjdk.build/j2sdk-image" jdk))))))) | 526 | (copy-recursively "openjdk.build/j2sdk-image" jdk)))) |
| 527 | ;; By default IcedTea only generates an empty keystore. In order to | ||
| 528 | ;; be able to use certificates in Java programs we need to generate a | ||
| 529 | ;; keystore from a set of certificates. For convenience we use the | ||
| 530 | ;; certificates from the nss-certs package. | ||
| 531 | (add-after 'install 'install-keystore | ||
| 532 | (lambda* (#:key inputs outputs #:allow-other-keys) | ||
| 533 | (let* ((keystore "cacerts") | ||
| 534 | (certs-dir (string-append (assoc-ref inputs "nss-certs") | ||
| 535 | "/etc/ssl/certs")) | ||
| 536 | (keytool (string-append (assoc-ref outputs "jdk") | ||
| 537 | "/bin/keytool"))) | ||
| 538 | (define (import-cert cert) | ||
| 539 | (format #t "Importing certificate ~a\n" (basename cert)) | ||
| 540 | (let* ((port (open-pipe* OPEN_WRITE keytool | ||
| 541 | "-import" | ||
| 542 | "-alias" (basename cert) | ||
| 543 | "-keystore" keystore | ||
| 544 | "-storepass" "changeit" | ||
| 545 | "-file" cert))) | ||
| 546 | (display "yes\n" port) | ||
| 547 | (when (not (zero? (status:exit-val (close-pipe port)))) | ||
| 548 | (error "failed to import" cert)))) | ||
| 549 | |||
| 550 | ;; This is necessary because the certificate directory contains | ||
| 551 | ;; files with non-ASCII characters in their names. | ||
| 552 | (setlocale LC_ALL "en_US.utf8") | ||
| 553 | (setenv "LC_ALL" "en_US.utf8") | ||
| 554 | |||
| 555 | (for-each import-cert (find-files certs-dir "\\.pem$")) | ||
| 556 | (mkdir-p (string-append (assoc-ref outputs "out") | ||
| 557 | "/lib/security")) | ||
| 558 | (mkdir-p (string-append (assoc-ref outputs "jdk") | ||
| 559 | "/jre/lib/security")) | ||
| 560 | (install-file keystore | ||
| 561 | (string-append (assoc-ref outputs "out") | ||
| 562 | "/lib/security")) | ||
| 563 | (install-file keystore | ||
| 564 | (string-append (assoc-ref outputs "jdk") | ||
| 565 | "/jre/lib/security")) | ||
| 566 | #t)))))) | ||
| 525 | (native-inputs | 567 | (native-inputs |
| 526 | `(("ant" ,ant) | 568 | `(("ant" ,ant) |
| 527 | ("alsa-lib" ,alsa-lib) | 569 | ("alsa-lib" ,alsa-lib) |
| @@ -544,6 +586,7 @@ build process and its dependencies, whereas Make uses Makefile format.") | |||
| 544 | ("libxslt" ,libxslt) ;for xsltproc | 586 | ("libxslt" ,libxslt) ;for xsltproc |
| 545 | ("mit-krb5" ,mit-krb5) | 587 | ("mit-krb5" ,mit-krb5) |
| 546 | ("nss" ,nss) | 588 | ("nss" ,nss) |
| 589 | ("nss-certs" ,nss-certs) | ||
| 547 | ("libx11" ,libx11) | 590 | ("libx11" ,libx11) |
| 548 | ("libxcomposite" ,libxcomposite) | 591 | ("libxcomposite" ,libxcomposite) |
| 549 | ("libxt" ,libxt) | 592 | ("libxt" ,libxt) |
| @@ -789,6 +832,9 @@ build process and its dependencies, whereas Make uses Makefile format.") | |||
| 789 | (delete 'patch-paths) | 832 | (delete 'patch-paths) |
| 790 | (delete 'set-additional-paths) | 833 | (delete 'set-additional-paths) |
| 791 | (delete 'patch-patches) | 834 | (delete 'patch-patches) |
| 835 | ;; FIXME: This phase is needed but fails with this version of | ||
| 836 | ;; IcedTea. | ||
| 837 | (delete 'install-keystore) | ||
| 792 | (replace 'install | 838 | (replace 'install |
| 793 | (lambda* (#:key outputs #:allow-other-keys) | 839 | (lambda* (#:key outputs #:allow-other-keys) |
| 794 | (let ((doc (string-append (assoc-ref outputs "doc") | 840 | (let ((doc (string-append (assoc-ref outputs "doc") |
