【发布时间】:2022-02-27 04:39:28
【问题描述】:
我有一个带有以下 Makefile.PL 的 Perl 脚本:
# 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 => { },
);
我还想将 bash 完成脚本(即check_updates.completion)复制到正确的目录(由pkg-config --variable=completionsdir bash-completion 提供,例如/opt/local/share/bash-completion/completions)
有没有办法生成 Makefile 规则,只需将文件复制到目录?
pkg-config --variable=completionsdir bash-completion 的执行也可以在Makefile.PL 中执行,生成带有硬编码规则的 Makefile。
【问题讨论】:
-
这个问题是
Module::Install特有的吗? -
@HåkonHægland 任何解决方案都可以...
标签: perl