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