lib/Tools/options
author nipkow
Fri, 08 Aug 2014 08:26:32 +0200
changeset 57817 dfebc374bd89
parent 52735 842b5e7dcac8
child 62437 bccad0374407
permissions -rwxr-xr-x
tuned
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     2
#
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     3
# Author: Makarius
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     4
#
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     5
# DESCRIPTION: print Isabelle system options
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     6
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     7
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     8
## diagnostics
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     9
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    10
PRG="$(basename "$0")"
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    11
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    12
function usage()
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    13
{
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    14
  echo
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    15
  echo "Usage: isabelle $PRG [OPTIONS] [MORE_OPTIONS ...]"
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    16
  echo
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    17
  echo "  Options are:"
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    18
  echo "    -b           include \$ISABELLE_BUILD_OPTIONS"
52735
842b5e7dcac8 support isabelle options -g;
wenzelm
parents: 52443
diff changeset
    19
  echo "    -g OPTION    get value of OPTION"
50531
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    20
  echo "    -l           list options"
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    21
  echo "    -x FILE      export options to FILE in YXML format"
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    22
  echo
50531
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    23
  echo "  Report Isabelle system options, augmented by MORE_OPTIONS given as"
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    24
  echo "  arguments NAME=VAL or NAME."
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    25
  echo
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    26
  exit 1
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    27
}
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    28
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    29
function fail()
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    30
{
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    31
  echo "$1" >&2
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    32
  exit 2
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    33
}
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    34
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    35
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    36
## process command line
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    37
52055
10bc73197a57 more precise "eval", cf. isabelle build;
wenzelm
parents: 50531
diff changeset
    38
declare -a BUILD_OPTIONS=()
52735
842b5e7dcac8 support isabelle options -g;
wenzelm
parents: 52443
diff changeset
    39
GET_OPTION=""
50531
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    40
LIST_OPTIONS="false"
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    41
EXPORT_FILE=""
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    42
52735
842b5e7dcac8 support isabelle options -g;
wenzelm
parents: 52443
diff changeset
    43
while getopts "bg:lx:" OPT
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    44
do
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    45
  case "$OPT" in
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    46
    b)
52055
10bc73197a57 more precise "eval", cf. isabelle build;
wenzelm
parents: 50531
diff changeset
    47
      eval "BUILD_OPTIONS=($ISABELLE_BUILD_OPTIONS)"
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    48
      ;;
52735
842b5e7dcac8 support isabelle options -g;
wenzelm
parents: 52443
diff changeset
    49
    g)
842b5e7dcac8 support isabelle options -g;
wenzelm
parents: 52443
diff changeset
    50
      GET_OPTION="$OPTARG"
842b5e7dcac8 support isabelle options -g;
wenzelm
parents: 52443
diff changeset
    51
      ;;
50531
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    52
    l)
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    53
      LIST_OPTIONS="true"
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    54
      ;;
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    55
    x)
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    56
      EXPORT_FILE="$OPTARG"
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    57
      ;;
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    58
    \?)
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    59
      usage
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    60
      ;;
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    61
  esac
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    62
done
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    63
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    64
shift $(($OPTIND - 1))
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    65
52735
842b5e7dcac8 support isabelle options -g;
wenzelm
parents: 52443
diff changeset
    66
[ -z "$GET_OPTION" -a "$LIST_OPTIONS" = "false" -a -z "$EXPORT_FILE" ] && usage
50531
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    67
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    68
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    69
## main
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    70
52443
725916b7dee5 more formal isabelle_admin_build;
wenzelm
parents: 52055
diff changeset
    71
isabelle_admin_build jars || exit $?
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    72
52735
842b5e7dcac8 support isabelle options -g;
wenzelm
parents: 52443
diff changeset
    73
exec "$ISABELLE_TOOL" java isabelle.Options \
842b5e7dcac8 support isabelle options -g;
wenzelm
parents: 52443
diff changeset
    74
  "$GET_OPTION" "$EXPORT_FILE" "${BUILD_OPTIONS[@]}" "$@"
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    75