From: iyzsong@member.fsf.org (宋文武)
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] gnu: icedtea-8: Hardcode dynamically loaded libraries.
Date: Wed, 14 Sep 2016 17:05:17 +0800 [thread overview]
Message-ID: <8737l2rgvm.fsf@member.fsf.org> (raw)
In-Reply-To: <874m5k82j8.fsf@gnu.org> ("Ludovic Courtès"'s message of "Tue, 13 Sep 2016 13:25:31 +0200")
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---
next prev parent reply other threads:[~2016-09-14 9:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` 宋文武 [this message]
2016-09-14 14:50 ` Ludovic Courtès
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8737l2rgvm.fsf@member.fsf.org \
--to=iyzsong@member.fsf.org \
--cc=guix-devel@gnu.org \
--cc=ludo@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 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.