2 # Copyright (C) 2013-2020 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 my @RELEASES = qw(v1.3.0 v1.2.0 v1.1.0-pre1 v1.0.0); # do not sort
12 $v->{news_deps} = [ map { "Documentation/RelNotes/$_.eml" } @RELEASES ];
13 $v->{txt} = [ qw(INSTALL README COPYING TODO HACKING) ];
14 my @dtxt = grep(m!\ADocumentation/[^/]+\.txt\z!, @manifest);
15 push @dtxt, 'Documentation/standards.txt';
16 push @dtxt, 'Documentation/flow.txt';
17 push @dtxt, @{$v->{txt}};
20 $html =~ s/\.txt\z/.html/ or $html .= '.html';
21 $t->{"$html : $txt"} = [ "\$(txt2pre) <$txt" ];
23 $v->{t_slash_star_dot_t} = [ grep(m!\At/.*\.t\z!, @manifest) ];
24 my @scripts = qw(scripts/ssoma-replay); # legacy
25 my @syn = (@EXE_FILES, grep(m!^lib/.*\.pm$!, @manifest), @scripts);
26 @syn = grep(!/DSKQXS\.pm/, @syn) if !eval { require IO::KQueue };
27 @syn = grep(!/Unsubscribe\.pm/, @syn) if !eval { require Crypt::CBC };
28 @syn = grep(!/SaPlugin/, @syn) if !eval { require Mail::SpamAssasin };
29 $v->{syn_files} = \@syn;
30 $v->{my_syntax} = [map { "$_.syntax" } @syn];
31 $v->{-m1} = [ map { (split('/'))[-1] } @EXE_FILES ];
32 $v->{-m5} = [ qw(public-inbox-config public-inbox-v1-format
33 public-inbox-v2-format) ];
34 $v->{-m7} = [ qw(public-inbox-overview) ];
35 $v->{-m8} = [ qw(public-inbox-daemon) ];
36 my @sections = (1, 5, 7, 8);
40 for my $i (@sections) {
41 my $ary = $v->{"-m$i"};
44 my $pod = "Documentation/$m.pod";
45 my $txt = "Documentation/$m.txt";
46 $t->{"$m.$i : $pod"} = [ "\$(podman) -s$i $pod \$@" ];
47 $t->{"$txt : $pod"} = [ "\$(podtext) $pod \$\@+",
48 "touch -r $pod \$\@+",
50 $t->{"Documentation/$m.html : $txt"} = [ "\$(txt2pre) <$txt" ];
51 $t->{".$m.cols : $m.$i"} = [
52 "\@echo CHECK80 $m.$i;".
53 "COLUMNS=80 \$(MAN) ./$m.$i | \$(check_man)" ];
55 push @{$v->{check_80}}, map { ".$_.cols" } @$ary;
56 my $manuals = $v->{"man$i"} = [ map { "$_.$i" } @$ary ];
57 push @{$v->{manuals}}, @$manuals;
58 push @{$v->{mantxt}}, map { "Documentation/$_.txt" } @$ary;
60 push @dtxt, @{$v->{mantxt}};
61 $v->{docs} = [ @dtxt, 'NEWS' ];
62 $v->{docs_html} = [ map {;
67 $v->{gz_docs} = [ map { "$_.gz" } (@{$v->{docs}},@{$v->{docs_html}}) ];
68 $v->{rsync_docs} = [ @{$v->{gz_docs}}, @{$v->{docs}},
69 @{$v->{docs_html}}, qw(NEWS.atom NEWS.atom.gz)];
71 # external manpages which we host ourselves, since some packages
72 # (currently just Xapian) doesn't host manpages themselves.
73 my @xman = qw(copydatabase.1 xapian-compact.1);
74 $v->{xdocs} = [ map { "Documentation/.$_.txt" } @xman ];
75 $v->{xdocs_html} = [ map { "Documentation/.$_.html" } @xman ];
76 for (@{$v->{xdocs}}) {
78 '$(PERL) -w Documentation/extman.perl $@ >$@+',
82 $html =~ s/\.txt\z/.html/;
83 $t->{"$html : $_"} = [ "\$(txt2pre) <$_" ];
85 $v->{gz_xdocs} = [ map { "$_.gz" } (@{$v->{xdocs_html}}, @{$v->{xdocs}}) ];
86 $v->{rsync_xdocs} = [ @{$v->{gz_xdocs}}, @{$v->{xdocs_html}}, @{$v->{xdocs}} ];
88 my $TGTS = join("\n", map {;
91 "$tgt_prereq\n".join('', map { "\t$_\n" } @$cmds);
94 my $VARS = join("\n", map {;
96 join('', map { "$varname += $_\n" } sort @{$v->{$varname}});
97 } grep(!/^-/, sort keys %$v));
98 $VARS .= "\nRELEASES = ".join(' ', @RELEASES)."\n";
100 # Don't waste user's disk space by installing some pods from
101 # imported code or internal use only
102 my %man3 = map {; # semi-colon tells Perl this is a BLOCK (and not EXPR)
107 "lib/PublicInbox/$_" => "blib/man3/PublicInbox::$mod.3"
108 } qw(Git.pm Import.pm WWW.pod SaPlugin/ListMirror.pod);
111 NAME => 'PublicInbox',
113 AUTHOR => 'Eric Wong <e@yhbt.net>',
114 ABSTRACT => 'public-inbox server infrastructure',
115 EXE_FILES => \@EXE_FILES,
117 # note: we use spamc(1), NOT the Perl modules
118 # We also depend on git.
119 # Keep this sorted and synced to the INSTALL document
121 # libperl$PERL_VERSION,
123 # perl-Digest-SHA on RH-based
127 # the following should be pulled in by Email::MIME:
128 'Email::MIME::ContentType' => 0,
129 'Email::Simple' => 0,
131 # libperl$PERL_VERSION or libencode-perl on Debian,
135 # Plack is needed for public-inbox-httpd and PublicInbox::WWW
138 # Filesys::Notify::Simple is pulled in by Plack, but also
139 # needed by public-inbox-watch (for now)
140 # 'Filesys::Notify::Simple' => 0,
142 # TODO: this should really be made optional...
145 # We have more test dependencies, but do not force
146 # users to install them. See INSTALL
148 # All Perl installs I know about have these, but RH-based
149 # distros make them separate even though 'perl' pulls them in
151 'File::Temp' => '0.19', # for ->tmpdir support
154 # ExtUtils::MakeMaker # this file won't run w/o it...
162 # support using eatmydata to speed up tests (apt-get install eatmydata):
163 # https://www.flamingspork.com/projects/libeatmydata/
165 N = \$\$(( \$\$(nproc 2>/dev/null || gnproc 2>/dev/null || echo 2) + 1 ))
168 -include Documentation/include.mk
171 # syntax checks are currently GNU make only:
173 @\$(PERL) -w -I lib -c \$<
175 syntax:: \$(my_syntax)
177 changed = \$(shell git ls-files -m)
178 dsyn :: \$(addsuffix .syntax, \$(filter \$(changed), \$(syn_files)))
180 check-manifest :: MANIFEST
181 if test -e .git && git ls-files >\$?.gen 2>&1; then \\
182 diff -u \$? \$?.gen; fi
184 # the traditional way running per-*.t processes:
185 check-each :: pure_all check-manifest
186 \$(EATMYDATA) \$(PROVE) --state=save -bvw -j\$(N)
188 # lightly-tested way to run tests, relies "--state=save" in check-each
189 # for best performance
190 check-run :: pure_all check-manifest
191 \$(EATMYDATA) \$(PROVE) -bvw t/run.perl :: -j\$(N)
195 lib/PublicInbox/UserContent.pm :: contrib/css/216dark.css
196 \$(PERL) -I lib \$@ \$?
198 # Ensure new .pm files will always be installed by updating
199 # the timestamp of Makefile.PL which forces Makefile to be remade
200 Makefile.PL : MANIFEST
201 touch -r MANIFEST \$@