diff options
| author | Carlo Zancanaro <carlo@zancanaro.id.au> | 2021-04-20 21:22:20 +1000 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2021-05-01 17:12:21 +0200 |
| commit | 522a48a2280347442fcefdfd68444fd8d108fd6b (patch) | |
| tree | dc3bf6cd7486fa83b63ccdf9d32a66d005292eea | |
| parent | 92b02d0c18a6783c751a5b8b28d6bfbb77184ac7 (diff) | |
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>
| -rw-r--r-- | gnu/packages/java.scm | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 3c4013ab6fa..ae31f5ba42b 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm | |||
| @@ -1800,9 +1800,10 @@ new Date();")) | |||
| 1800 | (search-path-as-string->list | 1800 | (search-path-as-string->list |
| 1801 | (getenv "LIBRARY_PATH")))) | 1801 | (getenv "LIBRARY_PATH")))) |
| 1802 | (find-library (lambda (name) | 1802 | (find-library (lambda (name) |
| 1803 | (search-path | 1803 | (or (search-path |
| 1804 | library-path | 1804 | library-path |
| 1805 | (string-append "lib" name ".so"))))) | 1805 | (string-append "lib" name ".so")) |
| 1806 | (string-append "lib" name ".so"))))) | ||
| 1806 | (for-each | 1807 | (for-each |
| 1807 | (lambda (file) | 1808 | (lambda (file) |
| 1808 | (catch 'decoding-error | 1809 | (catch 'decoding-error |
| @@ -1810,9 +1811,9 @@ new Date();")) | |||
| 1810 | (substitute* file | 1811 | (substitute* file |
| 1811 | (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)" | 1812 | (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)" |
| 1812 | _ name version) | 1813 | _ name version) |
| 1813 | (format #f "\"~a\"" (find-library name))) | 1814 | (string-append "\"" (find-library name) "\"")) |
| 1814 | (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name) | 1815 | (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name) |
| 1815 | (format #f "\"~a\"" (find-library name))))) | 1816 | (string-append "\"" (find-library name) "\"")))) |
| 1816 | (lambda _ | 1817 | (lambda _ |
| 1817 | ;; Those are safe to skip. | 1818 | ;; Those are safe to skip. |
| 1818 | (format (current-error-port) | 1819 | (format (current-error-port) |
| @@ -1955,9 +1956,9 @@ new Date();")) | |||
| 1955 | (substitute* file | 1956 | (substitute* file |
| 1956 | (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)" | 1957 | (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)" |
| 1957 | _ name version) | 1958 | _ name version) |
| 1958 | (format #f "\"~a\"" (find-library name))) | 1959 | (string-append "\"" (find-library name) "\"")) |
| 1959 | (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name) | 1960 | (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name) |
| 1960 | (format #f "\"~a\"" (find-library name))))) | 1961 | (string-append "\"" (find-library name) "\"")))) |
| 1961 | (lambda _ | 1962 | (lambda _ |
| 1962 | ;; Those are safe to skip. | 1963 | ;; Those are safe to skip. |
| 1963 | (format (current-error-port) | 1964 | (format (current-error-port) |
| @@ -2158,9 +2159,10 @@ new Date();")) | |||
| 2158 | (search-path-as-string->list | 2159 | (search-path-as-string->list |
| 2159 | (getenv "LIBRARY_PATH")))) | 2160 | (getenv "LIBRARY_PATH")))) |
| 2160 | (find-library (lambda (name) | 2161 | (find-library (lambda (name) |
| 2161 | (search-path | 2162 | (or (search-path |
| 2162 | library-path | 2163 | library-path |
| 2163 | (string-append "lib" name ".so"))))) | 2164 | (string-append "lib" name ".so")) |
| 2165 | (string-append "lib" name ".so"))))) | ||
| 2164 | (for-each | 2166 | (for-each |
| 2165 | (lambda (file) | 2167 | (lambda (file) |
| 2166 | (catch 'decoding-error | 2168 | (catch 'decoding-error |
| @@ -2168,9 +2170,9 @@ new Date();")) | |||
| 2168 | (substitute* file | 2170 | (substitute* file |
| 2169 | (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)" | 2171 | (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)" |
| 2170 | _ name version) | 2172 | _ name version) |
| 2171 | (format #f "\"~a\"" (find-library name))) | 2173 | (string-append "\"" (find-library name) "\"")) |
| 2172 | (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name) | 2174 | (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name) |
| 2173 | (format #f "\"~a\"" (find-library name))))) | 2175 | (string-append "\"" (find-library name) "\"")))) |
| 2174 | (lambda _ | 2176 | (lambda _ |
| 2175 | ;; Those are safe to skip. | 2177 | ;; Those are safe to skip. |
| 2176 | (format (current-error-port) | 2178 | (format (current-error-port) |
