guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: gnu: openjdk@9 : Add phase to hardcode libraries.


From: guix-commits
Subject: 01/03: gnu: openjdk@9 : Add phase to hardcode libraries.
Date: Fri, 12 Feb 2021 05:47:47 -0500 (EST)

leoprikler pushed a commit to branch master
in repository guix.

commit 84805ef205b7fa12bfaa7b23da06993cab64c40b
Author: Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
AuthorDate: Fri Feb 12 00:20:16 2021 +0100

    gnu: openjdk@9 : Add phase to hardcode libraries.
    
    This fixes a NullPointerException related to using fontconfig,
    see also <https://bugs.gnu.org/41177>.
    
    * gnu/packages/java.scm (openjdk9)[arguments]: Add patch-jni-libs phase.
    
    Signed-off-by: Leo Prikler <leo.prikler@student.tugraz.at>
---
 gnu/packages/java.scm | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index d6afb2e..a63dad8 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -10,7 +10,7 @@
 ;;; Copyright © 2018, 2019 Gábor Boskovits <boskovits@gmail.com>
 ;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com>
 ;;; Copyright © 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2019, 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
+;;; Copyright © 2019, 2020, 2021 Björn Höfling 
<bjoern.hoefling@bjoernhoefling.de>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
@@ -1928,6 +1928,33 @@ new Date();"))
                                                  (number->string 
(parallel-job-count))))
                             '())
                       ,@make-flags))))
+         (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 'decoding-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 "."
+                            "\\.c$|\\.h$"))
+               #t)))
          ;; Some of the libraries in the lib/ folder link to libjvm.so.
          ;; But that shared object is located in the server/ folder, so it
          ;; cannot be found.  This phase creates a symbolic link in the



reply via email to

[Prev in Thread] Current Thread [Next in Thread]