summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@zancanaro.id.au>2021-04-20 21:22:20 +1000
committerLudovic Courtès <ludo@gnu.org>2021-05-01 17:12:21 +0200
commit522a48a2280347442fcefdfd68444fd8d108fd6b (patch)
treedc3bf6cd7486fa83b63ccdf9d32a66d005292eea /gnu
parent92b02d0c18a6783c751a5b8b28d6bfbb77184ac7 (diff)
downloadguix-522a48a2280347442fcefdfd68444fd8d108fd6b.tar.gz
gnu: openjdk: Fix library substitution when libraries aren't found.
* gnu/packages/java.scm (icedtea-8, openjdk9, openjdk11)[arguments]:
Change 'find-library' to always return a string.  Change 'find-library'
callers to use 'string-append' rather than 'format'.  Starting from
97a43db8b4416a1450aa61737edba9cf4126cf1c, 'find-library' could return #f
and JNI substitutions would emit a literal "#f".

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/java.scm26
1 files changed, 14 insertions, 12 deletions
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 3c4013ab6f..ae31f5ba42 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1800,9 +1800,10 @@ new Date();"))
                                                   (search-path-as-string->list
                                                    (getenv "LIBRARY_PATH"))))
                             (find-library (lambda (name)
-                                            (search-path
-                                             library-path
-                                             (string-append "lib" name ".so")))))
+                                            (or (search-path
+                                                 library-path
+                                                 (string-append "lib" name ".so"))
+                                                (string-append "lib" name ".so")))))
                        (for-each
                         (lambda (file)
                           (catch 'decoding-error
@@ -1810,9 +1811,9 @@ new Date();"))
                               (substitute* file
                                 (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)"
                                   _ name version)
-                                 (format #f "\"~a\""  (find-library name)))
+                                 (string-append "\"" (find-library name) "\""))
                                 (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name)
-                                 (format #f "\"~a\"" (find-library name)))))
+                                 (string-append "\"" (find-library name) "\""))))
                             (lambda _
                               ;; Those are safe to skip.
                               (format (current-error-port)
@@ -1955,9 +1956,9 @@ new Date();"))
                       (substitute* file
                         (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)"
                           _ name version)
-                         (format #f "\"~a\""  (find-library name)))
+                         (string-append "\"" (find-library name) "\""))
                         (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name)
-                         (format #f "\"~a\"" (find-library name)))))
+                         (string-append "\"" (find-library name) "\""))))
                     (lambda _
                       ;; Those are safe to skip.
                       (format (current-error-port)
@@ -2158,9 +2159,10 @@ new Date();"))
                                           (search-path-as-string->list
                                            (getenv "LIBRARY_PATH"))))
                     (find-library (lambda (name)
-                                    (search-path
-                                     library-path
-                                     (string-append "lib" name ".so")))))
+                                    (or (search-path
+                                         library-path
+                                         (string-append "lib" name ".so"))
+                                        (string-append "lib" name ".so")))))
                (for-each
                 (lambda (file)
                   (catch 'decoding-error
@@ -2168,9 +2170,9 @@ new Date();"))
                       (substitute* file
                         (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)"
                           _ name version)
-                         (format #f "\"~a\""  (find-library name)))
+                         (string-append "\"" (find-library name) "\""))
                         (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name)
-                         (format #f "\"~a\"" (find-library name)))))
+                         (string-append "\"" (find-library name) "\""))))
                     (lambda _
                       ;; Those are safe to skip.
                       (format (current-error-port)