perl / Makefile.PLon commit git-svn: move Git::SVN::Prompt into its own file (c102f4c)
   1use strict;
   2use warnings;
   3use ExtUtils::MakeMaker;
   4use Getopt::Long;
   5
   6# Sanity: die at first unknown option
   7Getopt::Long::Configure qw/ pass_through /;
   8
   9GetOptions("localedir=s" => \my $localedir);
  10
  11sub MY::postamble {
  12        return <<'MAKE_FRAG';
  13instlibdir:
  14        @echo '$(INSTALLSITELIB)'
  15
  16ifneq (,$(DESTDIR))
  17ifeq (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)
  21endif
  22endif
  23
  24MAKE_FRAG
  25}
  26
  27my %pm = (
  28        'Git.pm' => '$(INST_LIBDIR)/Git.pm',
  29        'Git/I18N.pm' => '$(INST_LIBDIR)/Git/I18N.pm',
  30        'Git/SVN/Prompt.pm' => '$(INST_LIBDIR)/Git/SVN/Prompt.pm',
  31);
  32
  33# We come with our own bundled Error.pm. It's not in the set of default
  34# Perl modules so install it if it's not available on the system yet.
  35eval { require Error };
  36if ($@ || $Error::VERSION < 0.15009) {
  37        $pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';
  38}
  39
  40# redirect stdout, otherwise the message "Writing perl.mak for Git"
  41# disrupts the output for the target 'instlibdir'
  42open STDOUT, ">&STDERR";
  43
  44WriteMakefile(
  45        NAME            => 'Git',
  46        VERSION_FROM    => 'Git.pm',
  47        PM              => \%pm,
  48        PM_FILTER       => qq[\$(PERL) -pe "s<\\Q++LOCALEDIR++\\E><$localedir>"],
  49        MAKEFILE        => 'perl.mak',
  50        INSTALLSITEMAN3DIR => '$(SITEPREFIX)/share/man/man3'
  51);