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>
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);
11 $v->{txt} = [ qw(INSTALL README COPYING TODO HACKING) ];
12 my @dtxt = grep(m!\ADocumentation/.*\.txt\z!, @manifest);
13 push @dtxt, 'Documentation/standards.txt';
16 $html =~ s/\.txt\z/.html/;
17 $t->{"$html : $txt"} = [ "\$(txt2pre) <$txt" ];
19 $v->{t_slash_star_dot_t} = [ grep(m!\At/.*\.t\z!, @manifest) ];
20 my @scripts = qw(scripts/ssoma-replay); # legacy
21 my @syn = (@EXE_FILES, grep(m!^lib/.*\.pm$!, @manifest), @scripts);
22 @syn = grep(!/DSKQXS\.pm/, @syn) if !eval { require IO::KQueue };
23 @syn = grep(!/Unsubscribe\.pm/, @syn) if !eval { require Crypt::CBC };
24 @syn = grep(!/SaPlugin/, @syn) if !eval { require Mail::SpamAssasin };
25 $v->{syn_files} = \@syn;
26 $v->{my_syntax} = [map { "$_.syntax" } @syn];
27 $v->{-m1} = [ map { (split('/'))[-1] } @EXE_FILES ];
28 $v->{-m5} = [ qw(public-inbox-config public-inbox-v1-format
29 public-inbox-v2-format) ];
30 $v->{-m7} = [ qw(public-inbox-overview) ];
31 $v->{-m8} = [ qw(public-inbox-daemon) ];
32 my @sections = (1, 5, 7, 8);
36 for my $i (@sections) {
37 my $ary = $v->{"-m$i"};
40 my $pod = "Documentation/$m.pod";
41 my $txt = "Documentation/$m.txt";
42 $t->{"$m.$i : $pod"} = [ "\$(podman) -s$i $pod \$@" ];
43 $t->{"$txt : $pod"} = [ "\$(podtext) $pod \$\@+",
44 "touch -r $pod \$\@+",
46 $t->{"Documentation/$m.html : $txt"} = [ "\$(txt2pre) <$txt" ];
47 $t->{".$m.cols : $m.$i"} = [
48 "\@echo CHECK80 $m.$i;".
49 "COLUMNS=80 \$(MAN) ./$m.$i | \$(check_man)" ];
51 push @{$v->{check_80}}, map { ".$_.cols" } @$ary;
52 my $manuals = $v->{"man$i"} = [ map { "$_.$i" } @$ary ];
53 push @{$v->{manuals}}, @$manuals;
54 push @{$v->{mantxt}}, map { "Documentation/$_.txt" } @$ary;
56 push @dtxt, @{$v->{mantxt}};
57 $v->{docs} = [ @dtxt, 'NEWS' ];
58 $v->{docs_html} = [ map {;
63 $v->{gz_docs} = [ map { "$_.gz" } (@{$v->{docs}},@{$v->{docs_html}}) ];
64 $v->{rsync_docs} = [ @{$v->{gz_docs}}, @{$v->{docs}},
65 @{$v->{docs_html}}, qw(NEWS.atom NEWS.atom.gz)];
67 # external manpages which we host ourselves, since some packages
68 # (currently just Xapian) doesn't host manpages themselves.
69 my @xman = qw(copydatabase.1 xapian-compact.1);
70 $v->{xdocs} = [ map { "Documentation/.x/.$_.txt" } @xman ];
71 $v->{xdocs_html} = [ map { "Documentation/.x/.$_.html" } @xman ];
72 for (@{$v->{xdocs}}) {
73 $t->{"$_ : | Documentation/.x"} = [
74 '$(PERL) -w Documentation/extman.perl $@ >$@+',
78 $html =~ s/\.txt\z/.html/;
79 $t->{"$html : $_"} = [ "\$(txt2pre) <$_" ];
81 $v->{gz_xdocs} = [ map { "$_.gz" } (@{$v->{xdocs_html}}, @{$v->{xdocs}}) ];
82 $v->{rsync_xdocs} = [ @{$v->{gz_xdocs}}, @{$v->{xdocs_html}}, @{$v->{xdocs}} ];
84 my $TGTS = join("\n", map {;
87 "$tgt_prereq\n".join('', map { "\t$_\n" } @$cmds);
90 my $VARS = join("\n", map {;
92 join('', map { "$varname += $_\n" } sort @{$v->{$varname}});
93 } grep(!/^-/, sort keys %$v));
95 # Don't waste user's disk space by installing some pods from
96 # imported code or internal use only
97 my %man3 = map {; # semi-colon tells Perl this is a BLOCK (and not EXPR)
102 "lib/PublicInbox/$_" => "blib/man3/PublicInbox::$mod.3"
103 } qw(Git.pm Import.pm WWW.pod SaPlugin/ListMirror.pod);
106 NAME => 'PublicInbox',
108 AUTHOR => 'Eric Wong <e@80x24.org>',
109 ABSTRACT => 'public-inbox server infrastructure',
110 EXE_FILES => \@EXE_FILES,
112 # note: we use spamc(1), NOT the Perl modules
113 # We also depend on git.
114 # Keep this sorted and synced to the INSTALL document
116 # libperl$PERL_VERSION,
118 # perl-Digest-SHA on RH-based
122 # the following should be pulled in by Email::MIME:
123 'Email::MIME::ContentType' => 0,
124 'Email::Simple' => 0,
126 # libperl$PERL_VERSION or libencode-perl on Debian,
130 # TODO: these should really be made optional...
134 # We have more test dependencies, but do not force
135 # users to install them. See INSTALL
137 # All Perl installs I know about have these, but RH-based
138 # distros make them separate even though 'perl' pulls them in
140 'File::Temp' => '0.19',
143 # ExtUtils::MakeMaker # this file won't run w/o it...
151 # support using eatmydata to speed up tests (apt-get install eatmydata):
152 # https://www.flamingspork.com/projects/libeatmydata/
154 N = \$\$(( \$\$(nproc 2>/dev/null || gnproc 2>/dev/null || echo 2) + 1 ))
157 -include Documentation/include.mk
160 # syntax checks are currently GNU make only:
162 @\$(PERL) -w -I lib -c \$<
164 syntax:: \$(my_syntax)
166 changed = \$(shell git ls-files -m)
167 dsyn :: \$(addsuffix .syntax, \$(filter \$(changed), \$(syn_files)))
169 check-manifest :: MANIFEST
170 if test -e .git && git ls-files >\$?.gen 2>&1; then \\
171 diff -u \$? \$?.gen; fi
173 # the traditional way running per-*.t processes:
174 check-each :: pure_all check-manifest
175 \$(EATMYDATA) \$(PROVE) --state=save -bvw -j\$(N)
177 # lightly-tested way to run tests, relies "--state=save" in check-each
178 # for best performance
179 check-run :: pure_all check-manifest
180 \$(EATMYDATA) \$(PROVE) -bvw t/run.perl :: -j\$(N)
184 lib/PublicInbox/UserContent.pm :: contrib/css/216dark.css
185 \$(PERL) -I lib \$@ \$?
187 # Ensure new .pm files will always be installed by updating
188 # the timestamp of Makefile.PL which forces Makefile to be remade
189 Makefile.PL : MANIFEST
190 touch -r MANIFEST \$@