summaryrefslogtreecommitdiff
path: root/Makefile.PL
blob: b2d027bc4d8843d592e395d82f3073783bbea510 (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:Profile"; fi)
  26. ikiwiki.out: ikiwiki.in
  27. ./pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB) < ikiwiki.in > ikiwiki.out
  28. chmod +x ikiwiki.out
  29. ikiwiki.setup: ikiwiki.out
  30. HOME=/home/me $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.out -libdir . -dumpsetup ikiwiki.setup
  31. extra_build: ikiwiki.out ikiwiki.setup docwiki
  32. ./mdwn2man ikiwiki 1 doc/usage.mdwn > ikiwiki.man
  33. ./mdwn2man ikiwiki-mass-rebuild 8 doc/ikiwiki-mass-rebuild.mdwn > ikiwiki-mass-rebuild.man
  34. ./mdwn2man ikiwiki-makerepo 1 doc/ikiwiki-makerepo.mdwn > ikiwiki-makerepo.man
  35. ./mdwn2man ikiwiki-transition 1 doc/ikiwiki-transition.mdwn > ikiwiki-transition.man
  36. ./mdwn2man ikiwiki-update-wikilist 1 doc/ikiwiki-update-wikilist.mdwn > ikiwiki-update-wikilist.man
  37. $(MAKE) -C po
  38. docwiki: ikiwiki.out
  39. $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.out -libdir . -setup docwiki.setup -refresh
  40. underlaypo: ikiwiki.out
  41. # copy all the files we want to translate into the
  42. # po/underlays scrdir.
  43. for file in `find underlays -follow -name \*.mdwn`; do \
  44. install -d po/$$(dirname $$file); \
  45. cp -aL $$file po/$$file 2>/dev/null || \
  46. install -m 644 $$file po/$$file; \
  47. done
  48. install -d po/underlays/directives/ikiwiki/directive
  49. for file in doc/ikiwiki/directive/*; do \
  50. if [ -f "$$file" ]; then \
  51. install -m 644 $$file po/underlays/directives/ikiwiki/directive; \
  52. fi \
  53. done
  54. $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.out -libdir . -setup underlaypo.setup -refresh
  55. find po/underlays -name \*.mdwn | xargs rm -f
  56. extra_clean:
  57. rm -rf html doc/.ikiwiki
  58. rm -f *.man ikiwiki.out ikiwiki.setup plugins/*.pyc
  59. $(MAKE) -C po clean
  60. rm -rf po/html po/underlays/.ikiwiki
  61. extra_install:
  62. install -d $(DESTDIR)$(PREFIX)/share/ikiwiki
  63. for dir in `cd underlays && find . -follow -type d ! -regex '.*\.svn.*'`; do \
  64. install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
  65. for file in `find underlays/$$dir -follow -maxdepth 1 -type f`; do \
  66. cp -aL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir 2>/dev/null || \
  67. install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
  68. done; \
  69. done
  70. # The directive docs become their own special underlay.
  71. install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive
  72. for file in doc/ikiwiki/directive/*; do \
  73. if [ -f "$$file" ]; then \
  74. install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive; \
  75. fi \
  76. done
  77. # Install example sites.
  78. for dir in `cd doc/examples; find . -type d ! -regex '.*\.svn.*'`; do \
  79. install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$dir; \
  80. done
  81. for file in `cd doc/examples; find . -type f ! -regex '.*\.svn.*'`; do \
  82. cp -aL doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file 2>/dev/null || \
  83. install -m 644 doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file; \
  84. done
  85. for dir in `find templates -follow -type d ! -regex '.*\.svn.*'`; do \
  86. install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
  87. for file in `find $$dir -follow -maxdepth 1 -type f`; do \
  88. install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
  89. done; \
  90. done
  91. install -d $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins
  92. for file in `find plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* -name \*.py`; do \
  93. install -m 644 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
  94. done
  95. for file in `find plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* ! -name \*.py ! -name \*.pyc`; do \
  96. install -m 755 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
  97. done
  98. install -d $(DESTDIR)$(PREFIX)/share/man/man1
  99. install -m 644 ikiwiki.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki.1
  100. install -m 644 ikiwiki-makerepo.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-makerepo.1
  101. install -m 644 ikiwiki-transition.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-transition.1
  102. install -m 644 ikiwiki-update-wikilist.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-update-wikilist.1
  103. install -d $(DESTDIR)$(PREFIX)/share/man/man8
  104. install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(PREFIX)/share/man/man8/ikiwiki-mass-rebuild.8
  105. install -d $(DESTDIR)$(PREFIX)/sbin
  106. install ikiwiki-mass-rebuild $(DESTDIR)$(PREFIX)/sbin
  107. install -d $(DESTDIR)$(W3M_CGI_BIN)
  108. install ikiwiki-w3m.cgi $(DESTDIR)$(W3M_CGI_BIN)
  109. install -d $(DESTDIR)$(PREFIX)/bin
  110. install ikiwiki.out $(DESTDIR)$(PREFIX)/bin/ikiwiki
  111. install ikiwiki-makerepo ikiwiki-transition ikiwiki-update-wikilist $(DESTDIR)$(PREFIX)/bin/
  112. $(MAKE) -C po install DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
  113. # These might fail if a regular user is installing into a home
  114. # directory.
  115. -install -d $(DESTDIR)/etc/ikiwiki
  116. -install -m 0644 wikilist $(DESTDIR)/etc/ikiwiki
  117. -install -m 0644 auto.setup $(DESTDIR)/etc/ikiwiki
  118. -install -m 0644 auto-blog.setup $(DESTDIR)/etc/ikiwiki
  119. }
  120. }
  121. WriteMakefile(
  122. NAME => 'IkiWiki',
  123. PREFIX => "/usr/local",
  124. PM_FILTER => './pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB)',
  125. MAN1PODS => {},
  126. PREREQ_PM => {
  127. 'XML::Simple' => 0,
  128. 'Text::Markdown' => 0,
  129. 'Date::Parse' => 0,
  130. 'HTML::Template' => 0,
  131. 'HTML::Scrubber' => 0,
  132. 'CGI::FormBuilder' => 3.02.02,
  133. 'CGI::Session' => 0,
  134. 'Mail::Sendmail' => 0,
  135. 'HTML::Parser' => 0,
  136. 'URI' => 0,
  137. 'Data::Dumper' => 2.11,
  138. },
  139. );