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