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