* [PATCH] gnu: icedtea: Patch dynamically loaded libraries with absolute paths.
@ 2016-09-08 15:34 宋文武
2016-09-10 1:31 ` [PATCH] gnu: icedtea-8: Hardcode dynamically loaded libraries 宋文武
0 siblings, 1 reply; 5+ messages in thread
From: 宋文武 @ 2016-09-08 15:34 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 101 bytes --]
I think this will fix the fontconfig issue (eg: #24327).
Not tested (build) any jdk version yet...
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-icedtea-Patch-dynamically-loaded-libraries-with-.patch --]
[-- Type: text/x-patch, Size: 2364 bytes --]
From 3dbe71f7cd7b99851bd616f1ab6e1269f1fc6e2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
Date: Thu, 8 Sep 2016 23:25:23 +0800
Subject: [PATCH] gnu: icedtea: Patch dynamically loaded libraries with
absolute paths.
* gnu/packages/java.scm (icedtea-6)[arguments]: Add 'patch-jni-libs' phase.
---
gnu/packages/java.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 7387235..932ecc5 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -525,6 +525,32 @@ build process and its dependencies, whereas Make uses Makefile format.")
(("MZ=MZM;2006-06-30-22-00-00;MZN") "MZ=MZN")
(("RO=ROL;2005-06-30-21-00-00;RON") "RO=RON")
(("TR=TRL;2004-12-31-22-00-00;TRY") "TR=TRY")))))
+ (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)))
(add-before 'configure 'set-additional-paths
(lambda* (#:key inputs #:allow-other-keys)
(let* ((gcjdir (assoc-ref %build-inputs "gcj"))
--
2.8.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] gnu: icedtea-8: Hardcode dynamically loaded libraries.
2016-09-08 15:34 [PATCH] gnu: icedtea: Patch dynamically loaded libraries with absolute paths 宋文武
@ 2016-09-10 1:31 ` 宋文武
2016-09-13 11:25 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: 宋文武 @ 2016-09-10 1:31 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 316 bytes --]
The previous patch failed with icedtea-6, which has uncatched
'decoding-error' in addition to 'encoding-error'.
And it seems that only icedtea-8 needs patch, since in icedtea-7
the USE_SYSTEM_GTK, USE_SYSTEM_FONTCONFIG, etc make it links with
those libraries instead of dlopen them.
So, now only patch icedtea-8:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-icedtea-8-Hardcode-dynamically-loaded-libraries.patch --]
[-- Type: text/x-patch, Size: 2416 bytes --]
From 1d0dce6f0c40fa35162ecb441b53b32f77dd5b8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
Date: Thu, 8 Sep 2016 23:25:23 +0800
Subject: [PATCH] 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.
---
gnu/packages/java.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 7387235..36c10d0 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)
--
2.8.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] gnu: icedtea-8: Hardcode dynamically loaded libraries.
2016-09-10 1:31 ` [PATCH] gnu: icedtea-8: Hardcode dynamically loaded libraries 宋文武
@ 2016-09-13 11:25 ` Ludovic Courtès
2016-09-14 9:05 ` 宋文武
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2016-09-13 11:25 UTC (permalink / raw)
To: 宋文武; +Cc: guix-devel
iyzsong@member.fsf.org (宋文武) skribis:
> From 1d0dce6f0c40fa35162ecb441b53b32f77dd5b8d Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
> Date: Thu, 8 Sep 2016 23:25:23 +0800
> Subject: [PATCH] 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.
I’m a bit late, but thanks for fixing it!
> + (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))))
What often works in such cases is to force ISO-8859-1 encoding
(“Latin-1”), which is a “catch-all” encoding (it’s an 8-bit encoding
that covers the 256 values):
(with-fluids ((%default-port-encoding "ISO-8859-1"))
(substitute* file-in-arbitrary-ascii-compatible-encoding
…))
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gnu: icedtea-8: Hardcode dynamically loaded libraries.
2016-09-13 11:25 ` Ludovic Courtès
@ 2016-09-14 9:05 ` 宋文武
2016-09-14 14:50 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: 宋文武 @ 2016-09-14 9:05 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
ludo@gnu.org (Ludovic Courtès) writes:
> [...]
>
>> + (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))))
>
> What often works in such cases is to force ISO-8859-1 encoding
> (“Latin-1”), which is a “catch-all” encoding (it’s an 8-bit encoding
> that covers the 256 values):
>
> (with-fluids ((%default-port-encoding "ISO-8859-1"))
> (substitute* file-in-arbitrary-ascii-compatible-encoding
> …))
>
Yeah, I tried that, but it was also producing 'encoding-error' in the
builder, so I gave up it.
It seems that's because the locale is "C" when calling `substitute*',
and the files have UTF-8 copyright sign (©). But out of the builder,
the `substitute*' works fine even with '(setlocale LC_ALL "C")'.
Here is an example:
--8<---------------cut here---------------start------------->8---
(use-modules (guix packages)
(guix build-system gnu))
(package
(name "test")
(version "0")
(source #f)
(build-system gnu-build-system)
(arguments
'(#:phases
(modify-phases %standard-phases
(replace 'unpack
(lambda _
(setlocale LC_ALL "en_US.utf8")
(call-with-output-file "test"
(lambda (port)
(display "©" port)))
(setlocale LC_ALL "C")
(with-fluids ((%default-port-encoding #f))
(substitute* "test"
(("t") ""))))))))
(home-page #f)
(synopsis #f)
(description #f)
(license #f))
--8<---------------cut here---------------end--------------->8---
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gnu: icedtea-8: Hardcode dynamically loaded libraries.
2016-09-14 9:05 ` 宋文武
@ 2016-09-14 14:50 ` Ludovic Courtès
0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2016-09-14 14:50 UTC (permalink / raw)
To: 宋文武; +Cc: guix-devel
iyzsong@member.fsf.org (宋文武) skribis:
> ludo@gnu.org (Ludovic Courtès) writes:
[...]
>> What often works in such cases is to force ISO-8859-1 encoding
>> (“Latin-1”), which is a “catch-all” encoding (it’s an 8-bit encoding
>> that covers the 256 values):
>>
>> (with-fluids ((%default-port-encoding "ISO-8859-1"))
>> (substitute* file-in-arbitrary-ascii-compatible-encoding
>> …))
>>
>
> Yeah, I tried that, but it was also producing 'encoding-error' in the
> builder, so I gave up it.
>
> It seems that's because the locale is "C" when calling `substitute*',
Weird; the ‘install-locale’ phase normally installs a UTF-8 locale, and
the locale shouldn’t matter once we’re overridden
‘%default-port-encoding’.
> and the files have UTF-8 copyright sign (©). But out of the builder,
> the `substitute*' works fine even with '(setlocale LC_ALL "C")'.
Hmm, OK. Subtle things going on. :-)
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-09-14 14:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-08 15:34 [PATCH] gnu: icedtea: Patch dynamically loaded libraries with absolute paths 宋文武
2016-09-10 1:31 ` [PATCH] gnu: icedtea-8: Hardcode dynamically loaded libraries 宋文武
2016-09-13 11:25 ` Ludovic Courtès
2016-09-14 9:05 ` 宋文武
2016-09-14 14:50 ` Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.