#!/usr/bin/env bash## Administrative build for Isabelle source distribution.## global environment#paranoia setting for sunbroyPATH="/usr/local/dist/DIR/j2sdk1.5.0/bin:$PATH"PATH="/home/scala/current/bin:$PATH"## directory layoutISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"## diagnosticsPRG="$(basename "$0")"function usage(){ cat <<EOFUsage: $PRG [MODULES] Produce Isabelle distribution modules from current repository sources. The MODULES list may contain any of the following: all all modules below browser graph browser (requires jdk) doc documentation (requires latex and rail) jars JVM components (requires jdk and scala)EOF exit 1}function fail(){ echo "$1" >&2 exit 2}## process command line[ "$#" -eq 0 ] && usageMODULES="$@"; shift "$#"## modulesfunction build_all (){ build_doc build_browser build_jars}function build_browser (){ echo "###" echo "### Building graph browser ..." echo "###" cd "$ISABELLE_HOME/lib/browser" make clean all || fail "Failed to build graph browser!"}function build_doc (){ echo "###" echo "### Building documentation ..." echo "###" cd "$ISABELLE_HOME/doc-src" for DOC in $(cat Dirs) do pushd "$DOC" >/dev/null make clean dvi || fail "DVI document for $DOC failed!" make clean pdf || fail "PDF document for $DOC failed!" popd >/dev/null done}function build_jars (){ echo "###" echo "### Building JVM components ..." echo "###" type -p scalac >/dev/null || fail "Scala compiler unavailable" pushd "$ISABELLE_HOME/src/Pure" >/dev/null "$ISABELLE_TOOL" make jar || fail "Failed to build Pure.jar!" popd >/dev/null}## mainfor MODULE in $MODULESdo case $MODULE in all) build_all;; browser) build_browser;; doc) build_doc;; jars) build_jars;; *) fail "Bad module $MODULE" esacdone