Makefile.PL: Installing multiple scripts and binaries
Given a Makefile.PL
, how can I install two binaries and two scripts in four different locations?
To be more precise, the directory structure is as follows:
- lib/my_packag开发者_运维百科e/main.pl
- bin/daemon/daemon.pl (*)
- bin/plugin/plugin.pl (*)
- scripts/conf/conf.sh (*)
- scripts/init/initd.sh (*)
- Makefile.PL
The files marked with (*) should be installed in the following paths:
- /usr/sbin/daemon.pl
- /var/qmail/smtpplugins/plugin.pl
- /usr/local/conf.sh
- /etc/init.d/initd.sh
and the contents of my Makefile.PL
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => "my_package",
VERSION_FROM => "lib/my_package/main.pl"
);
What do I tell perl through the Makefile.PL
to make it install those four files in their corresponding directories?
Two ideas from the ExtUtils::MakeMaker
documentation:
Use the PL_FILES
parameter. To paraphrase the documentation:
PL_FILES => {'bin/install.PL' => 'an-arg'}
would run bin/foobar.PL
as perl bin/installPL an-arg
Or have MakeMaker add a new target to the generated makefile
using the postamble
feature.
Or, yes, Module::Install
or Dist::Zilla
(there's probably yet another Perl module to do it since I last looked, lively little language that it is).
If you switch to Module::Build
, you can simply use
install_path
.
精彩评论