Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildPerlPackage: fix patchShebangs when cross-compiling #95623

Merged
merged 2 commits into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pkgs/development/interpreters/perl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let

# TODO: Add a "dev" output containing the header files.
outputs = [ "out" "man" "devdoc" ] ++
optional crossCompiling "dev";
optional crossCompiling "mini";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly over paranoid, but might be nice to add a comment here that if we add a "mini" output to non-cross perl in the future we may want to check perl-modules/generic/default.nix to ensure it's still correct.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming mini to miniperl would make it more clear imho.

setOutputFlags = false;

disallowedReferences = [ stdenv.cc ];
Expand Down Expand Up @@ -144,13 +144,13 @@ let
--replace "$man" /no-such-path
'' + optionalString crossCompiling
''
mkdir -p $dev/lib/perl5/cross_perl/${version}
mkdir -p $mini/lib/perl5/cross_perl/${version}
for dir in cnf/{stub,cpan}; do
cp -r $dir/* $dev/lib/perl5/cross_perl/${version}
cp -r $dir/* $mini/lib/perl5/cross_perl/${version}
done

mkdir -p $dev/bin
install -m755 miniperl $dev/bin/perl
mkdir -p $mini/bin
install -m755 miniperl $mini/bin/perl

export runtimeArch="$(ls $out/lib/perl5/site_perl/${version})"
# wrapProgram should use a runtime-native SHELL by default, but
Expand All @@ -161,9 +161,9 @@ let
# 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 $dev/lib/perl5/cross_perl/${version}.
wrapProgram $dev/bin/perl --prefix PERL5LIB : \
"$dev/lib/perl5/cross_perl/${version}:$out/lib/perl5/${version}:$out/lib/perl5/${version}/$runtimeArch"
# into $mini/lib/perl5/cross_perl/${version}.
wrapProgram $mini/bin/perl --prefix PERL5LIB : \
"$mini/lib/perl5/cross_perl/${version}:$out/lib/perl5/${version}:$out/lib/perl5/${version}/$runtimeArch"
''; # */

meta = {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/perl-modules/generic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ toPerlModule(stdenv.mkDerivation (
version = lib.getVersion attrs; # TODO: phase-out `attrs.name`
builder = ./builder.sh;
buildInputs = buildInputs ++ [ perl ];
nativeBuildInputs = nativeBuildInputs ++ [ (perl.dev or perl) ];
nativeBuildInputs = nativeBuildInputs ++ [ (perl.mini or perl) ];
fullperl = buildPerl;
}
))