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