guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnu: icedtea-8: Hardcode dynamically loaded libraries.


From: 宋文武
Subject: Re: [PATCH] gnu: icedtea-8: Hardcode dynamically loaded libraries.
Date: Wed, 14 Sep 2016 17:05:17 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

address@hidden (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---



reply via email to

[Prev in Thread] Current Thread [Next in Thread]