1{ lib, stdenv, perl, toPerlModule }:
2
3{ buildInputs ? []
4, nativeBuildInputs ? []
5, outputs ? [ "out" "devdoc" ]
6, src ? null
7
8# enabling or disabling does nothing for perl packages so set it explicitly
9# to false to not change hashes when enableParallelBuildingByDefault is enabled
10, enableParallelBuilding ? false
11
12, doCheck ? true
13, checkTarget ? "test"
14
15# Prevent CPAN downloads.
16, PERL_AUTOINSTALL ? "--skipdeps"
17
18# From http://wiki.cpantesters.org/wiki/CPANAuthorNotes: "allows
19# authors to skip certain tests (or include certain tests) when
20# the results are not being monitored by a human being."
21, AUTOMATED_TESTING ? true
22
23# current directory (".") is removed from @INC in Perl 5.26 but many old libs rely on it
24# https://metacpan.org/pod/release/XSAWYERX/perl-5.26.0/pod/perldelta.pod#Removal-of-the-current-directory-%28%22.%22%29-from-@INC
25, PERL_USE_UNSAFE_INC ? "1"
26
27, env ? {}
28
29, ...
30}@attrs:
31
32lib.throwIf (attrs ? name) "buildPerlPackage: `name` (\"${attrs.name}\") is deprecated, use `pname` and `version` instead"
33
34(let
35 defaultMeta = {
36 homepage = "https://metacpan.org/dist/${attrs.pname}";
37 inherit (perl.meta) platforms;
38 };
39
40 package = stdenv.mkDerivation (attrs // {
41 name = "perl${perl.version}-${attrs.pname}-${attrs.version}";
42
43 builder = ./builder.sh;
44
45 buildInputs = buildInputs ++ [ perl ];
46 nativeBuildInputs = nativeBuildInputs ++ (if stdenv.buildPlatform != stdenv.hostPlatform then [ perl.mini ] else [ perl ]);
47
48 inherit outputs src doCheck checkTarget enableParallelBuilding;
49 env = {
50 inherit PERL_AUTOINSTALL AUTOMATED_TESTING PERL_USE_UNSAFE_INC;
51 fullperl = perl.__spliced.buildHost or perl;
52 } // env;
53
54 meta = defaultMeta // (attrs.meta or { });
55 });
56
57in toPerlModule package)