Skip to content

Commit 98d5439

Browse files
schwernEric Wong
authored and
Eric Wong
committed
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Eric Wong <[email protected]>
1 parent 0ed8fdc commit 98d5439

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

perl/Makefile.PL

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ use strict;
22
use warnings;
33
use ExtUtils::MakeMaker;
44
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
59

610
# Sanity: die at first unknown option
711
Getopt::Long::Configure qw/ pass_through /;
@@ -25,19 +29,18 @@ endif
2529
MAKE_FRAG
2630
}
2731

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+
4144

4245
# We come with our own bundled Error.pm. It's not in the set of default
4346
# Perl modules so install it if it's not available on the system yet.

0 commit comments

Comments
 (0)