I have a Perl script with the following Makefile.PL
:
# Load the Module::Install bundled in ./inc/
use lib '.'; # added since from Perl 5.26 '.' is no more in @INC
use inc::Module::Install;
##############################################################################
# Define metadata (we read it from the binary)
name 'check_updates';
version_from 'check_updates';
perl_version_from 'check_updates';
all_from 'check_updates.pod';
##############################################################################
# Specific dependencies
include 'version';
my %prereqs = (
'Carp' => 0,
'English' => 0,
'POSIX' => 0,
'Readonly' => 0,
'Monitoring::Plugin' => 0,
'Monitoring::Plugin::Threshold' => 0,
'Monitoring::Plugin::Getopt' => 0,
);
install_script 'check_updates';
auto_install;
tests 't/*.t';
test_requires 'Test::More' => 0;
test_requires 'File::Spec' => 0;
# https://metacpan.org/pod/release/DAGOLDEN/CPAN-Meta-2.142690/lib/CPAN/Meta/Spec.pm#license
license 'gpl_3';
WriteMakefile(
PREREQ_PM => \%prereqs,
INSTALLSCRIPT => '/usr/lib/nagios/plugins/contrib',
INSTALLSITESCRIPT => '/usr/lib/nagios/plugins/contrib',
MAN1PODS => { 'check_updates.pod' => 'blib/man1/check_updates.1', },
MAN3PODS => { },
);
I would also like to copy a bash-completion script (i.e. check_updates.completion
) to the correct directory (given by pkg-config --variable=completionsdir bash-completion
, e.g. /opt/local/share/bash-completion/completions
)
Is there a way to generate a Makefile rule to just copy the file to the directory?
The execution of pkg-config --variable=completionsdir bash-completion
can also be performed in Makefile.PL
generating a Makefile with a hardcoded rule.