2012-09-18 21:12:15 +02:00
|
|
|
{ stdenv, fetchurl }:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2012-09-21 21:29:05 +02:00
|
|
|
libc = if stdenv.gcc.libc or null != null then stdenv.gcc.libc else "/usr";
|
2012-09-18 21:12:15 +02:00
|
|
|
|
|
|
|
in
|
|
|
|
|
2013-08-27 14:51:35 +02:00
|
|
|
with {
|
|
|
|
inherit (stdenv.lib) optional optionalString;
|
|
|
|
};
|
|
|
|
|
2012-09-18 21:12:15 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2013-04-04 13:42:26 +02:00
|
|
|
name = "perl-5.16.3";
|
2012-09-18 21:12:15 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://cpan/src/${name}.tar.gz";
|
2013-04-04 13:42:26 +02:00
|
|
|
sha256 = "1dpd9lhc4723wmsn4dsn4m320qlqgyw28bvcbhnfqp2nl3f0ikv9";
|
2012-09-18 21:12:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
patches =
|
|
|
|
[ # Do not look in /usr etc. for dependencies.
|
|
|
|
./no-sys-dirs.patch
|
|
|
|
]
|
2013-08-27 14:51:35 +02:00
|
|
|
++ optional stdenv.isSunOS ./ld-shared.patch
|
2013-11-02 11:53:04 +01:00
|
|
|
++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
|
2012-09-18 21:12:15 +02:00
|
|
|
|
|
|
|
# Build a thread-safe Perl with a dynamic libperls.o. We need the
|
|
|
|
# "installstyle" option to ensure that modules are put under
|
|
|
|
# $out/lib/perl5 - this is the general default, but because $out
|
|
|
|
# contains the string "perl", Configure would select $out/lib.
|
|
|
|
# Miniperl needs -lm. perl needs -lrt.
|
|
|
|
configureFlags =
|
|
|
|
[ "-de"
|
|
|
|
"-Dcc=gcc"
|
|
|
|
"-Uinstallusrbinperl"
|
|
|
|
"-Dinstallstyle=lib/perl5"
|
|
|
|
"-Duseshrplib"
|
|
|
|
"-Dlocincpth=${libc}/include"
|
|
|
|
"-Dloclibpth=${libc}/lib"
|
|
|
|
]
|
2013-08-27 14:51:35 +02:00
|
|
|
++ optional (stdenv ? glibc) "-Dusethreads";
|
2012-09-18 21:12:15 +02:00
|
|
|
|
|
|
|
configureScript = "${stdenv.shell} ./Configure";
|
|
|
|
|
|
|
|
dontAddPrefix = true;
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
preConfigure =
|
|
|
|
''
|
|
|
|
configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
|
|
|
|
|
2013-08-27 14:51:35 +02:00
|
|
|
${optionalString stdenv.isArm ''
|
2012-09-18 21:12:15 +02:00
|
|
|
configureFlagsArray=(-Dldflags="-lm -lrt")
|
|
|
|
''}
|
|
|
|
'';
|
|
|
|
|
2013-08-27 14:51:35 +02:00
|
|
|
preBuild = optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools))
|
2012-09-18 21:12:15 +02:00
|
|
|
''
|
|
|
|
# Make Cwd work on NixOS (where we don't have a /bin/pwd).
|
|
|
|
substituteInPlace dist/Cwd/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"
|
|
|
|
'';
|
|
|
|
|
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
|
|
|
passthru.libPrefix = "lib/perl5/site_perl";
|
|
|
|
}
|