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