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