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