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