nixpkgs/pkgs/development/interpreters/perl/5.16/default.nix

82 lines
2.2 KiB
Nix
Raw Normal View History

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
stdenv.mkDerivation rec {
2012-11-23 17:02:10 +01:00
name = "perl-5.16.2";
2012-09-18 21:12:15 +02:00
src = fetchurl {
url = "mirror://cpan/src/${name}.tar.gz";
2012-11-23 17:02:10 +01:00
sha256 = "03nh8bqnjsdd5izjv3n2yfcxw4ck0llwww36jpbjbjgixwpqpy4f";
2012-09-18 21:12:15 +02:00
};
patches =
[ # Do not look in /usr etc. for dependencies.
./no-sys-dirs.patch
]
2013-02-28 15:53:47 +01:00
++ stdenv.lib.optional stdenv.isSunOS ./ld-shared.patch
2012-09-18 21:12:15 +02:00
++ stdenv.lib.optional stdenv.isDarwin ./no-libutil.patch;
# 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"
]
++ stdenv.lib.optional (stdenv ? glibc) "-Dusethreads";
configureScript = "${stdenv.shell} ./Configure";
dontAddPrefix = true;
enableParallelBuilding = true;
preConfigure =
''
configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
${stdenv.lib.optionalString stdenv.isArm ''
configureFlagsArray=(-Dldflags="-lm -lrt")
''}
'';
preBuild = stdenv.lib.optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools))
''
# 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;
doCheck = true;
# some network-related tests don't work, mostly probably due to our sandboxing
testsToSkip = ''
lib/Net/hostent.t \
dist/IO/t/{io_multihomed.t,io_sock.t} \
t/porting/{maintainers.t,regen.t} \
cpan/Socket/t/getnameinfo.t \
'' + " ";
postPatch = ''
for test in ${testsToSkip}; do
echo "Removing test" $test
rm "$test"
pat=`echo "$test" | sed 's,/,\\\\/,g'` # just escape slashes
sed "/^$pat/d" -i MANIFEST
done
'';
2012-09-18 21:12:15 +02:00
passthru.libPrefix = "lib/perl5/site_perl";
}