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