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

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,6 +28,7 @@ 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
ifneq "$(NOICONS)" yes then
# First build some local binaries, to run the icon build. # First build some local binaries, to run the icon build.
in puzzles do perl mkfiles.pl -U CFLAGS='-Wwrite-strings -Werror' in puzzles do perl mkfiles.pl -U CFLAGS='-Wwrite-strings -Werror'
in puzzles do make in puzzles do make
@ -36,19 +41,25 @@ in puzzles/icons do xvfb-run -s "-screen 0 1024x768x24" make web winicons gtkico
# 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
ifneq "$(NOMACOS)" yes then
# Build the OS X .dmg archive. # Build the OS X .dmg archive.
delegate osx 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
ifneq "$(NOWINDOWS)" yes then
# Build the Windows binaries and installer, and the CHM file. # Build the Windows binaries and installer, and the CHM file.
in puzzles do make -f Makefile.doc clean in puzzles do make -f Makefile.doc clean
in puzzles do make -f Makefile.doc # build help files for installer in puzzles do make -f Makefile.doc # build help files for installer
@ -80,6 +91,7 @@ else
enddelegate enddelegate
endif endif
in puzzles do chmod +x win32/*.exe win64/*.exe in puzzles do chmod +x win32/*.exe win64/*.exe
endif
# Build the Pocket PC binaries and CAB. # Build the Pocket PC binaries and CAB.
# #
@ -122,6 +134,7 @@ 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
ifneq "$(NOWINDOWS)" yes then
# Move the deliver-worthy Windows binaries (those specified in # Move the deliver-worthy Windows binaries (those specified in
# gamedesc.txt, which is generated by mkfiles.pl and helpfully # gamedesc.txt, which is generated by mkfiles.pl and helpfully
# excludes the command-line auxiliary utilities such as solosolver, # excludes the command-line auxiliary utilities such as solosolver,
@ -133,6 +146,7 @@ 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,15 +159,18 @@ 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
ifneq "$(NOJAVA)" yes then
# Build the Java applets. # Build the Java applets.
delegate nestedvm 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.
ifneq "$(NOJS)" yes then
in puzzles do mkdir js # so we can tell output .js files from emcc*.js in puzzles do mkdir js # so we can tell output .js files from emcc*.js
delegate emscripten delegate emscripten
in puzzles do make -f Makefile.emcc OUTPREFIX=js/ clean in puzzles do make -f Makefile.emcc OUTPREFIX=js/ clean
@ -170,6 +187,7 @@ enddelegate
# 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!
ifneq "$(NOICONS)" yes then
deliver puzzles/icons/*-web.png $@ deliver puzzles/icons/*-web.png $@
endif
ifneq "$(NOWINDOWS)" yes then
deliver puzzles/winbin64/*.exe $@ deliver puzzles/winbin64/*.exe $@
deliver puzzles/winbin32/*.exe w32/$@ deliver puzzles/winbin32/*.exe w32/$@
deliver puzzles/.htaccess $@
deliver puzzles/doc/*.html doc/$@
deliver puzzles/devel/*.html devel/$@
deliver puzzles/Puzzles.dmg $@
deliver puzzles/puzzles.chm $@
deliver puzzles/puzzles.hlp $@
deliver puzzles/puzzles.cnt $@
deliver puzzles/puzzles.zip $@ deliver puzzles/puzzles.zip $@
deliver puzzles/puzzles32.zip w32/$@ deliver puzzles/puzzles32.zip w32/$@
deliver puzzles/puzzles.msi puzzles-$(Version)-installer.msi deliver puzzles/puzzles.msi puzzles-$(Version)-installer.msi
deliver puzzles/puzzles32.msi w32/puzzles-$(Version)-32bit-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/doc/*.html doc/$@
deliver puzzles/devel/*.html devel/$@
ifneq "$(NOMACOS)" yes then
deliver puzzles/Puzzles.dmg $@
endif
ifneq "$(NOJAVA)" yes then
deliver puzzles/*.jar java/$@ deliver puzzles/*.jar java/$@
endif
ifneq "$(NOJS)" yes then
deliver puzzles/js/*.js js/$@ deliver puzzles/js/*.js js/$@
deliver puzzles/jstest/*.html jstest/$@ deliver puzzles/jstest/*.html jstest/$@
deliver puzzles/html/*.html html/$@ deliver puzzles/html/*.html html/$@
deliver puzzles/html/*.pl html/$@ deliver puzzles/html/*.pl html/$@
endif
deliver puzzles/wwwspans.html $@ deliver puzzles/wwwspans.html $@
deliver puzzles/wwwlinks.html $@ deliver puzzles/wwwlinks.html $@