perl merge fixup
This commit is contained in:
parent
09af15654f
commit
b291f1682f
@ -17,7 +17,8 @@ assert enableThreading -> (stdenv ? glibc);
|
|||||||
let
|
let
|
||||||
|
|
||||||
libc = if stdenv.cc.libc or null != null then stdenv.cc.libc else "/usr";
|
libc = if stdenv.cc.libc or null != null then stdenv.cc.libc else "/usr";
|
||||||
|
libcInc = libc.dev or libc;
|
||||||
|
libcLib = libc.out or libc;
|
||||||
common = { version, sha256 }: stdenv.mkDerivation rec {
|
common = { version, sha256 }: stdenv.mkDerivation rec {
|
||||||
name = "perl-${version}";
|
name = "perl-${version}";
|
||||||
|
|
||||||
@ -26,7 +27,9 @@ let
|
|||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = [ "out" "man" ];
|
# TODO: Add a "dev" output containing the header files.
|
||||||
|
outputs = [ "out" "man" "docdev" ];
|
||||||
|
setOutputFlags = false;
|
||||||
|
|
||||||
patches =
|
patches =
|
||||||
[ # Do not look in /usr etc. for dependencies.
|
[ # Do not look in /usr etc. for dependencies.
|
||||||
@ -35,17 +38,11 @@ let
|
|||||||
++ optional stdenv.isSunOS ./ld-shared.patch
|
++ optional stdenv.isSunOS ./ld-shared.patch
|
||||||
++ optional stdenv.isDarwin [ ./cpp-precomp.patch ];
|
++ optional stdenv.isDarwin [ ./cpp-precomp.patch ];
|
||||||
|
|
||||||
# There's an annoying bug on sandboxed Darwin in Perl's Cwd.pm where it looks for pwd
|
postPatch = ''
|
||||||
# in /bin/pwd and /usr/bin/pwd and then falls back on just "pwd" if it can't get them
|
|
||||||
# while at the same time erasing the PATH environment variable so it unconditionally
|
|
||||||
# fails. The code in question is guarded by a check for Mac OS, but the patch below
|
|
||||||
# doesn't have any runtime effect on other platforms.
|
|
||||||
postPatch = optional stdenv.isDarwin ''
|
|
||||||
pwd="$(type -P pwd)"
|
pwd="$(type -P pwd)"
|
||||||
substituteInPlace dist/PathTools/Cwd.pm \
|
substituteInPlace dist/PathTools/Cwd.pm \
|
||||||
--replace "/bin/pwd" "$pwd"
|
--replace "/bin/pwd" "$pwd"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
sandboxProfile = sandbox.allow "ipc-sysv-sem";
|
sandboxProfile = sandbox.allow "ipc-sysv-sem";
|
||||||
|
|
||||||
# Build a thread-safe Perl with a dynamic libperls.o. We need the
|
# Build a thread-safe Perl with a dynamic libperls.o. We need the
|
||||||
@ -59,8 +56,8 @@ let
|
|||||||
"-Uinstallusrbinperl"
|
"-Uinstallusrbinperl"
|
||||||
"-Dinstallstyle=lib/perl5"
|
"-Dinstallstyle=lib/perl5"
|
||||||
"-Duseshrplib"
|
"-Duseshrplib"
|
||||||
"-Dlocincpth=${libc}/include"
|
"-Dlocincpth=${libcInc}/include"
|
||||||
"-Dloclibpth=${libc}/lib"
|
"-Dloclibpth=${libcLib}/lib"
|
||||||
]
|
]
|
||||||
++ optional stdenv.isSunOS "-Dcc=gcc"
|
++ optional stdenv.isSunOS "-Dcc=gcc"
|
||||||
++ optional enableThreading "-Dusethreads";
|
++ optional enableThreading "-Dusethreads";
|
||||||
@ -74,10 +71,8 @@ let
|
|||||||
preConfigure =
|
preConfigure =
|
||||||
''
|
''
|
||||||
configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
|
configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
|
||||||
|
'' + optionalString stdenv.isArm ''
|
||||||
${optionalString stdenv.isArm ''
|
|
||||||
configureFlagsArray=(-Dldflags="-lm -lrt")
|
configureFlagsArray=(-Dldflags="-lm -lrt")
|
||||||
''}
|
|
||||||
'' + optionalString stdenv.isDarwin ''
|
'' + optionalString stdenv.isDarwin ''
|
||||||
substituteInPlace hints/darwin.sh --replace "env MACOSX_DEPLOYMENT_TARGET=10.3" ""
|
substituteInPlace hints/darwin.sh --replace "env MACOSX_DEPLOYMENT_TARGET=10.3" ""
|
||||||
'' + optionalString (!enableThreading) ''
|
'' + optionalString (!enableThreading) ''
|
||||||
@ -91,18 +86,26 @@ let
|
|||||||
substituteInPlace dist/PathTools/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"
|
substituteInPlace dist/PathTools/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Inspired by nuke-references, which I can't depend on because it uses perl. Perhaps it should just use sed :)
|
|
||||||
postInstall = ''
|
|
||||||
self=$(echo $out | sed -n "s|^$NIX_STORE/\\([a-z0-9]\{32\}\\)-.*|\1|p")
|
|
||||||
|
|
||||||
sed -i "/$self/b; s|$NIX_STORE/[a-z0-9]\{32\}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" "$out"/lib/perl5/*/*/Config.pm
|
|
||||||
sed -i "/$self/b; s|$NIX_STORE/[a-z0-9]\{32\}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" "$out"/lib/perl5/*/*/Config_heavy.pl
|
|
||||||
'';
|
|
||||||
|
|
||||||
setupHook = ./setup-hook.sh;
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
passthru.libPrefix = "lib/perl5/site_perl";
|
passthru.libPrefix = "lib/perl5/site_perl";
|
||||||
|
|
||||||
|
# TODO: it seems like absolute paths to some coreutils is required.
|
||||||
|
postInstall =
|
||||||
|
''
|
||||||
|
# Remove dependency between "out" and "man" outputs.
|
||||||
|
rm "$out"/lib/perl5/*/*/.packlist
|
||||||
|
|
||||||
|
# Remove dependencies on glibc and gcc
|
||||||
|
sed "/ *libpth =>/c libpth => ' '," \
|
||||||
|
-i "$out"/lib/perl5/*/*/Config.pm
|
||||||
|
# TODO: removing those paths would be cleaner than overwriting with nonsense.
|
||||||
|
substituteInPlace "$out"/lib/perl5/*/*/Config_heavy.pl \
|
||||||
|
--replace "${libcInc}" /no-such-path \
|
||||||
|
--replace "${stdenv.cc.cc or "/no-such-path"}" /no-such-path \
|
||||||
|
--replace "$man" /no-such-path
|
||||||
|
''; # */
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = https://www.perl.org/;
|
homepage = https://www.perl.org/;
|
||||||
description = "The standard implementation of the Perl 5 programmming language";
|
description = "The standard implementation of the Perl 5 programmming language";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user