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