]> git.ipfire.org Git - thirdparty/git.git/blame - perl/Makefile.PL
GIT-VERSION-GEN: support non-standard $GIT_DIR path
[thirdparty/git.git] / perl / Makefile.PL
CommitLineData
5e9637c6
ÆAB
1use strict;
2use warnings;
b1edc53d 3use ExtUtils::MakeMaker;
5e9637c6 4use Getopt::Long;
98d5439d
MS
5use File::Find;
6
7# Don't forget to update the perl/Makefile, too.
8# Don't forget to test with NO_PERL_MAKEMAKER=YesPlease
5e9637c6
ÆAB
9
10# Sanity: die at first unknown option
11Getopt::Long::Configure qw/ pass_through /;
12
4c8e5c55
MS
13my $localedir = '';
14GetOptions("localedir=s" => \$localedir);
b1edc53d
PB
15
16sub MY::postamble {
17 return <<'MAKE_FRAG';
18instlibdir:
18b0fc1c 19 @echo '$(INSTALLSITELIB)'
e2a38710 20
efe47f8f
BC
21ifneq (,$(DESTDIR))
22ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))
23$(error ExtUtils::MakeMaker version "$(MM_VERSION)" is older than 6.11 and so \
24 is likely incompatible with the DESTDIR mechanism. Try setting \
25 NO_PERL_MAKEMAKER=1 instead)
26endif
27endif
28
b1edc53d
PB
29MAKE_FRAG
30}
31
98d5439d
MS
32# Find all the .pm files in "Git/" and Git.pm
33my %pm;
34find 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
5c4082fd
PB
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.
0ed8fdcd 47if ( !eval { require Error } || $Error::VERSION < 0.15009) {
1d8c9dc4 48 $pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';
5c4082fd
PB
49}
50
8bef6204
JS
51# redirect stdout, otherwise the message "Writing perl.mak for Git"
52# disrupts the output for the target 'instlibdir'
53open STDOUT, ">&STDERR";
54
b1edc53d
PB
55WriteMakefile(
56 NAME => 'Git',
57 VERSION_FROM => 'Git.pm',
5c4082fd 58 PM => \%pm,
5e9637c6 59 PM_FILTER => qq[\$(PERL) -pe "s<\\Q++LOCALEDIR++\\E><$localedir>"],
2cdf87eb 60 MAKEFILE => 'perl.mak',
28072a5d 61 INSTALLSITEMAN3DIR => '$(SITEPREFIX)/share/man/man3'
b1edc53d 62);