Opened 10 years ago
Last modified 10 years ago
#43145 closed defect
Perl PortGroup fails to reinplace non-ascii Makefiles — at Version 4
Reported by: | mojca (Mojca Miklavec) | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.2.1 |
Keywords: | Cc: | dluke@…, cal@…, and.damore@…, egall@… | |
Port: | p5-test-base p5-yaml |
Description (last modified by anddam (Andrea D'Amore))
When building p5-yaml on 10.8 and 10.9, sed fails with
DEBUG: Executing reinplace: /usr/bin/sed {/^CCFLAGS *=/s/$/ /} < /opt/local/var/macports/build/_opt_mports_dports_perl_p5-yaml/p5.16-yaml/work/YAML-0.90/Makefile >@ file14 DEBUG: sed: RE error: illegal byte sequence
(see https://build.macports.org/builders/buildports-mavericks-x86_64/builds/2454) because the Makefile
contains a non-ascii character (in Latin 1 encoding, invalid UTF).
This comes from the perl PortGroup:
# CCFLAGS can be passed in to "configure" but it's not necessarily inherited. # LDFLAGS can't be passed in (or if it can, it's not easy to figure out how). post-configure { fs-traverse file ${configure.dir} { if {[file isfile ${file}] && [file tail ${file}] eq "Makefile"} { ui_info "Fixing flags in [string map "${configure.dir}/ {}" ${file}]" reinplace "/^CCFLAGS *=/s/$/ [get_canonical_archflags cc]/" ${file} reinplace "/^OTHERLDFLAGS *=/s/$/ [get_canonical_archflags ld]/" ${file} } } }
Suggestions from IRC:
neverpanic:
set LC_ALL to C I think that's a common issue with ill-formatted UTF-8 files /usr/bin/sed changed on 10.8 and above You can either patch that to be valid UTF-8 or set configure.env LC_ALL=C in the Portfile It is kind of weird to use the locale settings for that. I mean you could set the correct locale for the file, but then any messages to your terminal would be broken…
Dar1us:
it refuses to process files which aren't validly encoded given the current LC settings .. and by default that is UTF-8
Change History (4)
comment:1 Changed 10 years ago by cooljeanius (Eric Gallager)
Cc: | egall@… added |
---|
comment:2 Changed 10 years ago by mojca (Mojca Miklavec)
Port: | p5-test-base added |
---|
comment:3 Changed 10 years ago by danielluke (Daniel J. Luke)
see also: https://lists.macosforge.org/pipermail/macports-dev/2012-August/019993.html
(yes the perl portgroup should be updated)
comment:4 Changed 10 years ago by anddam (Andrea D'Amore)
Description: | modified (diff) |
---|
The portgroup cannot possibly know what encoding will the produced Makefile use.
Port p5-yaml is using ExtUtils::MakeMaker that in turn relies on Pod::Man. Pod::Man can produce utf8 Makefiles, search utf8 in in this page but seems that MakeMaker doesn't have any option to specify that, see this request.
Since the portgroup is patching Makefiles we could sanitize the file by adding a new variable specifying a charset to convert from. In this case the portfile writer would specify something like
perl5.makefile_encoding iso8859-1 perl5.setup YAML 0.90
and the post-configure phase would take care of convert the file to UTF-8 (or any other target encoding depending on the darwin release) before reinplaces.
Cc Me!