2019-05-03 12:53:36 +02:00
|
|
|
{ lib, stdenv, perl, buildPerl, toPerlModule }:
|
2005-01-22 01:19:27 +01:00
|
|
|
|
2022-02-10 02:19:00 +01:00
|
|
|
{ buildInputs ? []
|
|
|
|
, nativeBuildInputs ? []
|
|
|
|
, outputs ? [ "out" "devdoc" ]
|
|
|
|
, src ? null
|
2005-01-22 01:19:27 +01:00
|
|
|
|
2022-05-14 03:13:49 +02:00
|
|
|
# enabling or disabling does nothing for perl packages so set it explicitly
|
|
|
|
# to false to not change hashes when enableParallelBuildingByDefault is enabled
|
|
|
|
, enableParallelBuilding ? false
|
|
|
|
|
2022-02-10 02:19:00 +01:00
|
|
|
, doCheck ? true
|
|
|
|
, checkTarget ? "test"
|
2019-06-20 15:07:56 +02:00
|
|
|
|
2022-02-10 02:19:00 +01:00
|
|
|
# Prevent CPAN downloads.
|
|
|
|
, PERL_AUTOINSTALL ? "--skipdeps"
|
2021-04-27 15:52:15 +02:00
|
|
|
|
2022-02-10 02:19:00 +01:00
|
|
|
# From http://wiki.cpantesters.org/wiki/CPANAuthorNotes: "allows
|
|
|
|
# authors to skip certain tests (or include certain tests) when
|
|
|
|
# the results are not being monitored by a human being."
|
|
|
|
, AUTOMATED_TESTING ? true
|
2013-08-26 12:04:56 +02:00
|
|
|
|
2022-02-10 02:19:00 +01:00
|
|
|
# current directory (".") is removed from @INC in Perl 5.26 but many old libs rely on it
|
|
|
|
# https://metacpan.org/pod/release/XSAWYERX/perl-5.26.0/pod/perldelta.pod#Removal-of-the-current-directory-%28%22.%22%29-from-@INC
|
|
|
|
, PERL_USE_UNSAFE_INC ? "1"
|
2013-08-26 12:04:56 +02:00
|
|
|
|
2022-02-10 02:19:00 +01:00
|
|
|
, ...
|
|
|
|
}@attrs:
|
2013-08-26 12:04:56 +02:00
|
|
|
|
2022-02-10 02:19:00 +01:00
|
|
|
assert attrs?pname -> attrs?version;
|
|
|
|
assert attrs?pname -> !(attrs?name);
|
|
|
|
|
|
|
|
lib.warnIf (attrs ? name) "builtPerlPackage: `name' (\"${attrs.name}\") is deprecated, use `pname' and `version' instead"
|
2009-07-02 15:54:52 +02:00
|
|
|
|
2022-02-10 02:19:00 +01:00
|
|
|
(let
|
|
|
|
defaultMeta = {
|
|
|
|
homepage = "https://metacpan.org/release/${lib.getName attrs}"; # TODO: phase-out `attrs.name`
|
2022-06-06 14:35:07 +02:00
|
|
|
mainProgram = attrs.pname or (builtins.parseDrvName attrs.name).name;
|
2022-02-10 02:19:00 +01:00
|
|
|
platforms = perl.meta.platforms;
|
|
|
|
};
|
2018-07-11 05:43:22 +02:00
|
|
|
|
2022-02-10 02:19:00 +01:00
|
|
|
cleanedAttrs = builtins.removeAttrs attrs [
|
|
|
|
"meta" "builder" "version" "pname" "fullperl"
|
|
|
|
"buildInputs" "nativeBuildInputs" "buildInputs"
|
|
|
|
"PERL_AUTOINSTALL" "AUTOMATED_TESTING" "PERL_USE_UNSAFE_INC"
|
|
|
|
];
|
2018-06-26 12:12:14 +02:00
|
|
|
|
2022-02-10 02:19:00 +01:00
|
|
|
package = stdenv.mkDerivation ({
|
2019-11-24 18:22:28 +01:00
|
|
|
pname = "perl${perl.version}-${lib.getName attrs}"; # TODO: phase-out `attrs.name`
|
|
|
|
version = lib.getVersion attrs; # TODO: phase-out `attrs.name`
|
2022-02-10 02:19:00 +01:00
|
|
|
|
2009-02-12 16:56:35 +01:00
|
|
|
builder = ./builder.sh;
|
2022-02-10 02:19:00 +01:00
|
|
|
|
2019-05-17 06:12:24 +02:00
|
|
|
buildInputs = buildInputs ++ [ perl ];
|
2020-08-13 20:46:11 +02:00
|
|
|
nativeBuildInputs = nativeBuildInputs ++ [ (perl.mini or perl) ];
|
2022-02-10 02:19:00 +01:00
|
|
|
|
2019-05-03 12:53:36 +02:00
|
|
|
fullperl = buildPerl;
|
2022-02-10 02:19:00 +01:00
|
|
|
|
2022-05-14 03:13:49 +02:00
|
|
|
inherit outputs src doCheck checkTarget enableParallelBuilding;
|
2022-02-10 02:19:00 +01:00
|
|
|
inherit PERL_AUTOINSTALL AUTOMATED_TESTING PERL_USE_UNSAFE_INC;
|
|
|
|
|
|
|
|
meta = defaultMeta // (attrs.meta or { });
|
|
|
|
} // cleanedAttrs);
|
|
|
|
|
|
|
|
in toPerlModule package)
|