unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Björn Höfling" <bjoern.hoefling@bjoernhoefling.de>
To: 46451@debbugs.gnu.org
Subject: [bug#46451] [PATCH 2/2] gnu: openjdk11: Add phase to hardcode libraries.
Date: Fri, 12 Feb 2021 00:20:53 +0100	[thread overview]
Message-ID: <20210212002053.30ef8ea9@alma-ubu.fritz.box> (raw)
In-Reply-To: <20210212001405.48cabc72@alma-ubu.fritz.box>

[-- Attachment #1: Type: text/plain, Size: 2220 bytes --]

* gnu/packages/java.scm (openjdk11)[arguments]: Add patch-jni-libs phase.

    This fixes a NullPointerException related to using fontconfig
    reported by Jonathan Frederickson <jonathan@terracrypt.net>
    in <https://bugs.gnu.org/41177>.
---
 gnu/packages/java.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index a63dad8755..85ca37d8b6 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2139,6 +2139,33 @@ new Date();"))
              (substitute* "make/data/blacklistedcertsconverter/blacklisted.certs.pem"
                (("^#!.*") "#! java BlacklistedCertsConverter SHA-256\n"))
              #t))
+         (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)))
          (add-before 'build 'write-source-revision-file
            (lambda _
              (with-output-to-file ".src-rev"
-- 
2.27.0


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

      parent reply	other threads:[~2021-02-11 23:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11 23:14 [bug#46451] [PATCH 0/2] OpenJDK: Fix NullPointerException when accessing fonts Björn Höfling
2021-02-11 23:20 ` [bug#46451] [PATCH 1/2] gnu: openjdk@9 : Add phase to hardcode libraries Björn Höfling
2021-02-11 23:20 ` Björn Höfling [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210212002053.30ef8ea9@alma-ubu.fritz.box \
    --to=bjoern.hoefling@bjoernhoefling.de \
    --cc=46451@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).