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