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