Buildscr: make long parts of the build conditionalisable.

If I want to rebuild just the Javascript puzzles (for example) in
circumstances where I don't expect to need a great many
edit-compile-link cycles, it's easier to get bob to do it for me than
to remember how to set up the development tools on my path. But it
takes ages to run the whole build script if I also have to wait for
the Windows, Mac and Java puzzles to be built, not to mention the
initial Unix build that runs for no purpose other than generating the
icon images.

So now I can run the build with various time-consuming parts
conditioned out, for development purposes. Of course, the default is
still to build absolutely everything.
This commit is contained in:
Simon Tatham
2018-04-28 12:02:55 +01:00
parent e53c097fb7
commit 31384ca9c0

152
Buildscr
View File

@ -1,5 +1,9 @@
# -*- sh -*- # -*- sh -*-
# Build script to build Puzzles. # Build script to build Puzzles.
#
# You can cut out large components of the build by defining a subset
# of these options on the bob command line:
# -DNOSIGN -DNOWINDOWS -DNOMACOS -DNOICONS -DNOJAVA -DNOJS
module puzzles module puzzles
@ -24,37 +28,44 @@ in puzzles do echo '$#define VER "Version $(Version)"' >> version.h
# them!) # them!)
in puzzles do perl -i -pe 's/Unidentified build/$(Version)/' osx-info.plist in puzzles do perl -i -pe 's/Unidentified build/$(Version)/' osx-info.plist
# First build some local binaries, to run the icon build. ifneq "$(NOICONS)" yes then
in puzzles do perl mkfiles.pl -U CFLAGS='-Wwrite-strings -Werror' # First build some local binaries, to run the icon build.
in puzzles do make in puzzles do perl mkfiles.pl -U CFLAGS='-Wwrite-strings -Werror'
in puzzles do make
# Now build the screenshots and icons. # Now build the screenshots and icons.
in puzzles/icons do xvfb-run -s "-screen 0 1024x768x24" make web winicons gtkicons in puzzles/icons do xvfb-run -s "-screen 0 1024x768x24" make web winicons gtkicons
# Destroy the local binaries and autoconf detritus, mostly to avoid # Destroy the local binaries and autoconf detritus, mostly to avoid
# wasting network bandwidth by transferring them to the delegate # wasting network bandwidth by transferring them to the delegate
# servers. # servers.
in puzzles do make distclean in puzzles do make distclean
# Re-run mkfiles.pl now that it knows the icons are there. endif
# Re-run mkfiles.pl now that it knows the icons are there. (Or for the
# first time, if we didn't bother building the icons.)
in puzzles do perl mkfiles.pl in puzzles do perl mkfiles.pl
# Rebuild the configure script. # Rebuild the configure script.
in puzzles do ./mkauto.sh in puzzles do ./mkauto.sh
# Build the OS X .dmg archive. ifneq "$(NOMACOS)" yes then
delegate osx # Build the OS X .dmg archive.
delegate osx
in puzzles do make -f Makefile.osx clean in puzzles do make -f Makefile.osx clean
in puzzles do make -f Makefile.osx release VER=-DVER=$(Version) XFLAGS='-Wwrite-strings -Werror' in puzzles do make -f Makefile.osx release VER=-DVER=$(Version) XFLAGS='-Wwrite-strings -Werror'
return puzzles/Puzzles.dmg return puzzles/Puzzles.dmg
enddelegate enddelegate
endif
# Build the Windows binaries and installer, and the CHM file. ifneq "$(NOWINDOWS)" yes then
in puzzles do make -f Makefile.doc clean # Build the Windows binaries and installer, and the CHM file.
in puzzles do make -f Makefile.doc # build help files for installer in puzzles do make -f Makefile.doc clean
in puzzles do mason.pl --args '{"version":"$(Version)","descfile":"gamedesc.txt"}' winwix.mc > puzzles.wxs in puzzles do make -f Makefile.doc # build help files for installer
in puzzles do perl winiss.pl $(Version) gamedesc.txt > puzzles.iss in puzzles do mason.pl --args '{"version":"$(Version)","descfile":"gamedesc.txt"}' winwix.mc > puzzles.wxs
ifneq "$(VISUAL_STUDIO)" "yes" then in puzzles do perl winiss.pl $(Version) gamedesc.txt > puzzles.iss
ifneq "$(VISUAL_STUDIO)" "yes" then
in puzzles with clangcl64 do mkdir win64 && Platform=x64 make -f Makefile.clangcl BUILDDIR=win64/ VER=-DVER=$(Version) XFLAGS='-Wwrite-strings -Werror' in puzzles with clangcl64 do mkdir win64 && Platform=x64 make -f Makefile.clangcl BUILDDIR=win64/ VER=-DVER=$(Version) XFLAGS='-Wwrite-strings -Werror'
in puzzles with clangcl32 do mkdir win32 && Platform=x86 make -f Makefile.clangcl BUILDDIR=win32/ SUBSYSVER=,5.01 VER=-DVER=$(Version) XFLAGS='-Wwrite-strings -Werror' in puzzles with clangcl32 do mkdir win32 && Platform=x86 make -f Makefile.clangcl BUILDDIR=win32/ SUBSYSVER=,5.01 VER=-DVER=$(Version) XFLAGS='-Wwrite-strings -Werror'
# Code-sign the binaries, if the local bob config provides a script # Code-sign the binaries, if the local bob config provides a script
@ -67,7 +78,7 @@ ifneq "$(VISUAL_STUDIO)" "yes" then
in puzzles with wixonlinux do candle -arch x64 puzzles.wxs -dWin64=yes -dBindir=win64/ && light -ext WixUIExtension -sval puzzles.wixobj in puzzles with wixonlinux do candle -arch x64 puzzles.wxs -dWin64=yes -dBindir=win64/ && light -ext WixUIExtension -sval puzzles.wixobj
in puzzles with wixonlinux do candle -arch x86 puzzles.wxs -dWin64=no -dBindir=win32/ && light -ext WixUIExtension -sval puzzles.wixobj -o puzzles32.msi in puzzles with wixonlinux do candle -arch x86 puzzles.wxs -dWin64=no -dBindir=win32/ && light -ext WixUIExtension -sval puzzles.wixobj -o puzzles32.msi
ifneq "$(cross_winsigncode)" "" in puzzles do $(cross_winsigncode) -i https://www.chiark.greenend.org.uk/~sgtatham/puzzles/ -n "Simon Tatham's Portable Puzzle Collection Installer" puzzles.msi puzzles32.msi ifneq "$(cross_winsigncode)" "" in puzzles do $(cross_winsigncode) -i https://www.chiark.greenend.org.uk/~sgtatham/puzzles/ -n "Simon Tatham's Portable Puzzle Collection Installer" puzzles.msi puzzles32.msi
else else
delegate windows delegate windows
in puzzles with visualstudio do/win nmake -f Makefile.vc clean in puzzles with visualstudio do/win nmake -f Makefile.vc clean
in puzzles with visualstudio do/win nmake -f Makefile.vc VER=-DVER=$(Version) in puzzles with visualstudio do/win nmake -f Makefile.vc VER=-DVER=$(Version)
@ -78,8 +89,9 @@ else
return puzzles/win64/*.exe return puzzles/win64/*.exe
return puzzles/puzzles.msi return puzzles/puzzles.msi
enddelegate enddelegate
endif
in puzzles do chmod +x win32/*.exe win64/*.exe
endif endif
in puzzles do chmod +x win32/*.exe win64/*.exe
# Build the Pocket PC binaries and CAB. # Build the Pocket PC binaries and CAB.
# #
@ -122,17 +134,19 @@ in puzzles do mkdir devel
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 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
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 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
# Move the deliver-worthy Windows binaries (those specified in ifneq "$(NOWINDOWS)" yes then
# gamedesc.txt, which is generated by mkfiles.pl and helpfully # Move the deliver-worthy Windows binaries (those specified in
# excludes the command-line auxiliary utilities such as solosolver, # gamedesc.txt, which is generated by mkfiles.pl and helpfully
# and nullgame.exe) into a subdirectory for easy access. # excludes the command-line auxiliary utilities such as solosolver,
in puzzles do mkdir winbin64 winbin32 # and nullgame.exe) into a subdirectory for easy access.
in puzzles/win64 do mv `cut -f2 -d: ../gamedesc.txt` ../winbin64 in puzzles do mkdir winbin64 winbin32
in puzzles/win32 do mv `cut -f2 -d: ../gamedesc.txt` ../winbin32 in puzzles/win64 do mv `cut -f2 -d: ../gamedesc.txt` ../winbin64
in puzzles/win32 do mv `cut -f2 -d: ../gamedesc.txt` ../winbin32
# Make a zip file of the Windows binaries and help files. # Make a zip file of the Windows binaries and help files.
in puzzles do zip -j puzzles.zip winbin64/*.exe puzzles.chm puzzles.hlp puzzles.cnt in puzzles do zip -j puzzles.zip winbin64/*.exe puzzles.chm puzzles.hlp puzzles.cnt
in puzzles do zip -j puzzles32.zip winbin32/*.exe puzzles.chm puzzles.hlp puzzles.cnt in puzzles do zip -j puzzles32.zip winbin32/*.exe puzzles.chm puzzles.hlp puzzles.cnt
endif
# Create the source archive. (That writes the archive into the # Create the source archive. (That writes the archive into the
# _parent_ directory, so be careful when we deliver it.) # _parent_ directory, so be careful when we deliver it.)
@ -145,31 +159,35 @@ ifneq "$(JAVA_UNFINISHED)" "" in puzzles do perl -i~ -pe 'print "!srcdir unfinis
ifneq "$(JAVA_UNFINISHED)" "" in puzzles do ln -s unfinished/group.R . ifneq "$(JAVA_UNFINISHED)" "" in puzzles do ln -s unfinished/group.R .
ifneq "$(JAVA_UNFINISHED)" "" in puzzles do perl mkfiles.pl ifneq "$(JAVA_UNFINISHED)" "" in puzzles do perl mkfiles.pl
# Build the Java applets. ifneq "$(NOJAVA)" yes then
delegate nestedvm # Build the Java applets.
delegate nestedvm
in puzzles do make -f Makefile.nestedvm NESTEDVM="$$NESTEDVM" VER=-DVER=$(Version) XFLAGS="-Wwrite-strings -Werror" in puzzles do make -f Makefile.nestedvm NESTEDVM="$$NESTEDVM" VER=-DVER=$(Version) XFLAGS="-Wwrite-strings -Werror"
return puzzles/*.jar return puzzles/*.jar
enddelegate enddelegate
endif
# Build the Javascript applets. Since my master build machine doesn't # Build the Javascript applets. Since my master build machine doesn't
# have the right dependencies installed for Emscripten, I do this by a # have the right dependencies installed for Emscripten, I do this by a
# delegation. # delegation.
in puzzles do mkdir js # so we can tell output .js files from emcc*.js ifneq "$(NOJS)" yes then
delegate emscripten in puzzles do mkdir js # so we can tell output .js files from emcc*.js
delegate emscripten
in puzzles do make -f Makefile.emcc OUTPREFIX=js/ clean in puzzles do make -f Makefile.emcc OUTPREFIX=js/ clean
in puzzles do make -f Makefile.emcc OUTPREFIX=js/ XFLAGS="-Wwrite-strings -Werror" in puzzles do make -f Makefile.emcc OUTPREFIX=js/ XFLAGS="-Wwrite-strings -Werror"
return puzzles/js/*.js return puzzles/js/*.js
enddelegate enddelegate
# Build a set of wrapping HTML pages for easy testing of the # Build a set of wrapping HTML pages for easy testing of the
# Javascript puzzles. These aren't quite the same as the versions that # Javascript puzzles. These aren't quite the same as the versions that
# will go on my live website, because those ones will substitute in a # will go on my live website, because those ones will substitute in a
# different footer, and not have to link to the .js files with the # different footer, and not have to link to the .js files with the
# ../js/ prefix. But these ones should be good enough to just open # ../js/ prefix. But these ones should be good enough to just open
# using a file:// URL in a browser after running a build, and make # using a file:// URL in a browser after running a build, and make
# sure the main functionality works. # sure the main functionality works.
in puzzles do mkdir jstest in puzzles do mkdir jstest
in puzzles/jstest do ../html/jspage.pl --jspath=../js/ /dev/null ../html/*.html in puzzles/jstest do ../html/jspage.pl --jspath=../js/ /dev/null ../html/*.html
endif
# Set up .htaccess containing a redirect for the archive filename. # Set up .htaccess containing a redirect for the archive filename.
in puzzles do echo "AddType application/octet-stream .chm" > .htaccess in puzzles do echo "AddType application/octet-stream .chm" > .htaccess
@ -179,25 +197,35 @@ in . do set -- puzzles*.tar.gz; echo RedirectMatch temp '(.*/)'puzzles.tar.gz '$
in puzzles do echo RedirectMatch temp '(.*/)'puzzles-installer.msi '$$1'puzzles-$(Version)-installer.msi >> .htaccess in puzzles do echo RedirectMatch temp '(.*/)'puzzles-installer.msi '$$1'puzzles-$(Version)-installer.msi >> .htaccess
# Phew, we're done. Deliver everything! # Phew, we're done. Deliver everything!
deliver puzzles/icons/*-web.png $@ ifneq "$(NOICONS)" yes then
deliver puzzles/winbin64/*.exe $@ deliver puzzles/icons/*-web.png $@
deliver puzzles/winbin32/*.exe w32/$@ endif
ifneq "$(NOWINDOWS)" yes then
deliver puzzles/winbin64/*.exe $@
deliver puzzles/winbin32/*.exe w32/$@
deliver puzzles/puzzles.zip $@
deliver puzzles/puzzles32.zip w32/$@
deliver puzzles/puzzles.msi puzzles-$(Version)-installer.msi
deliver puzzles/puzzles32.msi w32/puzzles-$(Version)-32bit-installer.msi
deliver puzzles/puzzles.chm $@
deliver puzzles/puzzles.hlp $@
deliver puzzles/puzzles.cnt $@
endif
deliver puzzles/.htaccess $@ deliver puzzles/.htaccess $@
deliver puzzles/doc/*.html doc/$@ deliver puzzles/doc/*.html doc/$@
deliver puzzles/devel/*.html devel/$@ deliver puzzles/devel/*.html devel/$@
deliver puzzles/Puzzles.dmg $@ ifneq "$(NOMACOS)" yes then
deliver puzzles/puzzles.chm $@ deliver puzzles/Puzzles.dmg $@
deliver puzzles/puzzles.hlp $@ endif
deliver puzzles/puzzles.cnt $@ ifneq "$(NOJAVA)" yes then
deliver puzzles/puzzles.zip $@ deliver puzzles/*.jar java/$@
deliver puzzles/puzzles32.zip w32/$@ endif
deliver puzzles/puzzles.msi puzzles-$(Version)-installer.msi ifneq "$(NOJS)" yes then
deliver puzzles/puzzles32.msi w32/puzzles-$(Version)-32bit-installer.msi deliver puzzles/js/*.js js/$@
deliver puzzles/*.jar java/$@ deliver puzzles/jstest/*.html jstest/$@
deliver puzzles/js/*.js js/$@ deliver puzzles/html/*.html html/$@
deliver puzzles/jstest/*.html jstest/$@ deliver puzzles/html/*.pl html/$@
deliver puzzles/html/*.html html/$@ endif
deliver puzzles/html/*.pl html/$@
deliver puzzles/wwwspans.html $@ deliver puzzles/wwwspans.html $@
deliver puzzles/wwwlinks.html $@ deliver puzzles/wwwlinks.html $@