Admin/build
author wenzelm
Sat Aug 16 13:32:23 2008 +0200 (2008-08-16)
changeset 27915 42581956d75b
parent 27904 343696007eca
child 27978 9fb6cfaa5da5
permissions -rwxr-xr-x
more robust handling of directory layout variants;
wenzelm@27628
     1
#!/usr/bin/env bash
wenzelm@27628
     2
#
wenzelm@27628
     3
# $Id$
wenzelm@27628
     4
#
wenzelm@27629
     5
# Administrative build for Isabelle source distribution.
wenzelm@27628
     6
wenzelm@27628
     7
## global environment
wenzelm@27628
     8
wenzelm@27628
     9
#paranoia setting for sunbroy
wenzelm@27628
    10
PATH="/usr/local/dist/DIR/j2sdk1.5.0/bin:$PATH"
wenzelm@27628
    11
wenzelm@27650
    12
PATH="/home/scala/scala/bin:$PATH"
wenzelm@27628
    13
wenzelm@27628
    14
wenzelm@27628
    15
## directory layout
wenzelm@27628
    16
wenzelm@27628
    17
ISABELLE_DIR="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
wenzelm@27628
    18
wenzelm@27628
    19
if [ -d "$ISABELLE_DIR/Distribution" ]; then
wenzelm@27904
    20
  ISATOOL="$ISABELLE_DIR/Distribution/bin/isatool"
wenzelm@27915
    21
  ISABELLE_LIB="$ISABELLE_DIR/Distribution/lib"
wenzelm@27915
    22
  ISABELLE_SRC="$ISABELLE_DIR"
wenzelm@27915
    23
  ISABELLE_DOC_SRC="$ISABELLE_DIR/Doc"
wenzelm@27628
    24
else
wenzelm@27904
    25
  ISATOOL="$ISABELLE_DIR/bin/isatool"
wenzelm@27915
    26
  ISABELLE_LIB="$ISABELLE_DIR/lib"
wenzelm@27915
    27
  ISABELLE_SRC="$ISABELLE_DIR/src"
wenzelm@27915
    28
  ISABELLE_DOC_SRC="$ISABELLE_DIR/doc-src"
wenzelm@27628
    29
fi
wenzelm@27628
    30
wenzelm@27628
    31
wenzelm@27628
    32
## diagnostics
wenzelm@27628
    33
wenzelm@27628
    34
PRG="$(basename "$0")"
wenzelm@27628
    35
wenzelm@27628
    36
function usage()
wenzelm@27628
    37
{
wenzelm@27628
    38
  cat <<EOF
wenzelm@27628
    39
wenzelm@27628
    40
Usage: $PRG [MODULES]
wenzelm@27628
    41
wenzelm@27628
    42
  Produce Isabelle distribution modules from current repository sources.
wenzelm@27628
    43
  The MODULES list may contain any of the following:
wenzelm@27628
    44
wenzelm@27628
    45
    all             all modules below
wenzelm@27628
    46
    browser         graph browser (requires jdk)
wenzelm@27628
    47
    doc             documentation (requires latex and rail)
wenzelm@27628
    48
    jars            JVM components (requires jdk and scala)
wenzelm@27628
    49
wenzelm@27628
    50
EOF
wenzelm@27628
    51
  exit 1
wenzelm@27628
    52
}
wenzelm@27628
    53
wenzelm@27628
    54
function fail()
wenzelm@27628
    55
{
wenzelm@27628
    56
  echo "$1" >&2
wenzelm@27628
    57
  exit 2
wenzelm@27628
    58
}
wenzelm@27628
    59
wenzelm@27628
    60
wenzelm@27628
    61
## process command line
wenzelm@27628
    62
wenzelm@27628
    63
[ "$#" -eq 0 ] && usage
wenzelm@27628
    64
wenzelm@27628
    65
MODULES="$@"; shift "$#"
wenzelm@27628
    66
wenzelm@27628
    67
wenzelm@27628
    68
## modules
wenzelm@27628
    69
wenzelm@27628
    70
function build_all ()
wenzelm@27628
    71
{
wenzelm@27649
    72
  build_doc
wenzelm@27628
    73
  build_browser
wenzelm@27628
    74
  build_jars
wenzelm@27628
    75
}
wenzelm@27628
    76
wenzelm@27628
    77
wenzelm@27628
    78
function build_browser ()
wenzelm@27628
    79
{
wenzelm@27628
    80
  echo "###"
wenzelm@27628
    81
  echo "### Building graph browser ..."
wenzelm@27628
    82
  echo "###"
wenzelm@27628
    83
wenzelm@27915
    84
  cd "$ISABELLE_LIB/browser"
wenzelm@27628
    85
  make clean all || fail "Failed to build graph browser!"
wenzelm@27628
    86
}
wenzelm@27628
    87
wenzelm@27628
    88
wenzelm@27628
    89
function build_doc ()
wenzelm@27628
    90
{
wenzelm@27628
    91
  echo "###"
wenzelm@27628
    92
  echo "### Building documentation ..."
wenzelm@27628
    93
  echo "###"
wenzelm@27628
    94
wenzelm@27915
    95
  cd "$ISABELLE_DOC_SRC"
wenzelm@27628
    96
  for DOC in $(cat Dirs)
wenzelm@27628
    97
  do
wenzelm@27629
    98
    pushd "$DOC" >/dev/null
wenzelm@27628
    99
    make clean dvi || fail "DVI document for $DOC failed!"
wenzelm@27628
   100
    make clean pdf || fail "PDF document for $DOC failed!"
wenzelm@27629
   101
    popd >/dev/null
wenzelm@27628
   102
  done
wenzelm@27628
   103
}
wenzelm@27628
   104
wenzelm@27628
   105
wenzelm@27628
   106
function build_jars ()
wenzelm@27628
   107
{
wenzelm@27628
   108
  echo "###"
wenzelm@27628
   109
  echo "### Building JVM components ..."
wenzelm@27628
   110
  echo "###"
wenzelm@27628
   111
wenzelm@27915
   112
  pushd "$ISABELLE_SRC/Pure" >/dev/null
wenzelm@27904
   113
  "$ISATOOL" make jar || fail "Failed to build Pure.jar!"
wenzelm@27904
   114
  popd >/dev/null
wenzelm@27904
   115
wenzelm@27915
   116
  pushd "$ISABELLE_LIB/classes" >/dev/null
wenzelm@27628
   117
  ./mk
wenzelm@27628
   118
  [ -f isabelle.jar ] || fail "Failed to build Isabelle process wrapper!"
wenzelm@27629
   119
  popd >/dev/null
wenzelm@27628
   120
wenzelm@27655
   121
  if [ -d "$HOME/lib/jedit/current" ]; then
wenzelm@27655
   122
    type -p scalac >/dev/null || fail "Scala compiler unavailable"
wenzelm@27915
   123
    pushd "$ISABELLE_LIB/jedit/plugin" >/dev/null
wenzelm@27655
   124
    ./mk
wenzelm@27655
   125
    [ -f ../isabelle.jar ] || fail "Failed to build jEdit plugin!"
wenzelm@27655
   126
    popd >/dev/null
wenzelm@27655
   127
  else
wenzelm@27655
   128
    echo "Warning: skipping jedit plugin"
wenzelm@27655
   129
  fi
wenzelm@27628
   130
}
wenzelm@27628
   131
wenzelm@27628
   132
wenzelm@27628
   133
## main
wenzelm@27628
   134
wenzelm@27628
   135
for MODULE in $MODULES
wenzelm@27628
   136
do
wenzelm@27628
   137
  case $MODULE in
wenzelm@27628
   138
    all) build_all;;
wenzelm@27628
   139
    browser) build_browser;;
wenzelm@27628
   140
    doc) build_doc;;
wenzelm@27628
   141
    jars) build_jars;;
wenzelm@27628
   142
    *) fail "Bad module $MODULE"
wenzelm@27628
   143
  esac
wenzelm@27628
   144
done