more pod shuffling
[rersyncrecent.git] / Makefile.PL
blob5781d5d272d3d83931a180f1e45fc0d2a5d3dee8
1 use strict;
2 use warnings;
3 use ExtUtils::MakeMaker;
4 $ExtUtils::MakeMaker::VERSION =~ s/_//g;
5 my @sign = (MM->can("signature_target") ? (SIGN => 1) : ());
6 my $version_diff = 0; # we'll have to die if this becomes true
7 my $version_from = 'lib/File/Rsync/Mirror/Recent.pm';
8 my $version;
10     open my $fh, "<", $version_from or die "Could not open $version_from: $!";
11     my @version = grep /VERSION\s*=\s*qv/, <$fh>;
12     our $VERSION;
13     eval $version[0];
14     $version = $VERSION;
16 if ($ARGV[0] && $ARGV[0] eq "--setversion") {
17     die "Your perl is a bit dated[$]].\nDo not make a release with it\n" if $] < 5.008;
18     warn "Your MakeMaker is a bit dated[$ExtUtils::MakeMaker::VERSION].\nYou should get a new one\n"
19         if $ExtUtils::MakeMaker::VERSION < 6.4502;
20     use lib "lib";
21     eval {  require $version_from; }; die $@ if $@;
22     my $makefile = "Makefile";
23     unless (-f $makefile) {
24         $makefile = "Makefile.old";
25     }
26     unless (-f $makefile) {
27         die "no Makefile and no Makefile.old found";
28     }
29     open my $fh, "make the-release-name|" or die "Could not fork: $!";
30     local $/;
31     my ($have_version) = <$fh> =~ /^version\s+([\d\._]+)/m;
32     close $fh or die "Could not close: $!";
33     my ($namespace) = $version_from;
34     $namespace =~ s|^lib/(.+)\.pm$|$1|;
35     $namespace =~ s|/|::|g;
36     eval qq{ if (\$$namespace\::VERSION != \$have_version) {
37         warn "Not equal: CPAN::Testers::ParseReport::VERSION[\$$namespace\::VERSION] Makefile version[\$have_version]";
38         \$version_diff = 1;
39     }};
42 WriteMakefile
43     (
44      NAME                => 'File::Rsync::Mirror::Recent',
45      VERSION             => $version,
46      AUTHOR              => 'Andreas König <andreas.koenig.7os6VVqR@franz.ak.mind.de>',
47      PL_FILES            => {},
48      PREREQ_PM =>
49      {
50       # 'Data::Serializer' => 0.46, # restricted to YAML without it
51       'accessors'        => 0,
52       'Data::Float'      => 0,
53       'File::Rsync'      => 0,
54       'Test::More'       => 0,
55       'File::Basename'   => 0,
56       'File::Path'       => 0,
57       'File::Temp'       => 0,
58       'List::MoreUtils'  => 0,
59       'List::Pairwise'   => 0,
60       'Scalar::Util'     => 0,
61       'Data::Serializer' => 0,
62       'Time::HiRes'      => 0,
63       'YAML::Syck'       => 0,
64      },
65      EXE_FILES    => [qw(bin/rrr-aggregate bin/rrr-news)],
66      dist => {
67               DIST_DEFAULT => join(" ", # note: order matters!
68                                    "Makefile",
69                                    "META.yml",
70                                    "setversion",
71                                    "all",
72                                    "tardist",
73                                   ),
74               COMPRESS => 'bzip2 -9f',
75               SUFFIX => ".bz2",
76              },
77      ($ExtUtils::MakeMaker::VERSION >= 6.4502 ?
78       (META_ADD => {
79                     # write: git push git+ssh://repo.or.cz/srv/git/rersyncrecent.git master
80                     repository => "git://repo.or.cz/rersyncrecent.git",
81                     provides => {
82                                  "File::Rsync::Mirror::Recent" =>
83                                  {
84                                   version => $version,
85                                   file => $version_from,
86                                  }
87                                 },
88                    }) : ()),
89      @sign,
90      clean               => { FILES => 'File-Rsync-Mirror-Recent-*' },
91     );
93 if ($version_diff){
94   die "
95 ==> I had to update some \$VERSIONs <==
96 ==> Your Makefile has been rebuilt. <==
97 ==> Please rerun the make command.  <==
101 package MY;
102 sub postamble {
103   my @m;
104   push @m, q{
105 Makefile: MANIFEST
107 META.yml: metafile
108         $(CP) $(DISTVNAME)/META.yml  ./META.yml
110 setversion:
111         $(PERL) Makefile.PL --setversion
113 the-release-name :
114         $(NOECHO) $(ECHO) 'version ' $(VERSION)
115         $(NOECHO) $(ECHO) 'release-name ' $(DISTVNAME).tar$(SUFFIX)
117 tag ::
118         git tag -m 'This is $(VERSION)' "$(VERSION)"
120 sign:
121         cpansign -s
123   join "", @m;
126 sub dist_test {
127   return q{
128 # if we depend on $(DISTVNAME).tar$(SUFFIX), then the rest of the
129 # Makefile breaks our intent to NOT remake dist
130 disttest :
131         rm -rf $(DISTVNAME)
132         tar xvzf $(DISTVNAME).tar$(SUFFIX)
133         cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL
134         cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
135         cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)
137 distdir ::
138         touch $(DISTVNAME)/SIGNATURE && $(CP) $(DISTVNAME)/SIGNATURE ./SIGNATURE
139         $(CP) $(DISTVNAME)/META.yml  ./META.yml
140         $(CP) $(DISTVNAME)/MANIFEST  ./MANIFEST
145 sub distdir {
146   my $self = shift;
147   my $out = $self->SUPER::distdir;
148   $out =~ s/distdir :/distdir ::/g;
149   return $out;
152 # dist_dir was the name in very old MakeMaker as of 5.005_04
153 sub dist_dir {
154   my $self = shift;
155   my $out = $self->SUPER::dist_dir;
156   $out =~ s/distdir :/distdir ::/g;
157   return $out;