chiark / gitweb /
Remove an inappropriate assertion in validation context.
[sgt-puzzles.git] / Buildscr
1 # -*- sh -*-
2 # Build script to build Puzzles.
3
4 module puzzles
5
6 set Version $(!builddate).$(vcsid)
7
8 # Start by substituting the right version number in configure.ac.
9 in puzzles do perl -i~ -pe 's/6.66/$(Version)/' configure.ac
10 in puzzles do rm configure.ac~
11
12 # And put it into the documentation as a versionid.
13 # use perl to avoid inconsistent behaviour of echo '\v'
14 in puzzles do perl -e 'print "\n\\versionid Simon Tatham'\''s Portable Puzzle Collection, version $$ARGV[0]\n"' $(Version) >> puzzles.but
15 in puzzles do perl -e 'print "\n\\versionid Simon Tatham'\''s Portable Puzzle Collection, version $$ARGV[0]\n"' $(Version) >> devel.but
16
17 # Write out a version.h that contains the real version number.
18 in puzzles do echo '/* Generated by automated build script */' > version.h
19 in puzzles do echo '$#define VER "Version $(Version)"' >> version.h
20
21 # First build some local binaries, to run the icon build.
22 in puzzles do perl mkfiles.pl -U
23 in puzzles do make
24
25 # Now build the screenshots and icons.
26 in puzzles/icons do xvfb-run -s "-screen 0 1024x768x24" make web winicons gtkicons
27
28 # Destroy the local binaries and autoconf detritus, mostly to avoid
29 # wasting network bandwidth by transferring them to the delegate
30 # servers.
31 in puzzles do make distclean
32
33 # Re-run mkfiles.pl now that it knows the icons are there.
34 in puzzles do perl mkfiles.pl
35
36 # Rebuild the configure script.
37 in puzzles do ./mkauto.sh
38
39 # Build the OS X .dmg archive.
40 delegate osx
41   in puzzles do make -f Makefile.osx clean
42   in puzzles do make -f Makefile.osx release VER=-DVER=$(Version)
43   return puzzles/Puzzles.dmg
44 enddelegate
45
46 # Build the Windows binaries and installer, and the CHM file.
47 in puzzles do make -f Makefile.doc clean
48 in puzzles do make -f Makefile.doc chm
49 in puzzles do make -f Makefile.doc # build help file for installer
50 in puzzles do perl winiss.pl $(Version) gamedesc.txt > puzzles.iss
51 delegate windows
52   # Ignore the poorly controlled return value from HHC, and instead
53   # just test that the output file was generated.
54   in puzzles do hhc puzzles.hhp; test -f puzzles.chm
55   # FIXME: Cygwin alternative?
56   in puzzles do cmd /c 'vcvars32 & nmake -f Makefile.vc clean'
57   in puzzles do cmd /c 'vcvars32 & nmake -f Makefile.vc VER=-DVER=$(Version)'
58   # Build installer.
59   in puzzles do iscc puzzles.iss
60   return puzzles/puzzles.chm
61   return puzzles/*.exe
62   return puzzles/Output/setup.exe
63 enddelegate
64 in puzzles do chmod +x *.exe
65
66 # Build the Pocket PC binaries and CAB.
67 #
68 # NOTE: This part of the build script requires the Windows delegate
69 # server to have the cabwiz program on its PATH. This will
70 # typically be at
71 #
72 #   C:\Program Files\Windows CE Tools\WCE420\POCKET PC 2003\Tools
73 #
74 # but it might not be if you've installed it somewhere else, or
75 # have a different version.
76 #
77 # NOTE ALSO: This part of the build is commented out, for the
78 # moment, because cabwiz does unhelpful things when run from within
79 # a bob delegate process (or, more generally, when run from any
80 # terminal-based remote login to a Windows machine, including
81 # Cygwin opensshd and Windows Telnet). The symptom is that cabwiz
82 # just beeps and sits there. Until I figure out how to build the
83 # .cab from an automated process (and I'm willing to consider silly
84 # approaches such as a third-party CAB generator), I don't think I
85 # can sensibly enable this build.
86
87 #in puzzles do perl wceinf.pl gamedesc.txt > puzzles.inf
88 #delegate windows
89 #  in puzzles do cmd /c 'wcearmv4 & nmake -f Makefile.wce clean'
90 #  in puzzles do cmd /c 'wcearmv4 & nmake -f Makefile.wce VER=-DVER=$(Version)'
91 #  # Nasty piece of sh here which saves the return code from cabwiz,
92 #  # outputs its errors and/or warnings, and then propagates the
93 #  # return code back to bob. If only cabwiz could output to
94 #  # standard error LIKE EVERY OTHER COMMAND-LINE UTILITY IN THE
95 #  # WORLD, I wouldn't have to do this.
96 #  in puzzles do cat puzzles.inf
97 #  in puzzles do cmd /c 'wcearmv4 & bash -c cabwiz puzzles.inf /err cabwiz.err /cpu ARMV4'; a=$$?; cat cabwiz.err; exit $$a
98 #  return puzzles/puzzles.armv4.cab
99 #enddelegate
100
101 # Build the help file and the HTML docs.
102 in puzzles do make -f Makefile.doc clean # remove CHM-target HTML
103 in puzzles do make -f Makefile.doc # and rebuild help file...
104 in puzzles do mkdir doc
105 in puzzles do mkdir devel
106 in puzzles/doc do halibut --html -Chtml-contents-filename:index.html -Chtml-index-filename:indexpage.html -Chtml-template-filename:%k.html -Chtml-template-fragment:%k ../puzzles.but
107 in puzzles/devel do halibut --html -Chtml-contents-filename:index.html -Chtml-index-filename:indexpage.html -Chtml-template-filename:%k.html -Chtml-template-fragment:%k ../devel.but
108
109 # Move the deliver-worthy Windows binaries (those specified in
110 # gamedesc.txt, which is generated by mkfiles.pl and helpfully
111 # excludes the command-line auxiliary utilities such as solosolver,
112 # and nullgame.exe) into a subdirectory for easy access.
113 in puzzles do mkdir winbin
114 in puzzles do mv `cut -f2 -d: gamedesc.txt` winbin
115
116 # Make a zip file of the Windows binaries and help files.
117 in puzzles do zip -j puzzles.zip winbin/*.exe puzzles.chm puzzles.hlp puzzles.cnt
118
119 # Create the source archive. (That writes the archive into the
120 # _parent_ directory, so be careful when we deliver it.)
121 in puzzles do ./makedist.sh $(Version)
122
123 ifneq "$(JAVA_UNFINISHED)" "" in puzzles do perl -i~ -pe 'print "!srcdir unfinished/\n" if /!srcdir icons/' Recipe
124 ifneq "$(JAVA_UNFINISHED)" "" in puzzles do ln -s unfinished/group.R .
125 ifneq "$(JAVA_UNFINISHED)" "" in puzzles do perl mkfiles.pl
126
127 # Build the Java applets.
128 delegate nestedvm
129   in puzzles do make -f Makefile.nestedvm NESTEDVM="$$NESTEDVM" VER=-DVER=$(Version)
130   return puzzles/*.jar
131 enddelegate
132
133 # Build the Javascript applets. Since my master build machine doesn't
134 # have the right dependencies installed for Emscripten, I do this by a
135 # delegation.
136 in puzzles do mkdir js # so we can tell output .js files from emcc*.js
137 delegate emscripten
138   in puzzles do make -f Makefile.emcc OUTPREFIX=js/ clean
139   in puzzles do make -f Makefile.emcc OUTPREFIX=js/
140   return puzzles/js/*.js
141 enddelegate
142
143 # Set up .htaccess containing a redirect for the archive filename.
144 in puzzles do echo "AddType application/octet-stream .chm" > .htaccess
145 in puzzles do echo "AddType application/octet-stream .hlp" >> .htaccess
146 in puzzles do echo "AddType application/octet-stream .cnt" >> .htaccess
147 in . do set -- puzzles*.tar.gz; echo RedirectMatch temp '(.*/)'puzzles.tar.gz '$$1'"$$1" >> puzzles/.htaccess
148 in puzzles do echo RedirectMatch temp '(.*/)'puzzles-installer.exe '$$1'puzzles-$(Version)-installer.exe >> .htaccess
149
150 # Phew, we're done. Deliver everything!
151 deliver puzzles/icons/*-web.png $@
152 deliver puzzles/winbin/*.exe $@
153 deliver puzzles/.htaccess $@
154 deliver puzzles/doc/*.html doc/$@
155 deliver puzzles/devel/*.html devel/$@
156 deliver puzzles/Puzzles.dmg $@
157 deliver puzzles/puzzles.chm $@
158 deliver puzzles/puzzles.hlp $@
159 deliver puzzles/puzzles.cnt $@
160 deliver puzzles/puzzles.zip $@
161 deliver puzzles/Output/setup.exe puzzles-$(Version)-installer.exe
162 deliver puzzles/*.jar java/$@
163 deliver puzzles/js/*.js js/$@
164 deliver puzzles/html/*.html html/$@
165 deliver puzzles/html/*.pl html/$@
166
167 # deliver puzzles/puzzles.armv4.cab $@ # (not built at the moment)
168
169 # This one isn't in the puzzles subdir, because makedist.sh left it
170 # one level up.
171 deliver puzzles*.tar.gz $@