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