3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/interpreters/perl/5.16/default.nix

73 lines
2 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, enableThreading ? true }:
2012-09-18 20:12:15 +01:00
let
libc = if stdenv.cc.libc or null != null then stdenv.cc.libc else "/usr";
2012-09-18 20:12:15 +01:00
in
stdenv.mkDerivation rec {
name = "perl-5.16.3";
2012-09-18 20:12:15 +01:00
src = fetchurl {
url = "mirror://cpan/src/${name}.tar.gz";
sha256 = "1dpd9lhc4723wmsn4dsn4m320qlqgyw28bvcbhnfqp2nl3f0ikv9";
2012-09-18 20:12:15 +01:00
};
patches =
[ # Do not look in /usr etc. for dependencies.
./no-sys-dirs.patch
./no-impure-config-time.patch
./fixed-man-page-date.patch
./no-date-in-perl-binary.patch
2012-09-18 20:12:15 +01:00
]
++ lib.optional stdenv.isSunOS ./ld-shared.patch
++ lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
2012-09-18 20:12:15 +01: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"
"-Uinstallusrbinperl"
"-Dinstallstyle=lib/perl5"
"-Duseshrplib"
"-Dlocincpth=${libc}/include"
"-Dloclibpth=${libc}/lib"
]
++ lib.optional enableThreading "-Dusethreads";
2012-09-18 20:12:15 +01:00
configureScript = "${stdenv.shell} ./Configure";
dontAddPrefix = true;
enableParallelBuilding = true;
preConfigure =
''
configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
${lib.optionalString stdenv.isArm ''
2012-09-18 20:12:15 +01:00
configureFlagsArray=(-Dldflags="-lm -lrt")
''}
${lib.optionalString stdenv.isCygwin ''
2014-05-31 13:25:46 +01:00
cp cygwin/cygwin.c{,.bak}
echo "#define PERLIO_NOT_STDIO 0" > tmp
cat tmp cygwin/cygwin.c.bak > cygwin/cygwin.c
''}
2012-09-18 20:12:15 +01:00
'';
preBuild = lib.optionalString (!(stdenv ? cc && stdenv.cc.nativeTools))
2012-09-18 20:12:15 +01: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";
}