Admin/build
author wenzelm
Sun Dec 28 23:20:57 2008 +0100 (2008-12-28)
changeset 29186 3d25e96ceb98
parent 29153 789cd671636e
child 31831 92993da74973
permissions -rwxr-xr-x
disabled old jedit plugin;
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
## global environment
wenzelm@27628
     6
wenzelm@27628
     7
#paranoia setting for sunbroy
wenzelm@27628
     8
PATH="/usr/local/dist/DIR/j2sdk1.5.0/bin:$PATH"
wenzelm@27628
     9
wenzelm@29153
    10
PATH="/home/scala/current/bin:$PATH"
wenzelm@27628
    11
wenzelm@27628
    12
wenzelm@27628
    13
## directory layout
wenzelm@27628
    14
wenzelm@28956
    15
ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
wenzelm@28956
    16
ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"
wenzelm@27628
    17
wenzelm@27628
    18
wenzelm@27628
    19
## diagnostics
wenzelm@27628
    20
wenzelm@27628
    21
PRG="$(basename "$0")"
wenzelm@27628
    22
wenzelm@27628
    23
function usage()
wenzelm@27628
    24
{
wenzelm@27628
    25
  cat <<EOF
wenzelm@27628
    26
wenzelm@27628
    27
Usage: $PRG [MODULES]
wenzelm@27628
    28
wenzelm@27628
    29
  Produce Isabelle distribution modules from current repository sources.
wenzelm@27628
    30
  The MODULES list may contain any of the following:
wenzelm@27628
    31
wenzelm@27628
    32
    all             all modules below
wenzelm@27628
    33
    browser         graph browser (requires jdk)
wenzelm@27628
    34
    doc             documentation (requires latex and rail)
wenzelm@27628
    35
    jars            JVM components (requires jdk and scala)
wenzelm@27628
    36
wenzelm@27628
    37
EOF
wenzelm@27628
    38
  exit 1
wenzelm@27628
    39
}
wenzelm@27628
    40
wenzelm@27628
    41
function fail()
wenzelm@27628
    42
{
wenzelm@27628
    43
  echo "$1" >&2
wenzelm@27628
    44
  exit 2
wenzelm@27628
    45
}
wenzelm@27628
    46
wenzelm@27628
    47
wenzelm@27628
    48
## process command line
wenzelm@27628
    49
wenzelm@27628
    50
[ "$#" -eq 0 ] && usage
wenzelm@27628
    51
wenzelm@27628
    52
MODULES="$@"; shift "$#"
wenzelm@27628
    53
wenzelm@27628
    54
wenzelm@27628
    55
## modules
wenzelm@27628
    56
wenzelm@27628
    57
function build_all ()
wenzelm@27628
    58
{
wenzelm@27649
    59
  build_doc
wenzelm@27628
    60
  build_browser
wenzelm@27628
    61
  build_jars
wenzelm@27628
    62
}
wenzelm@27628
    63
wenzelm@27628
    64
wenzelm@27628
    65
function build_browser ()
wenzelm@27628
    66
{
wenzelm@27628
    67
  echo "###"
wenzelm@27628
    68
  echo "### Building graph browser ..."
wenzelm@27628
    69
  echo "###"
wenzelm@27628
    70
wenzelm@28956
    71
  cd "$ISABELLE_HOME/lib/browser"
wenzelm@27628
    72
  make clean all || fail "Failed to build graph browser!"
wenzelm@27628
    73
}
wenzelm@27628
    74
wenzelm@27628
    75
wenzelm@27628
    76
function build_doc ()
wenzelm@27628
    77
{
wenzelm@27628
    78
  echo "###"
wenzelm@27628
    79
  echo "### Building documentation ..."
wenzelm@27628
    80
  echo "###"
wenzelm@27628
    81
wenzelm@28956
    82
  cd "$ISABELLE_HOME/doc-src"
wenzelm@27628
    83
  for DOC in $(cat Dirs)
wenzelm@27628
    84
  do
wenzelm@27629
    85
    pushd "$DOC" >/dev/null
wenzelm@27628
    86
    make clean dvi || fail "DVI document for $DOC failed!"
wenzelm@27628
    87
    make clean pdf || fail "PDF document for $DOC failed!"
wenzelm@27629
    88
    popd >/dev/null
wenzelm@27628
    89
  done
wenzelm@27628
    90
}
wenzelm@27628
    91
wenzelm@27628
    92
wenzelm@27628
    93
function build_jars ()
wenzelm@27628
    94
{
wenzelm@27628
    95
  echo "###"
wenzelm@27628
    96
  echo "### Building JVM components ..."
wenzelm@27628
    97
  echo "###"
wenzelm@27628
    98
wenzelm@27978
    99
  type -p scalac >/dev/null || fail "Scala compiler unavailable"
wenzelm@27978
   100
wenzelm@28956
   101
  pushd "$ISABELLE_HOME/src/Pure" >/dev/null
wenzelm@28500
   102
  "$ISABELLE_TOOL" make jar || fail "Failed to build Pure.jar!"
wenzelm@27904
   103
  popd >/dev/null
wenzelm@27628
   104
}
wenzelm@27628
   105
wenzelm@27628
   106
wenzelm@27628
   107
## main
wenzelm@27628
   108
wenzelm@27628
   109
for MODULE in $MODULES
wenzelm@27628
   110
do
wenzelm@27628
   111
  case $MODULE in
wenzelm@27628
   112
    all) build_all;;
wenzelm@27628
   113
    browser) build_browser;;
wenzelm@27628
   114
    doc) build_doc;;
wenzelm@27628
   115
    jars) build_jars;;
wenzelm@27628
   116
    *) fail "Bad module $MODULE"
wenzelm@27628
   117
  esac
wenzelm@27628
   118
done