summaryrefslogtreecommitdiff
path: root/Makefile.PL
blob: 93f9e89e2ab3314e6cc4ed85321c7168a3f1f67d (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. extra_clean:
  41. rm -rf html doc/.ikiwiki
  42. rm -f *.man ikiwiki.out ikiwiki.setup plugins/*.pyc
  43. $(MAKE) -C po clean
  44. extra_install:
  45. install -d $(DESTDIR)$(PREFIX)/share/ikiwiki
  46. for dir in `cd underlays && find . -follow -type d ! -regex '.*\.svn.*'`; do \
  47. install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
  48. for file in `find underlays/$$dir -follow -maxdepth 1 -type f`; do \
  49. cp -aL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir 2>/dev/null || \
  50. install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
  51. done; \
  52. done
  53. # The directive docs become their own special underlay.
  54. install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive
  55. for file in doc/ikiwiki/directive/*; do \
  56. if [ -f "$$file" ]; then \
  57. install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive; \
  58. fi \
  59. done
  60. # Install example sites.
  61. for dir in `cd doc/examples; find . -type d ! -regex '.*\.svn.*'`; do \
  62. install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$dir; \
  63. done
  64. for file in `cd doc/examples; find . -type f ! -regex '.*\.svn.*'`; do \
  65. cp -aL doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file 2>/dev/null || \
  66. install -m 644 doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file; \
  67. done
  68. for dir in `find templates -follow -type d ! -regex '.*\.svn.*'`; do \
  69. install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
  70. for file in `find $$dir -follow -maxdepth 1 -type f`; do \
  71. install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
  72. done; \
  73. done
  74. install -d $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins
  75. for file in `find plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* -name \*.py`; do \
  76. install -m 644 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
  77. done
  78. for file in `find plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* ! -name \*.py ! -name \*.pyc`; do \
  79. install -m 755 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
  80. done
  81. install -d $(DESTDIR)$(PREFIX)/share/man/man1
  82. install -m 644 ikiwiki.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki.1
  83. install -m 644 ikiwiki-makerepo.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-makerepo.1
  84. install -m 644 ikiwiki-transition.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-transition.1
  85. install -m 644 ikiwiki-update-wikilist.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-update-wikilist.1
  86. install -d $(DESTDIR)$(PREFIX)/share/man/man8
  87. install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(PREFIX)/share/man/man8/ikiwiki-mass-rebuild.8
  88. install -d $(DESTDIR)$(PREFIX)/sbin
  89. install ikiwiki-mass-rebuild $(DESTDIR)$(PREFIX)/sbin
  90. install -d $(DESTDIR)$(W3M_CGI_BIN)
  91. install ikiwiki-w3m.cgi $(DESTDIR)$(W3M_CGI_BIN)
  92. install -d $(DESTDIR)$(PREFIX)/bin
  93. install ikiwiki.out $(DESTDIR)$(PREFIX)/bin/ikiwiki
  94. install ikiwiki-makerepo ikiwiki-transition ikiwiki-update-wikilist $(DESTDIR)$(PREFIX)/bin/
  95. $(MAKE) -C po install DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
  96. # These might fail if a regular user is installing into a home
  97. # directory.
  98. -install -d $(DESTDIR)/etc/ikiwiki
  99. -install -m 0644 wikilist $(DESTDIR)/etc/ikiwiki
  100. -install -m 0644 auto.setup $(DESTDIR)/etc/ikiwiki
  101. -install -m 0644 auto-blog.setup $(DESTDIR)/etc/ikiwiki
  102. }
  103. }
  104. WriteMakefile(
  105. NAME => 'IkiWiki',
  106. PREFIX => "/usr/local",
  107. PM_FILTER => './pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB)',
  108. MAN1PODS => {},
  109. PREREQ_PM => {
  110. 'XML::Simple' => 0,
  111. 'Text::Markdown' => 0,
  112. 'Date::Parse' => 0,
  113. 'HTML::Template' => 0,
  114. 'HTML::Scrubber' => 0,
  115. 'CGI::FormBuilder' => 3.02.02,
  116. 'CGI::Session' => 0,
  117. 'Mail::Sendmail' => 0,
  118. 'HTML::Parser' => 0,
  119. 'URI' => 0,
  120. 'Data::Dumper' => 2.11,
  121. },
  122. );