Admin/build
author wenzelm
Wed, 04 Mar 2009 23:05:32 +0100
changeset 30266 970bf4f594c9
parent 29186 3d25e96ceb98
child 31831 92993da74973
permissions -rwxr-xr-x
ML antiquotation @{lemma}: allow 'and' list, proper simultaneous type-checking;

#!/usr/bin/env bash
#
# Administrative build for Isabelle source distribution.

## global environment

#paranoia setting for sunbroy
PATH="/usr/local/dist/DIR/j2sdk1.5.0/bin:$PATH"

PATH="/home/scala/current/bin:$PATH"


## directory layout

ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"


## diagnostics

PRG="$(basename "$0")"

function usage()
{
  cat <<EOF

Usage: $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 ] && usage

MODULES="$@"; shift "$#"


## modules

function 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
}


## main

for MODULE in $MODULES
do
  case $MODULE in
    all) build_all;;
    browser) build_browser;;
    doc) build_doc;;
    jars) build_jars;;
    *) fail "Bad module $MODULE"
  esac
done