]> Sergey Matveev's repositories - public-inbox.git/blob - Makefile.PL
INSTALL: update with FreeBSD pkg names and reorder
[public-inbox.git] / Makefile.PL
1 #!/usr/bin/perl -w
2 # Copyright (C) 2013-2018 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/\.\w+\z//;
17         "lib/PublicInbox/$_" => "blib/man3/PublicInbox::$mod.3"
18 } qw(Git.pm Import.pm WWW.pod);
19
20 WriteMakefile(
21         NAME => 'PublicInbox',
22         VERSION => '1.1.0-pre1',
23         AUTHOR => 'Eric Wong <e@80x24.org>',
24         ABSTRACT => 'public-inbox server infrastructure',
25         EXE_FILES => \@EXE_FILES,
26         PREREQ_PM => {
27                 # note: we use spamc(1), NOT the Perl modules
28                 # We also depend on git.
29                 # Keep this sorted and synced to the INSTALL document
30                 'Date::Parse' => 0,
31                 'Email::MIME' => 0,
32
33                 # the following should be pulled in by Email::MIME:
34                 'Email::MIME::ContentType' => 0,
35                 'Email::Simple' => 0,
36
37                 # "libencode-perl" on Debian, `perl5' on FreeBSD
38                 'Encode::MIME::Header' => 0,
39
40                 # libperl$PERL_VERSION on Debian, `perl5' on FreeBSD,
41                 # but Fedora seems to need this separately
42                 'Devel::Peek' => 0,
43
44                 # TODO: these should really be made optional...
45                 'Plack' => 0,
46                 'URI::Escape' => 0,
47
48                 # We have more test dependencies, but do not force
49                 # users to install them.  See INSTALL
50         },
51         MAN3PODS => \%man3,
52 );
53
54 sub MY::postamble {
55   <<EOF;
56 # support using eatmydata to speed up tests (apt-get install eatmydata):
57 # https://www.flamingspork.com/projects/libeatmydata/
58 EATMYDATA =
59 -include config.mak
60 -include Documentation/include.mk
61 N ?= \$(shell echo \$\$(( \$\$(nproc 2>/dev/null || echo 2) + 1)))
62 SCRIPTS := scripts/ssoma-replay
63 my_syntax := \$(addsuffix .syntax, $PM_FILES \$(EXE_FILES) \$(SCRIPTS))
64
65
66 %.syntax ::
67         @\$(PERL) -I lib -c \$(subst .syntax,,\$@)
68
69 syntax:: \$(my_syntax)
70
71 check-manifest :: MANIFEST
72         if git ls-files >\$<.gen 2>&1; then diff -u \$< \$<.gen; fi
73
74 check:: pure_all check-manifest
75         \$(EATMYDATA) prove -lv -j\$(N)
76
77 lib/PublicInbox/UserContent.pm :: contrib/css/216dark.css
78         @\$(PERL) -I lib \$@ \$<
79
80 EOF
81 }