wiki.pl: Port some fixes from upstream
[Orgmuse.git] / Makefile
blob88acc79b3841580901239e9b9c7a36325efb86cb
1 # The Makefile is only for developpers wanting to prepare the tarball.
2 # Make sure the CVS keywords for the sed command on the next line are not expanded.
4 VERSION_NO=$(shell git describe --tags)
5 TRANSLATIONS=$(wildcard modules/translations/[a-z]*-utf8.pl$)
6 MODULES=$(wildcard modules/*.pl)
7 BUILD=build/wiki.pl $(foreach file, $(notdir $(MODULES)) $(notdir $(TRANSLATIONS)), build/$(file))
9 # PREPARE/BUILD: this creates copies of wiki.pl and all the modules
10 # and translations in the build subdirectory. These copies all contain
11 # a reference to the revision they were created from (git describe
12 # --tags).
14 prepare: build $(BUILD)
16 build:
17 mkdir -p build
19 build/wiki.pl: wiki.pl
20 sed "s/\\\$$q->a({-href=>'http:\/\/www.oddmuse.org\/'}, 'Oddmuse')/\\\$$q->a({-href=>'http:\/\/git.savannah.gnu.org\/cgit\/oddmuse.git\/tag\/?id=$(VERSION_NO)'}, 'wiki.pl') . ' ($(VERSION_NO)), see ' . &/" < $< > $@
22 build/%-utf8.pl: modules/translations/%-utf8.pl
23 sed "s/<a href=\"http:\/\/git.savannah.gnu.org\/cgit\/oddmuse.git\/tree\/modules\/translations\/\\(.*\\).pl\">\\(.*\\).pl<\/a>/<a href=\"http:\/\/git.savannah.gnu.org\/cgit\/oddmuse.git\/tree\/modules\/translations\/\\1.pl?id=$(VERSION_NO)\">\\1.pl<\/a> (for $(VERSION_NO))/" < $< > $@
25 # Currently oddtrans introduces encoding errors!
27 # %-utf8.pl: wiki.pl $(MODULES)
28 # perl oddtrans -l $@ $^ > $@-new && mv $@-new $@
30 # from: http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/namespaces.pl
31 # to: http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/namespaces.pl?id=2.1-11-gd4f1e27
33 build/%.pl: modules/%.pl
34 sed "s/<a href=\"http:\/\/git.savannah.gnu.org\/cgit\/oddmuse.git\/tree\/modules\/\\(.*\\).pl\">\\(.*\\).pl<\/a>/<a href=\"http:\/\/git.savannah.gnu.org\/cgit\/oddmuse.git\/tree\/modules\/\\1.pl?id=$(VERSION_NO)\">\\1.pl<\/a> (for $(VERSION_NO))/" < $< > $@
39 # UNTESTED/OBSOLETE: these targets have not been tested in a long time
40 # and are potentially obsolete.
41 VERSION=oddmuse-$(VERSION_NO)
42 UPLOADVERSION=oddmuse-inkscape-$(VERSION_NO)
43 INKSCAPE=GPL $(wildcard inkscape/*.py inkscape/*.inx inkscape/*.sh)
44 PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
45 DIST=$(VERSION).tar.gz $(VERSION).tar.gz.sig \
46 contrib/simple-install/$(VERSION)-simple.tar.gz \
47 contrib/simple-install/$(VERSION)-simple.tar.gz.sig
48 OLDDIST=$(VERSION).dmg $(VERSION).dmg.sig \
49 $(VERSION).tgz $(VERSION).tgz.sig
50 PWD=$(shell pwd)
52 dist: $(DIST)
54 upload: $(DIST)
55 for f in $^; do \
56 scp $$f as@dl.sv.nongnu.org:/releases/oddmuse/; \
57 done
59 upload-text: new-utf8.pl
60 wikiupload new-utf8.pl http://www.oddmuse.org/cgi-bin/oddmuse-en/New_Translation_File
62 contrib/simple-install/$(VERSION)-simple.tar.gz:
63 cd contrib/simple-install && make $(VERSION)-simple.tar.gz
65 $(VERSION).tar.gz: README FDL GPL ChangeLog wiki.pl $(TRANSLATIONS) $(MODULES) current.pl
66 rm -rf $(VERSION)
67 mkdir $(VERSION)
68 cp $^ $(VERSION)
69 tar czf $@ $(VERSION)
71 $(UPLOADVERSION).tar.gz: $(INKSCAPE)
72 rm -rf $(UPLOADVERSION)
73 mkdir $(UPLOADVERSION)
74 cp $^ $(UPLOADVERSION)
75 cp wikiupload $(UPLOADVERSION)/oddmuse-upload.py
76 tar czf $@ $(UPLOADVERSION)
78 %.sig: %
79 gpg --sign -b $<
81 # OSX: .pkg is the package, and .dmg is the disk image.
83 # Make sure to copy the files into a new directory so that the CVS
84 #subdirectory are not inlcuded in the .pkg. And fix permissions. Skip
85 #if we can't run PackageMaker. All cp commands need sudo because on a
86 #second run the directories will already exist.
87 $(VERSION).pkg: wiki.pl modules/creole.pl Mac/config Mac/wiki
88 if test -x $(PACKAGEMAKER); then \
89 mkdir -p Mac/pkg/CGI-Executables; \
90 sudo cp wiki.pl Mac/pkg/CGI-Executables/current; \
91 sudo cp Mac/wiki Mac/pkg/CGI-Executables/wiki; \
92 sudo chown -R root:admin Mac/pkg/CGI-Executables; \
93 sudo chmod 644 Mac/pkg/CGI-Executables/current; \
94 sudo chmod 755 Mac/pkg/CGI-Executables/wiki; \
95 mkdir -p Mac/pkg/Oddmuse; \
96 sudo cp Mac/config Mac/pkg/Oddmuse; \
97 sudo chown www:admin Mac/pkg/Oddmuse; \
98 sudo chmod 775 Mac/pkg/Oddmuse; \
99 sudo chown root:admin Mac/pkg/Oddmuse/config; \
100 sudo chmod 664 Mac/pkg/Oddmuse/config; \
101 mkdir -p Mac/pkg/Oddmuse/modules; \
102 sudo cp modules/mac.pl Mac/pkg/Oddmuse/modules; \
103 sudo cp modules/creole.pl Mac/pkg/Oddmuse/modules; \
104 sudo chown -R root:admin Mac/pkg/Oddmuse/modules; \
105 sudo chmod 775 Mac/pkg/Oddmuse/modules; \
106 sudo chmod 644 Mac/pkg/Oddmuse/modules/*; \
107 $(PACKAGEMAKER) -build \
108 -p $(PWD)/$@ \
109 -i $(PWD)/Mac/Info.plist \
110 -d $(PWD)/Mac/Description.plist \
111 -f $(PWD)/Mac/pkg; \
114 $(VERSION).dmg: $(VERSION).pkg
115 hdiutil create -srcfolder $< -fs HFS+ -volname "Oddmuse" $@
117 # Slackware: .tgz are .tar.gz files used by the installer
118 # Slackware webserver is run by nobody uid/gid 99/99.
120 $(VERSION).tgz: wiki.pl modules/creole.pl Mac/config Mac/wiki
121 sudo rm -rf Slack/var Slack/install
122 mkdir -p Slack/var/www/wiki/modules
123 mkdir -p Slack/var/www/cgi-bin
124 mkdir -p Slack/install
125 sudo cp Mac/config Slack/var/www/wiki
126 sudo cp Mac/wiki Slack/var/www/cgi-bin
127 sudo cp README Slack/var/www/wiki
128 sudo cp modules/creole.pl Slack/var/www/wiki/modules
129 sudo cp wiki.pl Slack/var/www/cgi-bin/current
130 sudo sed -e 's/VERSION/$(VERSION_NO)/' < Slack/slack-desc > Slack/install/slack-desc
131 sudo chown -R 0:0 Slack/var Slack/install
132 sudo chgrp 99 Slack/var/www/cgi-bin/wiki
133 sudo chmod 644 Slack/var/www/cgi-bin/current
134 sudo chmod 775 Slack/var/www/cgi-bin/wiki
135 cd Slack && tar czf ../$@ var install
137 update-translations: $(TRANSLATIONS)
139 upload-translations: always
140 for f in $(TRANSLATIONS); do \
141 cvs status $$f | grep 'Status: Up-to-date'; \
142 wikiput -z "ham" -u "cvs" -s "update" \
143 "http://www.oddmuse.org/cgi-bin/oddmuse/raw/$$f" < $$f; \
144 done
146 deb:
147 equivs-build control
149 install:
150 @echo This only installs the deb file, not the script itself.
151 dpkg -i oddmuse*.deb
153 test:
154 prove t
156 package-upload: debian-$(VERSION).tar.gz debian-$(VERSION).tar.gz.sig
157 curl -T "{debian-$(VERSION).tar.gz,debian-$(VERSION).tar.gz.sig}" \
158 ftp://savannah.gnu.org/incoming/savannah/oddmuse/
160 package: debian-$(VERSION).tar.gz
161 gpg --ascii --encrypt $<
163 debian-$(VERSION).tar.gz:
164 rm -rf $(VERSION)
165 mkdir $(VERSION)
166 cp README FDL GPL wiki.pl $(VERSION)
167 tar czf $@ $(VERSION)