lib/Tools/build_dialog
author wenzelm
Sun, 20 Jan 2013 13:59:13 +0100
changeset 50990 11996ea98bbe
parent 50546 1b01a57d2749
child 52443 725916b7dee5
permissions -rwxr-xr-x
tuned;

#!/usr/bin/env bash
#
# Author: Makarius
#
# DESCRIPTION: build Isabelle session images via GUI dialog


## diagnostics

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

function usage()
{
  echo
  echo "Usage: isabelle $PRG [OPTIONS]"
  echo
  echo "  Options are:"
  echo "    -L OPTION    default logic via system option"
  echo "    -d DIR       include session directory"
  echo "    -l NAME      logic session name"
  echo "    -s           system build mode: produce output in ISABELLE_HOME"
  echo
  echo "  Build Isabelle logic session image via GUI dialog (default: $ISABELLE_LOGIC)."
  echo
  exit 1
}

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


## process command line

LOGIC_OPTION=""
declare -a INCLUDE_DIRS=()
LOGIC=""
SYSTEM_MODE=false

while getopts "L:d:l:s" OPT
do
  case "$OPT" in
    L)
      LOGIC_OPTION="$OPTARG"
      ;;
    d)
      INCLUDE_DIRS["${#INCLUDE_DIRS[@]}"]="$OPTARG"
      ;;
    l)
      LOGIC="$OPTARG"
      ;;
    s)
      SYSTEM_MODE="true"
      ;;
    \?)
      usage
      ;;
  esac
done

shift $(($OPTIND - 1))


# args

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


## main

[ -e "$ISABELLE_HOME/Admin/build" ] && { "$ISABELLE_HOME/Admin/build" jars || exit $?; }

"$ISABELLE_TOOL" java isabelle.Build_Dialog \
  "$LOGIC_OPTION" "$LOGIC" "$SYSTEM_MODE" "${INCLUDE_DIRS[@]}"