Subject: | Makefile.PL improvements: don't assume PREFIX and be easier to package |
The attached patch addresses two issues in 0.52 which make it much easier to package and install for system admins.
First, `perl Makefile.PL INSTALLDIRS=vendor; make pure_install` is *broken* on my RedHat-ish perl build, and only works by accident for other. I expect these commands to install under :installvendorprefix, and normally they would, but Makefile.PL hardcodes PREFIX to something *wrong* for my system. Indeed, it hardcodes PREFIX to /usr/local, which by chance means it ends up installing under :installsitelib -- so, I ask for a vendor install and I get a site install.
Fix: Don't hardcode PREFIX. EU::MM will infer it from INSTALLDIRS.
Second, the Makefile.PL specifies only one dependency (File::Basename), omitting several others. Thus the META.yaml file is incomplete in its requirements specification and thus packagers have a harder time figuring out what the module actually needs. (It's easy to generate an RPM spec file if META.yaml is reasonably complete.)
Fix:
1. AutoLoader and Carp should be PREREQ_PM.
2. EU:MM and Test::More should be BUILD_REQUIRES, or PREREQ_PM if the system EU::MM is too old.
3. File::Basename, Copy, and Spec should be CONFIGURE_REQUIRES, or PREREQ_PM if the system EU::MM is too old.
(Any EU::MM released after iptables-1.4.4 should support the above directives, but I suppose you might have to support 1.4.4 backported to really old Linux systems with old perls.)
Subject: | IPTables-libiptc-0.52-Makefile.PL.patch |
diff -up IPTables-libiptc-0.52/Makefile.PL.orig IPTables-libiptc-0.52/Makefile.PL
--- IPTables-libiptc-0.52/Makefile.PL.orig 2011-06-28 10:43:35.000000000 -0500
+++ IPTables-libiptc-0.52/Makefile.PL 2013-05-02 18:34:04.082928200 -0500
@@ -238,14 +238,34 @@ clean::
}
+my %deps = (
+ PREREQ_PM => {
+ 'AutoLoader' => 0,
+ 'Carp' => 0,
+ },
+ BUILD_REQUIRES => {
+ 'ExtUtils::MakeMaker' => 0,
+ 'Test::More' => 0,
+ },
+ CONFIGURE_REQUIRES => {
+ 'File::Basename' => 0,
+ 'File::Copy' => 0,
+ 'File::Spec' => 0,
+ },
+);
+if (ExtUtils::MakeMaker->VERSION < 6.5103) {
+ $deps{PREREQ_PM} = { %{$deps{PREREQ_PM}}, %{delete $deps{CONFIGURE_REQUIRES}} };
+}
+if (ExtUtils::MakeMaker->VERSION < 6.5501) {
+ $deps{PREREQ_PM} = { %{$deps{PREREQ_PM}}, %{delete $deps{BUILD_REQUIRES}} };
+}
+
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
NAME => 'IPTables::libiptc',
VERSION_FROM => 'lib/IPTables/libiptc.pm', # finds $VERSION
- PREREQ_PM => {
- 'File::Basename' => 0,
- }, # e.g., Module::Name => 1.1
+ %deps,
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/IPTables/libiptc.pm', # retrieve abstract from module
AUTHOR => 'Jesper Dangaard Brouer <hawk@comx.dk>') : ()),
@@ -265,7 +285,6 @@ WriteMakefile(
OBJECT => '$(O_FILES) iptables/iptables.o iptables/xshared.o',
## OBJECT => '$(O_FILES) iptables/iptables.o iptables/xtables.o library_iptc/libiptc.a',
# link all the C files too
- PREFIX => '/usr/local',
TYPEMAPS => ['libiptc.typemap'],
# depend => { 'iptables/iptables.o' => 'library_iptc/libiptc.a'}
# depend => { 'iptables/iptables.o' => 'library_iptc/libiptc.a'}