Admin/build
author haftmann
Fri, 01 Nov 2013 18:51:14 +0100
changeset 54230 b1d955791529
parent 53578 838d9e058a1a
child 56664 8ff8e5d00115
permissions -rwxr-xr-x
more simplification rules on unary and binary minus

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

## directory layout

if [ -z "$ISABELLE_HOME" ]; then
  ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
  ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"
fi


## 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)
    jars            Isabelle/Scala (requires \$ISABELLE_JDK_HOME and \$SCALA_HOME)
    jars_test       test separate build of jars
    jars_fresh      fresh build of jars

EOF
  exit 1
}

function fail()
{
  echo "$1" >&2
  exit 2
}


## process command line

[ "$#" -eq 0 ] && usage

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


## modules

function build_all ()
{
  build_browser
  build_jars
}


function build_browser ()
{
  pushd "$ISABELLE_HOME/lib/browser" >/dev/null
  "$ISABELLE_TOOL" env ./build || exit $?
  popd >/dev/null
}


function build_jars ()
{
  pushd "$ISABELLE_HOME/src/Pure" >/dev/null
  "$ISABELLE_TOOL" env ./build-jars "$@" || exit $?
  popd >/dev/null
}


## main

#workaround for scalac 2.10.2
function stty() { :; }
export -f stty

for MODULE in $MODULES
do
  case $MODULE in
    all) build_all;;
    browser) build_browser;;
    jars) build_jars;;
    jars_fresh) build_jars -f;;
    jars_test) build_jars -t;;
    *) fail "Bad module $MODULE"
  esac
done