add test case for RSS url munging
[ikiwiki.git] / Makefile.PL
blobb28968417968ab175c7135f9aa45d619bce42e4a
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: $$(perl -e '$$_=<>;print m/\((.*?)\)/'<debian/changelog)/" 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 style.css appended to the normal one.
88 for theme in themes/*; do \
89 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$theme; \
90 for file in $$theme/*; do \
91 if echo "$$file" | grep -q style.css; then \
92 (cat doc/style.css; cat $$file) >> $(DESTDIR)$(PREFIX)/share/ikiwiki/$$theme/style.css; \
93 elif [ -f "$$file" ]; then \
94 cp -aL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$file 2>/dev/null || \
95 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$file; \
96 fi \
97 done; \
98 done
100 extra_install: underlay_install
101 # Install example sites.
102 for dir in `cd doc/examples; $(FIND) . -type d ! -regex '.*\.svn.*'`; do \
103 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$dir; \
104 done
105 for file in `cd doc/examples; $(FIND) . -type f ! -regex '.*\.svn.*'`; do \
106 cp -aL doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file 2>/dev/null || \
107 install -m 644 doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file; \
108 done
110 for dir in `$(FIND) templates -follow -type d ! -regex '.*\.svn.*'`; do \
111 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
112 for file in `$(FIND) $$dir -follow -maxdepth 1 -type f`; do \
113 install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
114 done; \
115 done
117 install -d $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins
118 for file in `$(FIND) plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* -name \*.py`; do \
119 install -m 644 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
120 done
121 for file in `$(FIND) plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* ! -name \*.py ! -name \*.pyc`; do \
122 install -m 755 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
123 done
125 install -d $(DESTDIR)$(PREFIX)/share/man/man1
126 install -m 644 ikiwiki.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki.1
127 install -m 644 ikiwiki-makerepo.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-makerepo.1
128 install -m 644 ikiwiki-transition.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-transition.1
129 install -m 644 ikiwiki-update-wikilist.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-update-wikilist.1
130 install -m 644 ikiwiki-calendar.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-calendar.1
132 install -d $(DESTDIR)$(PREFIX)/share/man/man8
133 install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(PREFIX)/share/man/man8/ikiwiki-mass-rebuild.8
135 install -d $(DESTDIR)$(PREFIX)/sbin
136 install ikiwiki-mass-rebuild $(DESTDIR)$(PREFIX)/sbin
138 install -d $(DESTDIR)$(W3M_CGI_BIN)
139 install ikiwiki-w3m.cgi $(DESTDIR)$(W3M_CGI_BIN)
141 install -d $(DESTDIR)$(PREFIX)/bin
142 for prog in $(outprogs) $(scripts); do \
143 install $$prog $(DESTDIR)$(PREFIX)/bin/$$(echo $$prog | $(SED) 's/\.out//'); \
144 done
146 $(MAKE) -C po install DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
148 # These might fail if a regular user is installing into a home
149 # directory.
150 -install -d $(DESTDIR)/etc/ikiwiki
151 -install -m 0644 wikilist $(DESTDIR)/etc/ikiwiki
152 -install -m 0644 auto.setup $(DESTDIR)/etc/ikiwiki
153 -install -m 0644 auto-blog.setup $(DESTDIR)/etc/ikiwiki
157 WriteMakefile(
158 NAME => 'IkiWiki',
159 PREFIX => "/usr/local",
160 PM_FILTER => './pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB)',
161 MAN1PODS => {},
162 PREREQ_PM => {
163 'XML::Simple' => "0",
164 'Text::Markdown' => "0",
165 'Date::Parse' => "0",
166 'HTML::Template' => "0",
167 'HTML::Scrubber' => "0",
168 'CGI::FormBuilder' => "3.02.02",
169 'CGI::Session' => "0",
170 'Mail::Sendmail' => "0",
171 'HTML::Parser' => "0",
172 'URI' => "0",
173 'Data::Dumper' => "2.11",