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