1 use strict;
2 use warnings;
3 use ExtUtils::MakeMaker;
4 use Getopt::Long;
6 # Sanity: die at first unknown option
7 Getopt::Long::Configure qw/ pass_through /;
9 GetOptions("localedir=s" => \my $localedir);
11 sub MY::postamble {
12 return <<'MAKE_FRAG';
13 instlibdir:
14 @echo '$(INSTALLSITELIB)'
16 ifneq (,$(DESTDIR))
17 ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))
18 $(error ExtUtils::MakeMaker version "$(MM_VERSION)" is older than 6.11 and so \
19 is likely incompatible with the DESTDIR mechanism. Try setting \
20 NO_PERL_MAKEMAKER=1 instead)
21 endif
22 endif
24 MAKE_FRAG
25 }
27 my %pm = (
28 'Git.pm' => '$(INST_LIBDIR)/Git.pm',
29 'Git/I18N.pm' => '$(INST_LIBDIR)/Git/I18N.pm',
30 );
32 # We come with our own bundled Error.pm. It's not in the set of default
33 # Perl modules so install it if it's not available on the system yet.
34 eval { require Error };
35 if ($@ || $Error::VERSION < 0.15009) {
36 $pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';
37 }
39 # redirect stdout, otherwise the message "Writing perl.mak for Git"
40 # disrupts the output for the target 'instlibdir'
41 open STDOUT, ">&STDERR";
43 WriteMakefile(
44 NAME => 'Git',
45 VERSION_FROM => 'Git.pm',
46 PM => \%pm,
47 PM_FILTER => qq[\$(PERL) -pe "s<\\Q++LOCALEDIR++\\E><$localedir>"],
48 MAKEFILE => 'perl.mak',
49 INSTALLSITEMAN3DIR => '$(SITEPREFIX)/share/man/man3'
50 );