summary refs log tree commit diff
diff options
context:
space:
mode:
author宋文武 <iyzsong@gmail.com>2016-09-08 23:25:23 +0800
committer宋文武 <iyzsong@gmail.com>2016-09-11 10:10:11 +0800
commitcab1760de21938172494a05f93f3848840717852 (patch)
tree6aa61c886baac93d5eb26f269164cdc2e6b8442d
parentdd4476214c585f3ecf8157212d6eca1f637ef831 (diff)
downloadguix-cab1760de21938172494a05f93f3848840717852.tar.gz
gnu: icedtea-8: Hardcode dynamically loaded libraries.
Fixes <https://bugs.gnu.org/24327>.

* gnu/packages/java.scm (icedtea-8)[arguments]: Add 'patch-jni-libs' phase.
-rw-r--r--gnu/packages/java.scm27
1 files changed, 27 insertions, 0 deletions
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 7387235c5b..36c10d0fd0 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -994,6 +994,33 @@ build process and its dependencies, whereas Make uses Makefile format.")
              (delete 'patch-paths)
              (delete 'set-additional-paths)
              (delete 'patch-patches)
+             (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 'encoding-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)))
              ;; FIXME: This phase is needed but fails with this version of
              ;; IcedTea.
              (delete 'install-keystore)