summary refs log tree commit diff
path: root/pkgs/development/interpreters/perl/setup-hook-cross.sh
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2018-02-28 12:00:03 -0500
committerShea Levy <shea@shealevy.com>2018-02-28 15:01:32 -0500
commit306d5cdf03ad6375861a20b8885ef38699ca3c23 (patch)
treee117b9fbf1c63aa95a92efd8e47204d694527cf0 /pkgs/development/interpreters/perl/setup-hook-cross.sh
parent8e6520540e6ab0ce5d265cf4bcf68bf8e4ec64a5 (diff)
downloadnixpkgs-306d5cdf03ad6375861a20b8885ef38699ca3c23.tar
nixpkgs-306d5cdf03ad6375861a20b8885ef38699ca3c23.tar.gz
nixpkgs-306d5cdf03ad6375861a20b8885ef38699ca3c23.tar.bz2
nixpkgs-306d5cdf03ad6375861a20b8885ef38699ca3c23.tar.lz
nixpkgs-306d5cdf03ad6375861a20b8885ef38699ca3c23.tar.xz
nixpkgs-306d5cdf03ad6375861a20b8885ef38699ca3c23.tar.zst
nixpkgs-306d5cdf03ad6375861a20b8885ef38699ca3c23.zip
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
Diffstat (limited to 'pkgs/development/interpreters/perl/setup-hook-cross.sh')
-rw-r--r--pkgs/development/interpreters/perl/setup-hook-cross.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/perl/setup-hook-cross.sh b/pkgs/development/interpreters/perl/setup-hook-cross.sh
new file mode 100644
index 00000000000..95aae0b2670
--- /dev/null
+++ b/pkgs/development/interpreters/perl/setup-hook-cross.sh
@@ -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