The Makefile.PL will now find .pm files itself.

It is no longer necessary to manually add new .pm files to the Makefile.PL. This makes it easier to add modules. It is still necessary to add them to the Makefile, but that extra work should be removed at a future date. Signed-off-by: Michael G Schwern <schwern@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>

Michael G. Schwern committed Jul 24, 2012 at 20:21 UTC 98d5439dad36f25aa9a2a70cc140d85d94e99bc9
1 file changed +16 -13
perl/Makefile.PL
+16 -13
@@ -2,6 +2,10 @@ use strict;
2 use warnings;
3 use ExtUtils::MakeMaker;
4 use Getopt::Long;
5 +use File::Find;
6 +
7 +# Don't forget to update the perl/Makefile, too.
8 +# Don't forget to test with NO_PERL_MAKEMAKER=YesPlease
9
10 # Sanity: die at first unknown option
11 Getopt::Long::Configure qw/ pass_through /;
@@ -25,19 +29,18 @@ endif
29 MAKE_FRAG
30 }
31
28 -# XXX. When editing this list:
29 -#
30 -# * Please update perl/Makefile, too.
31 -# * Don't forget to test with NO_PERL_MAKEMAKER=YesPlease
32 -my %pm = (
33 - 'Git.pm' => '$(INST_LIBDIR)/Git.pm',
34 - 'Git/I18N.pm' => '$(INST_LIBDIR)/Git/I18N.pm',
35 - 'Git/SVN/Memoize/YAML.pm' => '$(INST_LIBDIR)/Git/SVN/Memoize/YAML.pm',
36 - 'Git/SVN/Fetcher.pm' => '$(INST_LIBDIR)/Git/SVN/Fetcher.pm',
37 - 'Git/SVN/Editor.pm' => '$(INST_LIBDIR)/Git/SVN/Editor.pm',
38 - 'Git/SVN/Prompt.pm' => '$(INST_LIBDIR)/Git/SVN/Prompt.pm',
39 - 'Git/SVN/Ra.pm' => '$(INST_LIBDIR)/Git/SVN/Ra.pm',
40 -);
32 +# Find all the .pm files in "Git/" and Git.pm
33 +my %pm;
34 +find sub {
35 + return unless /\.pm$/;
36 +
37 + # sometimes File::Find prepends a ./ Strip it.
38 + my $pm_path = $File::Find::name;
39 + $pm_path =~ s{^\./}{};
40 +
41 + $pm{$pm_path} = '$(INST_LIBDIR)/'.$pm_path;
42 +}, "Git", "Git.pm";
43 +
44
45 # We come with our own bundled Error.pm. It's not in the set of default
46 # Perl modules so install it if it's not available on the system yet.