Admin/build
author wenzelm
Mon Nov 07 14:59:58 2011 +0100 (2011-11-07)
changeset 45385 7c1375ba1424
parent 45091 bf56eb7af632
child 46933 3b02b0ef8d48
permissions -rwxr-xr-x
offline build of java_ext_dirs.jar, to avoid runtime dependency on javac/jar executables;
wenzelm@27628
     1
#!/usr/bin/env bash
wenzelm@27628
     2
#
wenzelm@27629
     3
# Administrative build for Isabelle source distribution.
wenzelm@27628
     4
wenzelm@27628
     5
## directory layout
wenzelm@27628
     6
wenzelm@34282
     7
if [ -z "$ISABELLE_HOME" ]; then
wenzelm@34282
     8
  ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
wenzelm@34282
     9
  ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"
wenzelm@34282
    10
fi
wenzelm@27628
    11
wenzelm@27628
    12
wenzelm@27628
    13
## diagnostics
wenzelm@27628
    14
wenzelm@27628
    15
PRG="$(basename "$0")"
wenzelm@27628
    16
wenzelm@27628
    17
function usage()
wenzelm@27628
    18
{
wenzelm@27628
    19
  cat <<EOF
wenzelm@27628
    20
wenzelm@27628
    21
Usage: $PRG [MODULES]
wenzelm@27628
    22
wenzelm@27628
    23
  Produce Isabelle distribution modules from current repository sources.
wenzelm@27628
    24
  The MODULES list may contain any of the following:
wenzelm@27628
    25
wenzelm@27628
    26
    all             all modules below
wenzelm@27628
    27
    browser         graph browser (requires jdk)
wenzelm@27628
    28
    doc             documentation (requires latex and rail)
wenzelm@34876
    29
    jars            Isabelle/Scala layer (requires Scala in \$SCALA_HOME)
wenzelm@43280
    30
    jars_fresh      fresh build of jars
wenzelm@27628
    31
wenzelm@27628
    32
EOF
wenzelm@27628
    33
  exit 1
wenzelm@27628
    34
}
wenzelm@27628
    35
wenzelm@27628
    36
function fail()
wenzelm@27628
    37
{
wenzelm@27628
    38
  echo "$1" >&2
wenzelm@27628
    39
  exit 2
wenzelm@27628
    40
}
wenzelm@27628
    41
wenzelm@27628
    42
wenzelm@27628
    43
## process command line
wenzelm@27628
    44
wenzelm@27628
    45
[ "$#" -eq 0 ] && usage
wenzelm@27628
    46
wenzelm@27628
    47
MODULES="$@"; shift "$#"
wenzelm@27628
    48
wenzelm@27628
    49
wenzelm@27628
    50
## modules
wenzelm@27628
    51
wenzelm@27628
    52
function build_all ()
wenzelm@27628
    53
{
wenzelm@27649
    54
  build_doc
wenzelm@27628
    55
  build_browser
wenzelm@27628
    56
  build_jars
wenzelm@27628
    57
}
wenzelm@27628
    58
wenzelm@27628
    59
wenzelm@27628
    60
function build_browser ()
wenzelm@27628
    61
{
wenzelm@34283
    62
  pushd "$ISABELLE_HOME/lib/browser" >/dev/null
wenzelm@34297
    63
  "$ISABELLE_TOOL" env ./build || exit $?
wenzelm@34283
    64
  popd >/dev/null
wenzelm@27628
    65
}
wenzelm@27628
    66
wenzelm@27628
    67
wenzelm@27628
    68
function build_doc ()
wenzelm@27628
    69
{
wenzelm@27628
    70
  echo "###"
wenzelm@27628
    71
  echo "### Building documentation ..."
wenzelm@27628
    72
  echo "###"
wenzelm@27628
    73
wenzelm@28956
    74
  cd "$ISABELLE_HOME/doc-src"
wenzelm@27628
    75
  for DOC in $(cat Dirs)
wenzelm@27628
    76
  do
wenzelm@27629
    77
    pushd "$DOC" >/dev/null
wenzelm@27628
    78
    make clean dvi || fail "DVI document for $DOC failed!"
wenzelm@27628
    79
    make clean pdf || fail "PDF document for $DOC failed!"
wenzelm@27629
    80
    popd >/dev/null
wenzelm@27628
    81
  done
wenzelm@27628
    82
}
wenzelm@27628
    83
wenzelm@27628
    84
wenzelm@27628
    85
function build_jars ()
wenzelm@27628
    86
{
wenzelm@28956
    87
  pushd "$ISABELLE_HOME/src/Pure" >/dev/null
wenzelm@43280
    88
  "$ISABELLE_TOOL" env ./build-jars "$@" || exit $?
wenzelm@27904
    89
  popd >/dev/null
wenzelm@27628
    90
}
wenzelm@27628
    91
wenzelm@27628
    92
wenzelm@27628
    93
## main
wenzelm@27628
    94
wenzelm@27628
    95
for MODULE in $MODULES
wenzelm@27628
    96
do
wenzelm@27628
    97
  case $MODULE in
wenzelm@27628
    98
    all) build_all;;
wenzelm@27628
    99
    browser) build_browser;;
wenzelm@27628
   100
    doc) build_doc;;
wenzelm@27628
   101
    jars) build_jars;;
wenzelm@43280
   102
    jars_fresh) build_jars -f;;
wenzelm@27628
   103
    *) fail "Bad module $MODULE"
wenzelm@27628
   104
  esac
wenzelm@27628
   105
done