# -*- sh -*-
# Build script for Gonville.

module gonville

set Version $(!builddate).$(vcsid)

# Construct the source archive, before we create any new files.
in . do mkdir gonville-$(Version)
in gonville-$(Version) do cp ../gonville/* .
in . do tar czvf gonville-$(Version)-src.tar.gz gonville-$(Version)

# Build the font set, and construct the distribution archive
# containing the output fonts directory and only the necessary
# source files.
in . do rm -rf gonville-$(Version)
in . do mkdir gonville-$(Version)
in gonville do cp LICENCE README lilysetup ../gonville-$(Version)
in gonville do ./glyphs.py --ver=$(Version) -lily
in gonville-$(Version) do mv ../gonville/lilyfonts .
in . do tar czvf gonville-$(Version).tar.gz gonville-$(Version)
# And build a zip file for Windows users, which will of course store
# copies instead of symlinks, and which (in what I think is still
# Windows's normal convention) doesn't contain everything inside a
# subdirectory.
in gonville-$(Version) do zip -r ../gonville-$(Version).zip *

# Build the demo images.
in gonville do (unset LILYPOND_DATADIR; lilypond --ps lilydemo.ly)
in gonville do gs -sDEVICE=pngmono -sPAPERSIZE=a4 -r720 -sOutputFile=before0.png -dBATCH -dNOPAUSE lilydemo.ps
in gonville do convert -resize 1400x- -trim -bordercolor white -border 10 before0.png before.png
in gonville do ./lilysetup ../gonville-$(Version)/lilyfonts /usr/share/lilypond/* lilydata
in gonville do (export LILYPOND_DATADIR=$$PWD/lilydata; lilypond --ps lilydemo.ly)
in gonville do gs -sDEVICE=pngmono -sPAPERSIZE=a4 -r720 -sOutputFile=after0.png -dBATCH -dNOPAUSE lilydemo.ps
in gonville do convert -resize 1400x- -trim -bordercolor white -border 10 after0.png after.png

deliver gonville-$(Version)-src.tar.gz $@
deliver gonville-$(Version).tar.gz $@
deliver gonville-$(Version).zip $@
deliver gonville/before.png $@
deliver gonville/after.png $@
