2009-10-19 11:17:10 +02:00
|
|
|
{ stdenv, fetchurl
|
|
|
|
, impureLibcPath ? null
|
|
|
|
}:
|
2004-02-20 17:25:34 +01:00
|
|
|
|
2009-11-08 01:32:12 +01:00
|
|
|
let
|
2010-01-18 13:09:51 +01:00
|
|
|
|
|
|
|
preBuildNoNative =
|
|
|
|
''
|
2009-11-08 01:32:12 +01:00
|
|
|
# Make Cwd work on NixOS (where we don't have a /bin/pwd).
|
|
|
|
substituteInPlace lib/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"
|
|
|
|
'';
|
2010-01-18 13:09:51 +01:00
|
|
|
|
2009-11-08 01:32:12 +01:00
|
|
|
in
|
2010-01-18 13:09:51 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "perl-5.10.1";
|
2004-02-20 17:25:34 +01:00
|
|
|
|
2003-11-05 13:17:48 +01:00
|
|
|
src = fetchurl {
|
2010-01-18 13:09:51 +01:00
|
|
|
url = "mirror://cpan/src/${name}.tar.gz";
|
|
|
|
sha256 = "0dagnhjgmslfx1jawz986nvc3jh1klk7mn2l8djdca1b9gm2czyb";
|
2004-02-20 17:25:34 +01:00
|
|
|
};
|
|
|
|
|
2007-11-15 17:15:15 +01:00
|
|
|
patches = [
|
|
|
|
# This patch does the following:
|
|
|
|
# 1) Do use the PATH environment variable to find the `pwd' command.
|
|
|
|
# By default, Perl will only look for it in /lib and /usr/lib.
|
|
|
|
# !!! what are the security implications of this?
|
|
|
|
# 2) Force the use of <errno.h>, not /usr/include/errno.h, on Linux
|
|
|
|
# systems. (This actually appears to be due to a bug in Perl.)
|
|
|
|
./no-sys-dirs.patch
|
|
|
|
];
|
2005-03-10 13:49:37 +01:00
|
|
|
|
2009-04-22 19:37:21 +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.
|
2009-11-08 01:32:12 +01:00
|
|
|
# Miniperl needs -lm. perl needs -lrt.
|
|
|
|
configureFlags = [
|
|
|
|
"-de"
|
|
|
|
"-Dcc=gcc"
|
|
|
|
"-Uinstallusrbinperl"
|
|
|
|
"-Dinstallstyle=lib/perl5"
|
|
|
|
"-Duseshrplib"
|
|
|
|
(if stdenv ? glibc then "-Dusethreads" else "")
|
|
|
|
];
|
2009-04-22 00:38:52 +02:00
|
|
|
|
2009-05-06 16:03:26 +02:00
|
|
|
configureScript = "${stdenv.shell} ./Configure";
|
2009-04-22 19:37:21 +02:00
|
|
|
|
|
|
|
dontAddPrefix = true;
|
|
|
|
|
2009-11-08 01:32:12 +01:00
|
|
|
configurePhase =
|
2009-04-22 19:37:21 +02:00
|
|
|
''
|
|
|
|
configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
|
2009-10-19 11:17:10 +02:00
|
|
|
|
|
|
|
if test "${if impureLibcPath == null then "$NIX_ENFORCE_PURITY" else "1"}" = "1"; then
|
|
|
|
GLIBC=${if impureLibcPath == null then "$(cat $NIX_GCC/nix-support/orig-libc)" else impureLibcPath}
|
2009-10-02 21:05:39 +02:00
|
|
|
configureFlags="$configureFlags -Dlocincpth=$GLIBC/include -Dloclibpth=$GLIBC/lib"
|
2009-04-22 19:37:21 +02:00
|
|
|
fi
|
2009-11-08 01:32:12 +01:00
|
|
|
${stdenv.shell} ./Configure $configureFlags \
|
|
|
|
${if stdenv.system == "armv5tel-linux" then "-Dldflags=\"-lm -lrt\"" else ""};
|
2009-04-22 19:37:21 +02:00
|
|
|
'';
|
|
|
|
|
2010-01-18 13:09:51 +01:00
|
|
|
preBuild = stdenv.lib.optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools)) preBuildNoNative;
|
2009-04-22 19:37:21 +02:00
|
|
|
|
2005-03-10 13:49:37 +01:00
|
|
|
setupHook = ./setup-hook.sh;
|
2003-11-05 13:17:48 +01:00
|
|
|
}
|