-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perlPackages: Add cross-compilation support.
This involved: * Installing miniperl as $dev/bin/perl * Setting miniperl to take INC from lib/perl5/{site_perl/,}cross_perl/${version} as well as lib/perl5/{site_perl/,}/${version}/${runtimeArch}, in that order. miniperl taking from runtimeArch is not really correct, but it works in some pure-perl cases (e.g. Config.pm) and can be overridden with the cross_perl variant. * Installing perl-cross's stubs into $dev/lib/perl5/cross_perl/${version} * Patching MakeMaker.pm to gracefully degrade (very slightly) if B.pm can't be loaded, which it can't in cross-compilation. * Passing the right build-time and runtime perls to Makefile.PL
- Loading branch information
Showing
6 changed files
with
81 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
diff -Naur a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm | ||
--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm 2017-06-30 17:03:20.000000000 -0400 | ||
+++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm 2018-02-28 10:06:37.031237946 -0500 | ||
@@ -1267,7 +1267,12 @@ | ||
my $value = shift; | ||
return $value if $UNDER_CORE; | ||
my $tvalue = ''; | ||
- require B; | ||
+ eval { | ||
+ require B; | ||
+ }; | ||
+ if ($@) { | ||
+ return $tvalue; | ||
+ } | ||
my $sv = B::svref_2object(\$value); | ||
my $magic = ref($sv) eq 'B::PVMG' ? $sv->MAGIC : undef; | ||
while ( $magic ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
addPerlLibPath () { | ||
addToSearchPath PERL5LIB $1/lib/perl5/site_perl/@version@ | ||
addToSearchPath PERL5LIB $1/lib/perl5/site_perl/cross_perl/@version@ | ||
# Adding the arch-specific directory is morally incorrect, as | ||
# miniperl can't load the native modules there. However, it can | ||
# (and sometimes needs to) load and run some of the pure perl | ||
# code there, so we add it anyway. When needed, stubs can be put | ||
# into $1/lib/perl5/site_perl/cross_perl/@version@ | ||
addToSearchPath PERL5LIB $1/lib/perl5/site_perl/@version@/@runtimeArch@ | ||
} | ||
|
||
addEnvHooks "$targetOffset" addPerlLibPath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
306d5cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit broke
perlPackages.YAMLLibYAML
(and maybe some others). I don't yet know why exactly. Any immediate ideas?306d5cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I got to this because it's one of channel blockers, and we haven't had nixos-unstable bump for almost two weeks now.
306d5cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh I've seen this before and it makes no sense to me. See 89700d7 for an example. Any ideas on the root cause would be greatly appreciated, if you're unable to dig in can you open an issue and assign me?
306d5cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have bisected MakeMaker to find that this behavior was introduced in Perl-Toolchain-Gang/ExtUtils-MakeMaker@5dd48b9#diff-ff7d608c3c78066201e5518f660406eaR627:
https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/blob/5dd48b9ca77e3b8982205dd168b2a0e28526a901/lib/ExtUtils/MakeMaker.pm#L624-L627 (and has not changed since).
It seems that they expect that you pass the value quoted, i.e.
perl Makefile.PL FULLPERL=\"$perl/bin/perl\"
. Nevertheless, this looks like a bug.306d5cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. @vcunat Can you test with the quotes passed? If not I'll try to take a look this evening. In any case we should open up a bug report.
Thanks @orivej !
306d5cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vcunat Fixed on staging: ab42a75
306d5cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @mohawk2 as the author of that commit who may be interested in this issue.
306d5cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expectation in EUMM is that all the
PERL
variables will be double-quote-wrapped, in case they have spaces in. Perhaps this should be documented. In any case, if you choose to override the value that EUMM creates (I don't know why you would but I assume a good reason), then you should pass in a double-quote-wrapped value.306d5cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mohawk2 Thanks! We're overriding to support cross-compilation, where
perl
in$PATH
is a build-nativeperl
but we want to link against a host-nativeperl
306d5cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shlevy The first one. It's the quotes that are double, not the wrapping :-)
306d5cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, realized after I posted and edited my comment π