Admin/build
changeset 27628 901656b3205d
child 27629 ec92e8eb6a1e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Admin/build	Thu Jul 17 15:26:04 2008 +0200
     1.3 @@ -0,0 +1,145 @@
     1.4 +#!/usr/bin/env bash
     1.5 +#
     1.6 +# $Id$
     1.7 +#
     1.8 +# Administrative build -- finish Isabelle source distribution.
     1.9 +
    1.10 +## global environment
    1.11 +
    1.12 +#paranoia setting for sunbroy
    1.13 +PATH="/usr/local/dist/DIR/j2sdk1.5.0/bin:$PATH"
    1.14 +
    1.15 +PATH="/home/scala/bin:$PATH"
    1.16 +
    1.17 +
    1.18 +## directory layout
    1.19 +
    1.20 +ISABELLE_DIR="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
    1.21 +
    1.22 +if [ -d "$ISABELLE_DIR/Distribution" ]; then
    1.23 +  OLD_LAYOUT=true
    1.24 +else
    1.25 +  OLD_LAYOUT=false
    1.26 +fi
    1.27 +
    1.28 +
    1.29 +## diagnostics
    1.30 +
    1.31 +PRG="$(basename "$0")"
    1.32 +
    1.33 +function usage()
    1.34 +{
    1.35 +  cat <<EOF
    1.36 +
    1.37 +Usage: $PRG [MODULES]
    1.38 +
    1.39 +  Produce Isabelle distribution modules from current repository sources.
    1.40 +  The MODULES list may contain any of the following:
    1.41 +
    1.42 +    all             all modules below
    1.43 +    browser         graph browser (requires jdk)
    1.44 +    doc             documentation (requires latex and rail)
    1.45 +    jars            JVM components (requires jdk and scala)
    1.46 +
    1.47 +EOF
    1.48 +  exit 1
    1.49 +}
    1.50 +
    1.51 +function fail()
    1.52 +{
    1.53 +  echo "$1" >&2
    1.54 +  exit 2
    1.55 +}
    1.56 +
    1.57 +
    1.58 +## process command line
    1.59 +
    1.60 +[ "$#" -eq 0 ] && usage
    1.61 +
    1.62 +MODULES="$@"; shift "$#"
    1.63 +
    1.64 +
    1.65 +## modules
    1.66 +
    1.67 +function build_all ()
    1.68 +{
    1.69 +  build_browser
    1.70 +  build_doc
    1.71 +  build_jars
    1.72 +}
    1.73 +
    1.74 +
    1.75 +function build_browser ()
    1.76 +{
    1.77 +  echo "###"
    1.78 +  echo "### Building graph browser ..."
    1.79 +  echo "###"
    1.80 +
    1.81 +  if [ "$OLD_LAYOUT" = true ]; then
    1.82 +    cd "$ISABELLE_DIR/Distribution/lib/browser"
    1.83 +  else
    1.84 +    cd "$ISABELLE_DIR/lib/browser"
    1.85 +  fi
    1.86 +  make clean all || fail "Failed to build graph browser!"
    1.87 +}
    1.88 +
    1.89 +
    1.90 +function build_doc ()
    1.91 +{
    1.92 +  echo "###"
    1.93 +  echo "### Building documentation ..."
    1.94 +  echo "###"
    1.95 +
    1.96 +  if [ "$OLD_LAYOUT" = true ]; then
    1.97 +    cd "$ISABELLE_DIR/Doc"
    1.98 +  else
    1.99 +    cd "$ISABELLE_DIR/doc-src"
   1.100 +  fi
   1.101 +
   1.102 +  for DOC in $(cat Dirs)
   1.103 +  do
   1.104 +    pushd "$DOC" > /dev/null
   1.105 +    make clean dvi || fail "DVI document for $DOC failed!"
   1.106 +    make clean pdf || fail "PDF document for $DOC failed!"
   1.107 +    popd
   1.108 +  done
   1.109 +}
   1.110 +
   1.111 +
   1.112 +function build_jars ()
   1.113 +{
   1.114 +  echo "###"
   1.115 +  echo "### Building JVM components ..."
   1.116 +  echo "###"
   1.117 +
   1.118 +  if [ "$OLD_LAYOUT" = true ]; then
   1.119 +    cd "$ISABELLE_DIR/Distribution"
   1.120 +  else
   1.121 +    cd "$ISABELLE_DIR"
   1.122 +  fi
   1.123 +
   1.124 +  pushd lib/classes
   1.125 +  ./mk
   1.126 +  [ -f isabelle.jar ] || fail "Failed to build Isabelle process wrapper!"
   1.127 +  popd
   1.128 +
   1.129 +  type -p scalac || fail "Scala compiler unavailable"
   1.130 +  pushd lib/jedit/plugin
   1.131 +  ./mk
   1.132 +  [ -f ../isabelle.jar ] || fail "Failed to build jEdit plugin!"
   1.133 +  popd
   1.134 +}
   1.135 +
   1.136 +
   1.137 +## main
   1.138 +
   1.139 +for MODULE in $MODULES
   1.140 +do
   1.141 +  case $MODULE in
   1.142 +    all) build_all;;
   1.143 +    browser) build_browser;;
   1.144 +    doc) build_doc;;
   1.145 +    jars) build_jars;;
   1.146 +    *) fail "Bad module $MODULE"
   1.147 +  esac
   1.148 +done