summary refs log tree commit diff
path: root/pkgs/development/interpreters/perl/5.20/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/interpreters/perl/5.20/default.nix')
-rw-r--r--pkgs/development/interpreters/perl/5.20/default.nix68
1 files changed, 68 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/perl/5.20/default.nix b/pkgs/development/interpreters/perl/5.20/default.nix
new file mode 100644
index 00000000000..d9fb32aa43e
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.20/default.nix
@@ -0,0 +1,68 @@
+{ stdenv, fetchurl }:
+
+let
+
+  libc = if stdenv.gcc.libc or null != null then stdenv.gcc.libc else "/usr";
+
+in
+
+with {
+  inherit (stdenv.lib) optional optionalString;
+};
+
+stdenv.mkDerivation rec {
+  name = "perl-5.20.0";
+
+  src = fetchurl {
+    url = "mirror://cpan/src/${name}.tar.gz";
+    sha256 = "00ndpgw4bjing9gy2y6jvs3q46mv2ll6zrxjkhpr12fcdsnji32f";
+  };
+
+  patches =
+    [ # Do not look in /usr etc. for dependencies.
+      ./no-sys-dirs.patch
+    ]
+    ++ optional stdenv.isSunOS ./ld-shared.patch
+    ++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./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"
+    ]
+    ++ 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"
+
+      ${optionalString stdenv.isArm ''
+        configureFlagsArray=(-Dldflags="-lm -lrt")
+      ''}
+    '';
+
+  preBuild = optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools))
+    ''
+      # Make Cwd work on NixOS (where we don't have a /bin/pwd).
+      substituteInPlace dist/PathTools/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"
+    '';
+
+  setupHook = ./setup-hook.sh;
+
+  passthru.libPrefix = "lib/perl5/site_perl";
+}