summaryrefslogtreecommitdiff
path: root/Makefile.PL
blob: 4001c841b8f79c9a98870f526f2553db615602ca (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. install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive; \
  66. fi \
  67. done
  68. extra_install: underlay_install
  69. # Install example sites.
  70. for dir in `cd doc/examples; find . -type d ! -regex '.*\.svn.*'`; do \
  71. install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$dir; \
  72. done
  73. for file in `cd doc/examples; find . -type f ! -regex '.*\.svn.*'`; do \
  74. cp -aL doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file 2>/dev/null || \
  75. install -m 644 doc/examples/$$file $(DESTDIR)$(PREFIX)/share/ikiwiki/examples/$$file; \
  76. done
  77. for dir in `find templates -follow -type d ! -regex '.*\.svn.*'`; do \
  78. install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
  79. for file in `find $$dir -follow -maxdepth 1 -type f`; do \
  80. install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
  81. done; \
  82. done
  83. install -d $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins
  84. for file in `find plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* -name \*.py`; do \
  85. install -m 644 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
  86. done
  87. for file in `find plugins -maxdepth 1 -type f ! -path plugins/.\* ! -name \*demo\* ! -name \*.py ! -name \*.pyc`; do \
  88. install -m 755 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
  89. done
  90. install -d $(DESTDIR)$(PREFIX)/share/man/man1
  91. install -m 644 ikiwiki.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki.1
  92. install -m 644 ikiwiki-makerepo.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-makerepo.1
  93. install -m 644 ikiwiki-transition.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-transition.1
  94. install -m 644 ikiwiki-update-wikilist.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-update-wikilist.1
  95. install -m 644 ikiwiki-calendar.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-calendar.1
  96. install -d $(DESTDIR)$(PREFIX)/share/man/man8
  97. install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(PREFIX)/share/man/man8/ikiwiki-mass-rebuild.8
  98. install -d $(DESTDIR)$(PREFIX)/sbin
  99. install ikiwiki-mass-rebuild $(DESTDIR)$(PREFIX)/sbin
  100. install -d $(DESTDIR)$(W3M_CGI_BIN)
  101. install ikiwiki-w3m.cgi $(DESTDIR)$(W3M_CGI_BIN)
  102. install -d $(DESTDIR)$(PREFIX)/bin
  103. for prog in $(outprogs) $(scripts); do \
  104. install $$prog $(DESTDIR)$(PREFIX)/bin/$$(echo $$prog | sed 's/\.out//'); \
  105. done
  106. $(MAKE) -C po install DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
  107. # These might fail if a regular user is installing into a home
  108. # directory.
  109. -install -d $(DESTDIR)/etc/ikiwiki
  110. -install -m 0644 wikilist $(DESTDIR)/etc/ikiwiki
  111. -install -m 0644 auto.setup $(DESTDIR)/etc/ikiwiki
  112. -install -m 0644 auto-blog.setup $(DESTDIR)/etc/ikiwiki
  113. }
  114. }
  115. WriteMakefile(
  116. NAME => 'IkiWiki',
  117. PREFIX => "/usr/local",
  118. PM_FILTER => './pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB)',
  119. MAN1PODS => {},
  120. PREREQ_PM => {
  121. 'XML::Simple' => "0",
  122. 'Text::Markdown' => "0",
  123. 'Date::Parse' => "0",
  124. 'HTML::Template' => "0",
  125. 'HTML::Scrubber' => "0",
  126. 'CGI::FormBuilder' => "3.02.02",
  127. 'CGI::Session' => "0",
  128. 'Mail::Sendmail' => "0",
  129. 'HTML::Parser' => "0",
  130. 'URI' => "0",
  131. 'Data::Dumper' => "2.11",
  132. },
  133. );