Admin/build
author wenzelm
Mon Aug 06 14:19:56 2012 +0200 (2012-08-06)
changeset 48691 335d60e1e328
parent 48498 62f183129ae6
child 48972 196520d51afd
permissions -rwxr-xr-x
discontinued presumably obsolete attempts at doc-src testing (cf. 3b02b0ef8d48, 89cc3dfb383b);
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@48691
    26
    all             all modules below
wenzelm@27628
    27
    browser         graph browser (requires jdk)
wenzelm@48498
    28
    doc             documentation (requires latex)
wenzelm@47115
    29
    jars            Isabelle/Scala layer (requires \$ISABELLE_JDK_HOME and \$SCALA_HOME)
wenzelm@47408
    30
    jars_test       test separate build of jars
wenzelm@43280
    31
    jars_fresh      fresh build of jars
wenzelm@27628
    32
wenzelm@27628
    33
EOF
wenzelm@27628
    34
  exit 1
wenzelm@27628
    35
}
wenzelm@27628
    36
wenzelm@27628
    37
function fail()
wenzelm@27628
    38
{
wenzelm@27628
    39
  echo "$1" >&2
wenzelm@27628
    40
  exit 2
wenzelm@27628
    41
}
wenzelm@27628
    42
wenzelm@27628
    43
wenzelm@27628
    44
## process command line
wenzelm@27628
    45
wenzelm@27628
    46
[ "$#" -eq 0 ] && usage
wenzelm@27628
    47
wenzelm@27628
    48
MODULES="$@"; shift "$#"
wenzelm@27628
    49
wenzelm@27628
    50
wenzelm@27628
    51
## modules
wenzelm@27628
    52
wenzelm@27628
    53
function build_all ()
wenzelm@27628
    54
{
wenzelm@27649
    55
  build_doc
wenzelm@27628
    56
  build_browser
wenzelm@27628
    57
  build_jars
wenzelm@27628
    58
}
wenzelm@27628
    59
wenzelm@27628
    60
wenzelm@27628
    61
function build_browser ()
wenzelm@27628
    62
{
wenzelm@34283
    63
  pushd "$ISABELLE_HOME/lib/browser" >/dev/null
wenzelm@34297
    64
  "$ISABELLE_TOOL" env ./build || exit $?
wenzelm@34283
    65
  popd >/dev/null
wenzelm@27628
    66
}
wenzelm@27628
    67
wenzelm@27628
    68
wenzelm@27628
    69
function build_doc ()
wenzelm@27628
    70
{
wenzelm@27628
    71
  echo "###"
wenzelm@27628
    72
  echo "### Building documentation ..."
wenzelm@27628
    73
  echo "###"
wenzelm@27628
    74
wenzelm@28956
    75
  cd "$ISABELLE_HOME/doc-src"
wenzelm@27628
    76
  for DOC in $(cat Dirs)
wenzelm@27628
    77
  do
wenzelm@27629
    78
    pushd "$DOC" >/dev/null
wenzelm@27628
    79
    make clean dvi || fail "DVI document for $DOC failed!"
wenzelm@27628
    80
    make clean pdf || fail "PDF document for $DOC failed!"
wenzelm@27629
    81
    popd >/dev/null
wenzelm@27628
    82
  done
wenzelm@27628
    83
}
wenzelm@27628
    84
wenzelm@27628
    85
wenzelm@27628
    86
function build_jars ()
wenzelm@27628
    87
{
wenzelm@28956
    88
  pushd "$ISABELLE_HOME/src/Pure" >/dev/null
wenzelm@43280
    89
  "$ISABELLE_TOOL" env ./build-jars "$@" || exit $?
wenzelm@27904
    90
  popd >/dev/null
wenzelm@27628
    91
}
wenzelm@27628
    92
wenzelm@27628
    93
wenzelm@27628
    94
## main
wenzelm@27628
    95
wenzelm@27628
    96
for MODULE in $MODULES
wenzelm@27628
    97
do
wenzelm@27628
    98
  case $MODULE in
wenzelm@27628
    99
    all) build_all;;
wenzelm@27628
   100
    browser) build_browser;;
wenzelm@27628
   101
    doc) build_doc;;
wenzelm@27628
   102
    jars) build_jars;;
wenzelm@43280
   103
    jars_fresh) build_jars -f;;
wenzelm@47408
   104
    jars_test) build_jars -t;;
wenzelm@27628
   105
    *) fail "Bad module $MODULE"
wenzelm@27628
   106
  esac
wenzelm@27628
   107
done