]>
Commit | Line | Data |
---|---|---|
5e9637c6 ÆAB |
1 | use strict; |
2 | use warnings; | |
b1edc53d | 3 | use ExtUtils::MakeMaker; |
5e9637c6 | 4 | use Getopt::Long; |
98d5439d MS |
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 | |
5e9637c6 ÆAB |
9 | |
10 | # Sanity: die at first unknown option | |
11 | Getopt::Long::Configure qw/ pass_through /; | |
12 | ||
4c8e5c55 MS |
13 | my $localedir = ''; |
14 | GetOptions("localedir=s" => \$localedir); | |
b1edc53d PB |
15 | |
16 | sub MY::postamble { | |
17 | return <<'MAKE_FRAG'; | |
18 | instlibdir: | |
18b0fc1c | 19 | @echo '$(INSTALLSITELIB)' |
e2a38710 | 20 | |
efe47f8f BC |
21 | ifneq (,$(DESTDIR)) |
22 | ifeq (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) | |
26 | endif | |
27 | endif | |
28 | ||
b1edc53d PB |
29 | MAKE_FRAG |
30 | } | |
31 | ||
98d5439d MS |
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 | ||
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 | 47 | if ( !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' | |
53 | open STDOUT, ">&STDERR"; | |
54 | ||
b1edc53d PB |
55 | WriteMakefile( |
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 | ); |