From mboxrd@z Thu Jan 1 00:00:00 1970 From: iyzsong@member.fsf.org (=?utf-8?B?5a6L5paH5q2m?=) Subject: Re: [PATCH] gnu: icedtea-8: Hardcode dynamically loaded libraries. Date: Wed, 14 Sep 2016 17:05:17 +0800 Message-ID: <8737l2rgvm.fsf@member.fsf.org> References: <87zini4d8h.fsf@member.fsf.org> <871t0sy206.fsf@member.fsf.org> <874m5k82j8.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bk68D-0003ef-DW for guix-devel@gnu.org; Wed, 14 Sep 2016 05:05:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bk688-00015f-88 for guix-devel@gnu.org; Wed, 14 Sep 2016 05:05:24 -0400 Received: from smtp6.openmailbox.org ([62.4.1.40]:58854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bk688-000158-2k for guix-devel@gnu.org; Wed, 14 Sep 2016 05:05:20 -0400 In-Reply-To: <874m5k82j8.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Tue, 13 Sep 2016 13:25:31 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org ludo@gnu.org (Ludovic Court=C3=A8s) 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 > (=E2=80=9CLatin-1=E2=80=9D), which is a =E2=80=9Ccatch-all=E2=80=9D encod= ing (it=E2=80=99s an 8-bit encoding > that covers the 256 values): > > (with-fluids ((%default-port-encoding "ISO-8859-1")) > (substitute* file-in-arbitrary-ascii-compatible-encoding > =E2=80=A6)) > 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 (=C2=A9). 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 "=C2=A9" 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---