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