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