Admin/build
author wenzelm
Thu Jul 17 15:33:01 2008 +0200 (2008-07-17)
changeset 27629 ec92e8eb6a1e
parent 27628 901656b3205d
child 27649 cb26fe3ea037
permissions -rwxr-xr-x
less verbosity;
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@27628
    12
PATH="/home/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@27628
    20
  OLD_LAYOUT=true
wenzelm@27628
    21
else
wenzelm@27628
    22
  OLD_LAYOUT=false
wenzelm@27628
    23
fi
wenzelm@27628
    24
wenzelm@27628
    25
wenzelm@27628
    26
## diagnostics
wenzelm@27628
    27
wenzelm@27628
    28
PRG="$(basename "$0")"
wenzelm@27628
    29
wenzelm@27628
    30
function usage()
wenzelm@27628
    31
{
wenzelm@27628
    32
  cat <<EOF
wenzelm@27628
    33
wenzelm@27628
    34
Usage: $PRG [MODULES]
wenzelm@27628
    35
wenzelm@27628
    36
  Produce Isabelle distribution modules from current repository sources.
wenzelm@27628
    37
  The MODULES list may contain any of the following:
wenzelm@27628
    38
wenzelm@27628
    39
    all             all modules below
wenzelm@27628
    40
    browser         graph browser (requires jdk)
wenzelm@27628
    41
    doc             documentation (requires latex and rail)
wenzelm@27628
    42
    jars            JVM components (requires jdk and scala)
wenzelm@27628
    43
wenzelm@27628
    44
EOF
wenzelm@27628
    45
  exit 1
wenzelm@27628
    46
}
wenzelm@27628
    47
wenzelm@27628
    48
function fail()
wenzelm@27628
    49
{
wenzelm@27628
    50
  echo "$1" >&2
wenzelm@27628
    51
  exit 2
wenzelm@27628
    52
}
wenzelm@27628
    53
wenzelm@27628
    54
wenzelm@27628
    55
## process command line
wenzelm@27628
    56
wenzelm@27628
    57
[ "$#" -eq 0 ] && usage
wenzelm@27628
    58
wenzelm@27628
    59
MODULES="$@"; shift "$#"
wenzelm@27628
    60
wenzelm@27628
    61
wenzelm@27628
    62
## modules
wenzelm@27628
    63
wenzelm@27628
    64
function build_all ()
wenzelm@27628
    65
{
wenzelm@27628
    66
  build_browser
wenzelm@27628
    67
  build_doc
wenzelm@27628
    68
  build_jars
wenzelm@27628
    69
}
wenzelm@27628
    70
wenzelm@27628
    71
wenzelm@27628
    72
function build_browser ()
wenzelm@27628
    73
{
wenzelm@27628
    74
  echo "###"
wenzelm@27628
    75
  echo "### Building graph browser ..."
wenzelm@27628
    76
  echo "###"
wenzelm@27628
    77
wenzelm@27628
    78
  if [ "$OLD_LAYOUT" = true ]; then
wenzelm@27628
    79
    cd "$ISABELLE_DIR/Distribution/lib/browser"
wenzelm@27628
    80
  else
wenzelm@27628
    81
    cd "$ISABELLE_DIR/lib/browser"
wenzelm@27628
    82
  fi
wenzelm@27628
    83
  make clean all || fail "Failed to build graph browser!"
wenzelm@27628
    84
}
wenzelm@27628
    85
wenzelm@27628
    86
wenzelm@27628
    87
function build_doc ()
wenzelm@27628
    88
{
wenzelm@27628
    89
  echo "###"
wenzelm@27628
    90
  echo "### Building documentation ..."
wenzelm@27628
    91
  echo "###"
wenzelm@27628
    92
wenzelm@27628
    93
  if [ "$OLD_LAYOUT" = true ]; then
wenzelm@27628
    94
    cd "$ISABELLE_DIR/Doc"
wenzelm@27628
    95
  else
wenzelm@27628
    96
    cd "$ISABELLE_DIR/doc-src"
wenzelm@27628
    97
  fi
wenzelm@27628
    98
wenzelm@27628
    99
  for DOC in $(cat Dirs)
wenzelm@27628
   100
  do
wenzelm@27629
   101
    pushd "$DOC" >/dev/null
wenzelm@27628
   102
    make clean dvi || fail "DVI document for $DOC failed!"
wenzelm@27628
   103
    make clean pdf || fail "PDF document for $DOC failed!"
wenzelm@27629
   104
    popd >/dev/null
wenzelm@27628
   105
  done
wenzelm@27628
   106
}
wenzelm@27628
   107
wenzelm@27628
   108
wenzelm@27628
   109
function build_jars ()
wenzelm@27628
   110
{
wenzelm@27628
   111
  echo "###"
wenzelm@27628
   112
  echo "### Building JVM components ..."
wenzelm@27628
   113
  echo "###"
wenzelm@27628
   114
wenzelm@27628
   115
  if [ "$OLD_LAYOUT" = true ]; then
wenzelm@27628
   116
    cd "$ISABELLE_DIR/Distribution"
wenzelm@27628
   117
  else
wenzelm@27628
   118
    cd "$ISABELLE_DIR"
wenzelm@27628
   119
  fi
wenzelm@27628
   120
wenzelm@27629
   121
  pushd lib/classes >/dev/null
wenzelm@27628
   122
  ./mk
wenzelm@27628
   123
  [ -f isabelle.jar ] || fail "Failed to build Isabelle process wrapper!"
wenzelm@27629
   124
  popd >/dev/null
wenzelm@27628
   125
wenzelm@27629
   126
  type -p scalac >/dev/null || fail "Scala compiler unavailable"
wenzelm@27629
   127
  pushd lib/jedit/plugin >/dev/null
wenzelm@27628
   128
  ./mk
wenzelm@27628
   129
  [ -f ../isabelle.jar ] || fail "Failed to build jEdit plugin!"
wenzelm@27629
   130
  popd >/dev/null
wenzelm@27628
   131
}
wenzelm@27628
   132
wenzelm@27628
   133
wenzelm@27628
   134
## main
wenzelm@27628
   135
wenzelm@27628
   136
for MODULE in $MODULES
wenzelm@27628
   137
do
wenzelm@27628
   138
  case $MODULE in
wenzelm@27628
   139
    all) build_all;;
wenzelm@27628
   140
    browser) build_browser;;
wenzelm@27628
   141
    doc) build_doc;;
wenzelm@27628
   142
    jars) build_jars;;
wenzelm@27628
   143
    *) fail "Bad module $MODULE"
wenzelm@27628
   144
  esac
wenzelm@27628
   145
done