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;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     2
#
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     3
# Author: Makarius
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     4
#
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     5
# DESCRIPTION: build Isabelle session images via GUI dialog
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     6
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     7
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     8
## diagnostics
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
     9
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    10
PRG="$(basename "$0")"
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    11
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    12
function usage()
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    13
{
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    14
  echo
50546
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50405
diff changeset
    15
  echo "Usage: isabelle $PRG [OPTIONS]"
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    16
  echo
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    17
  echo "  Options are:"
50403
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50370
diff changeset
    18
  echo "    -L OPTION    default logic via system option"
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    19
  echo "    -d DIR       include session directory"
50546
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50405
diff changeset
    20
  echo "    -l NAME      logic session name"
50369
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50365
diff changeset
    21
  echo "    -s           system build mode: produce output in ISABELLE_HOME"
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    22
  echo
50546
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50405
diff changeset
    23
  echo "  Build Isabelle logic session image via GUI dialog (default: $ISABELLE_LOGIC)."
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    24
  echo
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    25
  exit 1
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    26
}
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    27
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    28
function fail()
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    29
{
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    30
  echo "$1" >&2
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    31
  exit 2
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    32
}
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    33
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    34
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    35
## process command line
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    36
50403
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50370
diff changeset
    37
LOGIC_OPTION=""
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    38
declare -a INCLUDE_DIRS=()
50546
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50405
diff changeset
    39
LOGIC=""
50369
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50365
diff changeset
    40
SYSTEM_MODE=false
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    41
50546
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50405
diff changeset
    42
while getopts "L:d:l:s" OPT
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    43
do
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    44
  case "$OPT" in
50403
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50370
diff changeset
    45
    L)
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50370
diff changeset
    46
      LOGIC_OPTION="$OPTARG"
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50370
diff changeset
    47
      ;;
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    48
    d)
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    49
      INCLUDE_DIRS["${#INCLUDE_DIRS[@]}"]="$OPTARG"
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    50
      ;;
50546
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50405
diff changeset
    51
    l)
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50405
diff changeset
    52
      LOGIC="$OPTARG"
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50405
diff changeset
    53
      ;;
50369
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50365
diff changeset
    54
    s)
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50365
diff changeset
    55
      SYSTEM_MODE="true"
622002c702ad more elementary dialog, with less interaction;
wenzelm
parents: 50365
diff changeset
    56
      ;;
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    57
    \?)
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    58
      usage
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    59
      ;;
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    60
  esac
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    61
done
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    62
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    63
shift $(($OPTIND - 1))
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    64
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    65
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    66
# args
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    67
50546
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50405
diff changeset
    68
[ "$#" -ne 0 ] && usage
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    69
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    70
50403
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50370
diff changeset
    71
## main
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    72
50403
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50370
diff changeset
    73
[ -e "$ISABELLE_HOME/Admin/build" ] && { "$ISABELLE_HOME/Admin/build" jars || exit $?; }
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    74
50403
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50370
diff changeset
    75
"$ISABELLE_TOOL" java isabelle.Build_Dialog \
50546
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50405
diff changeset
    76
  "$LOGIC_OPTION" "$LOGIC" "$SYSTEM_MODE" "${INCLUDE_DIRS[@]}"
50365
82f5aea343e7 basic wrapper for session build dialog;
wenzelm
parents:
diff changeset
    77