comment: Better fix to avoid showing comments of subpages, while not breaking manual...
[ikiwiki.git] / Makefile.PL
blobdf677262b367b4a6ba4884f7cb51ec12f0278f3f
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use ExtUtils::MakeMaker;
6 # Add a few more targets.
7 sub MY::postamble {
8 q{
9 all:: extra_build
10 clean:: extra_clean
11 install:: extra_install
12 pure_install:: extra_install
14 VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'<debian/changelog)
16 # Parameterized programs used by Makefile.
17 FIND?=find
18 SED?=sed
20 # Additional configurable path variables.
21 W3M_CGI_BIN?=$(PREFIX)/lib/w3m/cgi-bin
23 tflag=$(shell if [ -n "$$NOTAINT" ] && [ "$$NOTAINT" != 1 ]; then printf -- "-T"; fi)
24 extramodules=$(shell if [ "$$PROFILE" = 1 ]; then printf -- "-d:NYTProf"; fi)
25 outprogs=ikiwiki.out ikiwiki-transition.out ikiwiki-calendar.out
26 scripts=ikiwiki-update-wikilist ikiwiki-makerepo
28 PROBABLE_INST_LIB=$(shell \\
29 if [ "$(INSTALLDIRS)" = "perl" ]; then \\
30 echo $(INSTALLPRIVLIB); \\
31 elif [ "$(INSTALLDIRS)" = "site" ]; then \\
32 echo $(INSTALLSITELIB); \\
33 elif [ "$(INSTALLDIRS)" = "vendor" ]; then \\
34 echo $(INSTALLVENDORLIB); \\
35 fi \\
38 %.out: %.in
39 ./pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB) < $< > $@
40 chmod +x $@
42 ikiwiki.setup:
43 HOME=/home/me $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.in -dumpsetup ikiwiki.setup
45 extra_build: $(outprogs) ikiwiki.setup docwiki
46 ./mdwn2man ikiwiki 1 doc/usage.mdwn > ikiwiki.man
47 ./mdwn2man ikiwiki-mass-rebuild 8 doc/ikiwiki-mass-rebuild.mdwn > ikiwiki-mass-rebuild.man
48 ./mdwn2man ikiwiki-makerepo 1 doc/ikiwiki-makerepo.mdwn > ikiwiki-makerepo.man
49 ./mdwn2man ikiwiki-transition 1 doc/ikiwiki-transition.mdwn > ikiwiki-transition.man
50 ./mdwn2man ikiwiki-update-wikilist 1 doc/ikiwiki-update-wikilist.mdwn > ikiwiki-update-wikilist.man
51 ./mdwn2man ikiwiki-calendar 1 doc/ikiwiki-calendar.mdwn > ikiwiki-calendar.man
52 $(MAKE) -C po
53 $(SED) -i.bkp "s/Version:.*/Version: $(VER)/" ikiwiki.spec
54 rm -f ikiwiki.spec.bkp
56 docwiki:
57 $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.in -setup docwiki.setup -refresh
59 extra_clean:
60 $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.in -setup docwiki.setup -clean
61 rm -f *.man $(outprogs) ikiwiki.setup plugins/*.pyc
62 $(MAKE) -C po clean
64 # Joey uses this before committing.
65 myclean: clean
66 git checkout po ikiwiki.spec
68 underlay_install:
69 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki
70 for dir in `cd underlays && $(FIND) . -follow -type d ! -regex '.*\.svn.*'`; do \
71 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
72 for file in `$(FIND) underlays/$$dir -follow -maxdepth 1 -type f`; do \
73 cp -aL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir 2>/dev/null || \
74 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
75 done; \
76 done
78 # The directive docs become their own special underlay.
79 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive
80 for file in doc/ikiwiki/directive/*; do \
81 if [ -f "$$file" ]; then \
82 cp -aL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive 2>/dev/null || \
83 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive; \
84 fi \
85 done
87 # Themes have their base.css (if present) and then
88 # style.css appended to the normal one.
89 for theme in themes/*; do \
90 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$theme; \
91 for file in $$theme/*; do \
92 if echo "$$file" | grep -q style.css; then \
93 (cat doc/style.css; cat $$theme/base.css 2>/dev/null; cat $$file) >> $(DESTDIR)$(PREFIX)/share/ikiwiki/$$theme/style.css; \
94 elif echo "$$file" | grep -q base.css; then \
95 :; \
96 elif [ -f "$$file" ]; then \
97 cp -aL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$file 2>/dev/null || \
98 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$file; \
99 fi \
100 done; \
101 done
103 extra_install: underlay_install
104 # Install example sites.
105 for dir in `cd doc/examples; $(FIND) . -type d ! -regex '.*\.svn.*'`; do \
106 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$dir; \
107 done
108 for file in `cd doc/examples; $(FIND) . -type f ! -regex '.*\.svn.*'`; do \
109 cp -aL doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file 2>/dev/null || \
110 install -m 644 doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file; \
111 done
113 for dir in `$(FIND) templates -follow -type d ! -regex '.*\.svn.*'`; do \
114 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
115 for file in `$(FIND) $$dir -follow -maxdepth 1 -type f`; do \
116 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
117 done; \
118 done
120 install -d $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins
121 for file in `$(FIND) plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* -name \*.py`; do \
122 install -m 644 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
123 done
124 for file in `$(FIND) plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* ! -name \*.py ! -name \*.pyc`; do \
125 install -m 755 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
126 done
128 install -d $(DESTDIR)$(PREFIX)/share/man/man1
129 install -m 644 ikiwiki.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki.1
130 install -m 644 ikiwiki-makerepo.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-makerepo.1
131 install -m 644 ikiwiki-transition.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-transition.1
132 install -m 644 ikiwiki-update-wikilist.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-update-wikilist.1
133 install -m 644 ikiwiki-calendar.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-calendar.1
135 install -d $(DESTDIR)$(PREFIX)/share/man/man8
136 install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(PREFIX)/share/man/man8/ikiwiki-mass-rebuild.8
138 install -d $(DESTDIR)$(PREFIX)/sbin
139 install ikiwiki-mass-rebuild $(DESTDIR)$(PREFIX)/sbin
141 install -d $(DESTDIR)$(W3M_CGI_BIN)
142 install ikiwiki-w3m.cgi $(DESTDIR)$(W3M_CGI_BIN)
144 install -d $(DESTDIR)$(PREFIX)/bin
145 for prog in $(outprogs) $(scripts); do \
146 install $$prog $(DESTDIR)$(PREFIX)/bin/$$(echo $$prog | $(SED) 's/\.out//'); \
147 done
149 $(MAKE) -C po install DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
151 # These might fail if a regular user is installing into a home
152 # directory.
153 -install -d $(DESTDIR)/etc/ikiwiki
154 -install -m 0644 wikilist $(DESTDIR)/etc/ikiwiki
155 -install -m 0644 auto.setup $(DESTDIR)/etc/ikiwiki
156 -install -m 0644 auto-blog.setup $(DESTDIR)/etc/ikiwiki
160 WriteMakefile(
161 NAME => 'IkiWiki',
162 PREFIX => "/usr/local",
163 PM_FILTER => './pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB)',
164 MAN1PODS => {},
165 PREREQ_PM => {
166 'XML::Simple' => "0",
167 'Text::Markdown' => "0",
168 'Date::Parse' => "0",
169 'HTML::Template' => "0",
170 'HTML::Scrubber' => "0",
171 'CGI::FormBuilder' => "3.02.02",
172 'CGI::Session' => "0",
173 'Mail::Sendmail' => "0",
174 'HTML::Parser' => "0",
175 'URI' => "0",
176 'Data::Dumper' => "2.11",