]> sipb.mit.edu Git - ikiwiki.git/blob - Makefile.PL
Note change in src-highlight plugin
[ikiwiki.git] / Makefile.PL
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use ExtUtils::MakeMaker;
5
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
13
14 VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'<debian/changelog)
15
16 PROBABLE_INST_LIB=$(shell \\
17         if [ "$(INSTALLDIRS)" = "perl" ]; then \\
18                 echo $(INSTALLPRIVLIB); \\
19         elif [ "$(INSTALLDIRS)" = "site" ]; then \\
20                 echo $(INSTALLSITELIB); \\
21         elif [ "$(INSTALLDIRS)" = "vendor" ]; then \\
22                 echo $(INSTALLVENDORLIB); \\
23         fi \\
24 )
25
26 tflag=$(shell if [ -n "$$NOTAINT" ] && [ "$$NOTAINT" != 1 ]; then printf -- "-T"; fi)
27 extramodules=$(shell if [ "$$PROFILE" = 1 ]; then printf -- "-d:Profile"; fi)
28
29 ikiwiki.out: ikiwiki.in
30         ./pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB) < ikiwiki.in > ikiwiki.out
31         chmod +x ikiwiki.out
32
33 ikiwiki.setup: ikiwiki.out
34         HOME=/home/me $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.out -libdir . -dumpsetup ikiwiki.setup
35
36 extra_build: ikiwiki.out ikiwiki.setup docwiki
37         ./mdwn2man ikiwiki 1 doc/usage.mdwn > ikiwiki.man
38         ./mdwn2man ikiwiki-mass-rebuild 8 doc/ikiwiki-mass-rebuild.mdwn > ikiwiki-mass-rebuild.man
39         ./mdwn2man ikiwiki-makerepo 1 doc/ikiwiki-makerepo.mdwn > ikiwiki-makerepo.man
40         ./mdwn2man ikiwiki-transition 1 doc/ikiwiki-transition.mdwn > ikiwiki-transition.man
41         ./mdwn2man ikiwiki-update-wikilist 1 doc/ikiwiki-update-wikilist.mdwn > ikiwiki-update-wikilist.man
42         $(MAKE) -C po mo
43         
44 docwiki: ikiwiki.out
45         $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.out -libdir . -setup docwiki.setup -refresh
46
47 extra_clean:
48         rm -rf html doc/.ikiwiki
49         rm -f *.man ikiwiki.out ikiwiki.setup plugins/*.pyc
50         $(MAKE) -C po clean
51
52 extra_install:
53         install -d $(DESTDIR)$(PREFIX)/share/ikiwiki
54         for dir in `cd underlays && find . -follow -type d ! -regex '.*\.svn.*'`; do \
55                 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
56                 for file in `find underlays/$$dir -follow -maxdepth 1 -type f`; do \
57                         cp -aL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir || \
58                         install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
59                 done; \
60         done
61
62         # The directive docs become their own special underlay.
63         install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive
64         for file in doc/ikiwiki/directive/*; do \
65                 if [ -f "$$file" ]; then \
66                         install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive; \
67                 fi \
68         done
69
70         for dir in `find templates -follow -type d ! -regex '.*\.svn.*'`; do \
71                 install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
72                 for file in `find $$dir -follow -maxdepth 1 -type f`; do \
73                         install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
74                 done; \
75         done
76         
77         install -d $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins
78         for file in `find plugins -maxdepth 1 -type f ! -wholename plugins/.\* ! -name \*demo\* -name \*.py`; do \
79                 install -m 644 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
80         done
81         for file in `find plugins -maxdepth 1 -type f ! -wholename plugins/.\* ! -name \*demo\* ! -name \*.py ! -name \*.pyc`; do \
82                 install -m 755 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
83         done
84
85         install -d $(DESTDIR)$(PREFIX)/share/man/man1
86         install -m 644 ikiwiki.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki.1
87         install -m 644 ikiwiki-makerepo.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-makerepo.1
88         install -m 644 ikiwiki-transition.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-transition.1
89         install -m 644 ikiwiki-update-wikilist.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-update-wikilist.1
90         
91         install -d $(DESTDIR)$(PREFIX)/share/man/man8
92         install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(PREFIX)/share/man/man8/ikiwiki-mass-rebuild.8
93         
94         install -d $(DESTDIR)$(PREFIX)/sbin
95         install ikiwiki-mass-rebuild $(DESTDIR)$(PREFIX)/sbin
96
97         install -d $(DESTDIR)$(PREFIX)/lib/w3m/cgi-bin
98         install ikiwiki-w3m.cgi $(DESTDIR)$(PREFIX)/lib/w3m/cgi-bin
99
100         install -d $(DESTDIR)$(PREFIX)/bin
101         install ikiwiki.out $(DESTDIR)$(PREFIX)/bin/ikiwiki
102         install ikiwiki-makerepo ikiwiki-transition ikiwiki-update-wikilist $(DESTDIR)$(PREFIX)/bin/
103
104         $(MAKE) -C po install DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
105         
106         # These might fail if a regular user is installing into a home
107         # directory.
108         -install -d $(DESTDIR)/etc/ikiwiki
109         -install -m 0644 wikilist $(DESTDIR)/etc/ikiwiki
110         -install -m 0644 auto.setup $(DESTDIR)/etc/ikiwiki
111 }
112 }
113
114 WriteMakefile(
115         NAME            => 'IkiWiki',
116         PREFIX          => "/usr/local",
117         PM_FILTER       => './pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB)',
118         MAN1PODS        => {},
119         PREREQ_PM       => {
120                 'XML::Simple'           => 0,
121                 'Text::Markdown'        => 0,
122                 'Date::Parse'           => 0,
123                 'HTML::Template'        => 0,
124                 'HTML::Scrubber'        => 0,
125                 'CGI::FormBuilder'      => 3.02.02,
126                 'CGI::Session'          => 0,
127                 'Mail::Sendmail'        => 0,
128                 'HTML::Parser'          => 0,
129                 'URI'                   => 0,
130                 'Data::Dumper'          => 2.11,
131         },
132 );