Admin/build
author wenzelm
Mon Jan 11 23:41:06 2010 +0100 (2010-01-11)
changeset 34876 b52e03f68cc3
parent 34297 5c0a2583f997
child 43280 e5dd0ae1b054
permissions -rwxr-xr-x
clarified terminology;
     1 #!/usr/bin/env bash
     2 #
     3 # Administrative build for Isabelle source distribution.
     4 
     5 ## directory layout
     6 
     7 if [ -z "$ISABELLE_HOME" ]; then
     8   ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
     9   ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"
    10 fi
    11 
    12 
    13 ## diagnostics
    14 
    15 PRG="$(basename "$0")"
    16 
    17 function usage()
    18 {
    19   cat <<EOF
    20 
    21 Usage: $PRG [MODULES]
    22 
    23   Produce Isabelle distribution modules from current repository sources.
    24   The MODULES list may contain any of the following:
    25 
    26     all             all modules below
    27     browser         graph browser (requires jdk)
    28     doc             documentation (requires latex and rail)
    29     jars            Isabelle/Scala layer (requires Scala in \$SCALA_HOME)
    30 
    31 EOF
    32   exit 1
    33 }
    34 
    35 function fail()
    36 {
    37   echo "$1" >&2
    38   exit 2
    39 }
    40 
    41 
    42 ## process command line
    43 
    44 [ "$#" -eq 0 ] && usage
    45 
    46 MODULES="$@"; shift "$#"
    47 
    48 
    49 ## modules
    50 
    51 function build_all ()
    52 {
    53   build_doc
    54   build_browser
    55   build_jars
    56 }
    57 
    58 
    59 function build_browser ()
    60 {
    61   pushd "$ISABELLE_HOME/lib/browser" >/dev/null
    62   "$ISABELLE_TOOL" env ./build || exit $?
    63   popd >/dev/null
    64 }
    65 
    66 
    67 function build_doc ()
    68 {
    69   echo "###"
    70   echo "### Building documentation ..."
    71   echo "###"
    72 
    73   cd "$ISABELLE_HOME/doc-src"
    74   for DOC in $(cat Dirs)
    75   do
    76     pushd "$DOC" >/dev/null
    77     make clean dvi || fail "DVI document for $DOC failed!"
    78     make clean pdf || fail "PDF document for $DOC failed!"
    79     popd >/dev/null
    80   done
    81 }
    82 
    83 
    84 function build_jars ()
    85 {
    86   pushd "$ISABELLE_HOME/src/Pure" >/dev/null
    87   "$ISABELLE_TOOL" env ./build-jars || exit $?
    88   popd >/dev/null
    89 }
    90 
    91 
    92 ## main
    93 
    94 for MODULE in $MODULES
    95 do
    96   case $MODULE in
    97     all) build_all;;
    98     browser) build_browser;;
    99     doc) build_doc;;
   100     jars) build_jars;;
   101     *) fail "Bad module $MODULE"
   102   esac
   103 done