Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # In order to build a copy of Oddmuse with all the version numbers, use:
  2. # make build. This creates modified copies of the files in the build
  3. # subdirectory.
  4. VERSION_NO=$(shell git describe --tags)
  5. TRANSLATIONS=$(wildcard modules/translations/*-utf8.pl)
  6. MODULES=$(sort $(wildcard modules/*.pl))
  7. BUILD=build/wiki.pl $(foreach file, $(notdir $(MODULES)) $(notdir $(TRANSLATIONS)), build/$(file))
  8. # PREPARE/BUILD: this creates copies of wiki.pl and all the modules
  9. # and translations in the build subdirectory. These copies all contain
  10. # a reference to the revision they were created from (git describe
  11. # --tags).
  12. prepare: build $(BUILD)
  13. build:
  14. mkdir -p build
  15. clean:
  16. rm -rf build
  17. prove t/setup.pl
  18. release:
  19. perl stuff/release ~/oddmuse.org/releases 2.3.3
  20. build/wiki.pl: wiki.pl
  21. perl -lne "s/(\\\$$q->a\(\{-href=>'https:\/\/www.oddmuse.org\/'\}, 'Oddmuse'\))/\\\$$q->a({-href=>'https:\/\/alexschroeder.ch\/cgit\/oddmuse\/tag\/?id=$(VERSION_NO)'}, 'wiki.pl') . ' ($(VERSION_NO)), see ' . \$$1/; print" < $< > $@
  22. build/%-utf8.pl: modules/translations/%-utf8.pl
  23. perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, 'translations\/', '$(VERSION_NO)')/; print" < $< > $@
  24. build/national-%.pl: modules/translations/national-%.pl
  25. perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, 'translations\/', '$(VERSION_NO)')/; print" < $< > $@
  26. build/month-names-%.pl: modules/translations/month-names-%.pl
  27. perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, 'translations\/', '$(VERSION_NO)')/; print" < $< > $@
  28. # from: https://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/namespaces.pl
  29. # to: https://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/namespaces.pl?id=2.1-11-gd4f1e27
  30. build/%.pl: modules/%.pl
  31. perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, undef, '$(VERSION_NO)')/; print" < $< > $@
  32. modules/translations/new-utf8.pl: wiki.pl $(MODULES)
  33. cp $@ $@-old
  34. perl stuff/oddtrans -l $@-old wiki.pl $(MODULES) > $@
  35. rm -f $@-old
  36. translations: $(TRANSLATIONS)
  37. for f in $^; do \
  38. echo updating $$f...; \
  39. perl stuff/oddtrans -l $$f wiki.pl $(MODULES) > $$f-new && mv $$f-new $$f; \
  40. done
  41. # Running four jobs in parallel, but clean up data directories without
  42. # race conditions!
  43. jobs ?= 4
  44. test:
  45. prove t/setup.pl
  46. prove --jobs=$(jobs) --state=slow,save t
  47. # Spin up a quick test
  48. development:
  49. @if grep --quiet 'ScriptName = "http://127.0.0.1:8080";' test-data/config; then \
  50. echo Not overwriting \$$ScriptName in test-data/config; \
  51. else \
  52. echo '$ScriptName = "http://127.0.0.1:8080";' >> test-data/config; \
  53. fi
  54. morbo --listen http://*:8080 \
  55. --watch wiki.pl --watch test-data/config --watch test-data/modules/ \
  56. stuff/mojolicious-app.pl
  57. %.pem:
  58. openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout key.pem
  59. gemini: cert.pem key.pem
  60. perl stuff/gemini-server.pl --wiki_cert_file=cert.pem --wiki_key_file=key.pem