Dist::Zilla and custom Makefiles
August 2, 2013 Leave a comment
I’m trying to configure a module to release to CPAN, the repository for the Perl programming language (hi Tiobe). In trying to be up to date about things I asked on reddit what would be a good build tool to use. The majority of votes were for Dist::Zilla
, so I thought I’d look into it.
It seems relatively simple for most modules, but my module uses XS and needs to link to libssl. To do this I needed to pass INC and LIB params in the Makefile.PL, but you can’t do that with Dist::Zilla
‘s default Makefile
plugin.
There are some options for having custom Makefile.PL
‘s. I tried MakeMaker::Custom
, but that required an entire Makefile.PL
template just for 2 extra lines. Instead I opted for MakeMaker::Awesome
, but that requires a module to be placed in “inc”…
Still, in both cases there is one minor issue that took a little while to solve, conflicting builds of Makefile.Pl
by MakeMaker
and MakeMaker::Custom
. This is answered in the documentation, but only when you know what to look for.
Essentially the issue is this. You are probably going to have dist.ini include:
[@Basic]
The @ indicates a plugin bundle, thus it loads Dist::Zilla::PluginBundle::Basic
. That loads [MakeMaker]
and that conflicts with [MakeMaker::*]
.
The solution to handling this is the plugin bundle
[@Filter]
This is a fake bundle which wraps around another plugin bundle and removes from it any plugins that you don’t want to load. Thus you can still load @Basic, but not load MakeMaker simply by adding this:
[@Filter]
-bundle = @Basic
-remove = MakeMaker