]> Sergey Matveev's repositories - public-inbox.git/blob - Makefile.PL
public-inbox v1.2.0
[public-inbox.git] / Makefile.PL
1 #!/usr/bin/perl -w
2 # Copyright (C) 2013-2019 all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 use strict;
5 use ExtUtils::MakeMaker;
6 open my $m, '<', 'MANIFEST' or die "open(MANIFEST): $!\n";
7 chomp(my @manifest = (<$m>));
8 my @EXE_FILES = grep(m!^script/!, @manifest);
9 my $PM_FILES = join(' ', grep(m!^lib/.*\.pm$!, @manifest));
10
11 # Don't waste user's disk space by installing some pods from
12 # imported code or internal use only
13 my %man3 = map {; # semi-colon tells Perl this is a BLOCK (and not EXPR)
14         my $base = $_;
15         my $mod = $base;
16         $mod =~ s!/!::!g;
17         $mod =~ s/\.\w+\z//;
18         "lib/PublicInbox/$_" => "blib/man3/PublicInbox::$mod.3"
19 } qw(Git.pm Import.pm WWW.pod SaPlugin/ListMirror.pod);
20
21 WriteMakefile(
22         NAME => 'PublicInbox',
23         VERSION => '1.2.0',
24         AUTHOR => 'Eric Wong <e@80x24.org>',
25         ABSTRACT => 'public-inbox server infrastructure',
26         EXE_FILES => \@EXE_FILES,
27         PREREQ_PM => {
28                 # note: we use spamc(1), NOT the Perl modules
29                 # We also depend on git.
30                 # Keep this sorted and synced to the INSTALL document
31                 'Date::Parse' => 0,
32
33                 # libperl$PERL_VERSION,
34                 # `perl5' on FreeBSD
35                 # perl-Digest-SHA on RH-based
36                 'Digest::SHA' => 0,
37                 'Email::MIME' => 0,
38
39                 # the following should be pulled in by Email::MIME:
40                 'Email::MIME::ContentType' => 0,
41                 'Email::Simple' => 0,
42
43                 # libperl$PERL_VERSION or libencode-perl on Debian,
44                 # `perl5' on FreeBSD
45                 'Encode' => 0,
46
47                 # TODO: these should really be made optional...
48                 'Plack' => 0,
49                 'URI::Escape' => 0,
50
51                 # We have more test dependencies, but do not force
52                 # users to install them.  See INSTALL
53
54                 # All Perl installs I know about have these, but RH-based
55                 # distros make them separate even though 'perl' pulls them in
56                 'File::Path' => 0,
57                 'File::Temp' => 0,
58                 'Getopt::Long' => 0,
59                 'Exporter' => 0,
60                 # ExtUtils::MakeMaker # this file won't run w/o it...
61         },
62         MAN3PODS => \%man3,
63 );
64
65 sub MY::postamble {
66   <<EOF;
67 # support using eatmydata to speed up tests (apt-get install eatmydata):
68 # https://www.flamingspork.com/projects/libeatmydata/
69 EATMYDATA =
70 N = \$\$(( \$\$(nproc 2>/dev/null || gnproc 2>/dev/null || echo 2) + 1 ))
71 -include config.mak
72 -include Documentation/include.mk
73 SCRIPTS := scripts/ssoma-replay
74 syn_files = $PM_FILES \$(EXE_FILES) \$(SCRIPTS) \$(wildcard t/*.t)
75 my_syntax = \$(addsuffix .syntax, \$(syn_files))
76 changed = \$(shell git ls-files -m)
77
78 %.syntax ::
79         @\$(PERL) -w -I lib -c \$(subst .syntax,,\$@)
80
81 syntax:: \$(filter-out lib/PublicInbox/DSKQXS.pm.syntax,\$(my_syntax))
82
83 dsyn :: \$(addsuffix .syntax, \$(filter \$(changed), \$(syn_files)))
84
85 check-manifest :: MANIFEST
86         if git ls-files >\$?.gen 2>&1; then diff -u \$? \$?.gen; fi
87
88 check:: pure_all check-manifest
89         \$(EATMYDATA) prove -lvw -j\$(N)
90
91 lib/PublicInbox/UserContent.pm :: contrib/css/216dark.css
92         \$(PERL) -I lib \$@ \$?
93
94 # Ensure new .pm files will always be installed:
95 Makefile.PL :: MANIFEST
96
97 EOF
98 }