Admin/build
author wenzelm
Sun Jun 28 17:55:44 2009 +0200 (2009-06-28)
changeset 31831 92993da74973
parent 29186 3d25e96ceb98
child 34282 549969a7f582
permissions -rwxr-xr-x
clarified "jars" target;
     1 #!/usr/bin/env bash
     2 #
     3 # Administrative build for Isabelle source distribution.
     4 
     5 ## global environment
     6 
     7 #paranoia setting for sunbroy
     8 PATH="/usr/local/dist/DIR/j2sdk1.5.0/bin:$PATH"
     9 
    10 PATH="/home/scala/current/bin:$PATH"
    11 if [ -z "$SCALA_HOME" ]; then
    12   export SCALA_HOME="$(dirname "$(dirname "$(type -p scalac)")")"
    13 fi
    14 
    15 
    16 ## directory layout
    17 
    18 ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
    19 ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"
    20 
    21 
    22 ## diagnostics
    23 
    24 PRG="$(basename "$0")"
    25 
    26 function usage()
    27 {
    28   cat <<EOF
    29 
    30 Usage: $PRG [MODULES]
    31 
    32   Produce Isabelle distribution modules from current repository sources.
    33   The MODULES list may contain any of the following:
    34 
    35     all             all modules below
    36     browser         graph browser (requires jdk)
    37     doc             documentation (requires latex and rail)
    38     jars            Scala/JVM components (requires scala)
    39 
    40 EOF
    41   exit 1
    42 }
    43 
    44 function fail()
    45 {
    46   echo "$1" >&2
    47   exit 2
    48 }
    49 
    50 
    51 ## process command line
    52 
    53 [ "$#" -eq 0 ] && usage
    54 
    55 MODULES="$@"; shift "$#"
    56 
    57 
    58 ## modules
    59 
    60 function build_all ()
    61 {
    62   build_doc
    63   build_browser
    64   build_jars
    65 }
    66 
    67 
    68 function build_browser ()
    69 {
    70   echo "###"
    71   echo "### Building graph browser ..."
    72   echo "###"
    73 
    74   cd "$ISABELLE_HOME/lib/browser"
    75   make clean all || fail "Failed to build graph browser!"
    76 }
    77 
    78 
    79 function build_doc ()
    80 {
    81   echo "###"
    82   echo "### Building documentation ..."
    83   echo "###"
    84 
    85   cd "$ISABELLE_HOME/doc-src"
    86   for DOC in $(cat Dirs)
    87   do
    88     pushd "$DOC" >/dev/null
    89     make clean dvi || fail "DVI document for $DOC failed!"
    90     make clean pdf || fail "PDF document for $DOC failed!"
    91     popd >/dev/null
    92   done
    93 }
    94 
    95 
    96 function build_jars ()
    97 {
    98   echo "###"
    99   echo "### Building Scala/JVM components ..."
   100   echo "###"
   101 
   102   [ -z "$SCALA_HOME" ] && fail "Scala unavailable: unknown SCALA_HOME"
   103 
   104   pushd "$ISABELLE_HOME/src/Pure" >/dev/null
   105   "$ISABELLE_TOOL" make jars || fail "Failed to build isabelle-scala.jar"
   106   popd >/dev/null
   107 }
   108 
   109 
   110 ## main
   111 
   112 for MODULE in $MODULES
   113 do
   114   case $MODULE in
   115     all) build_all;;
   116     browser) build_browser;;
   117     doc) build_doc;;
   118     jars) build_jars;;
   119     *) fail "Bad module $MODULE"
   120   esac
   121 done