perlPackages: add default meta.mainProgram (#176398)

Because perl packages are prefixed with the perl version, it means that
the `lib.getExe` heuristic will never point to the binary name. So we
provide the meta.mainProgram that overrides that, using the original
pname or parsed name. It's not perfect but should yield better results
already.
This commit is contained in:
Jonas Chevalier 2022-06-06 14:35:07 +02:00 committed by GitHub
parent d8fad83d2c
commit ff7b216dcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,6 +35,7 @@ lib.warnIf (attrs ? name) "builtPerlPackage: `name' (\"${attrs.name}\") is depre
(let
defaultMeta = {
homepage = "https://metacpan.org/release/${lib.getName attrs}"; # TODO: phase-out `attrs.name`
mainProgram = attrs.pname or (builtins.parseDrvName attrs.name).name;
platforms = perl.meta.platforms;
};