Admin/build
author blanchet
Thu, 28 Jul 2011 16:32:39 +0200
changeset 44872 2b75760fa75e
parent 44401 d477b92109b8
child 45976 bf56eb7af632
permissions -rwxr-xr-x
no needless mangling
     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     jars_fresh      fresh build of jars
    31 
    32 EOF
    33   exit 1
    34 }
    35 
    36 function fail()
    37 {
    38   echo "$1" >&2
    39   exit 2
    40 }
    41 
    42 
    43 ## process command line
    44 
    45 [ "$#" -eq 0 ] && usage
    46 
    47 MODULES="$@"; shift "$#"
    48 
    49 
    50 ## modules
    51 
    52 function build_all ()
    53 {
    54   build_doc
    55   build_browser
    56   build_jars
    57 }
    58 
    59 
    60 function build_browser ()
    61 {
    62   pushd "$ISABELLE_HOME/lib/browser" >/dev/null
    63   "$ISABELLE_TOOL" env ./build || exit $?
    64   popd >/dev/null
    65 }
    66 
    67 
    68 function build_doc ()
    69 {
    70   echo "###"
    71   echo "### Building documentation ..."
    72   echo "###"
    73 
    74   cd "$ISABELLE_HOME/doc-src"
    75   for DOC in $(cat Dirs)
    76   do
    77     pushd "$DOC" >/dev/null
    78     make clean dvi || fail "DVI document for $DOC failed!"
    79     make clean pdf || fail "PDF document for $DOC failed!"
    80     popd >/dev/null
    81   done
    82 }
    83 
    84 
    85 function build_jars ()
    86 {
    87   "$ISABELLE_HOME/lib/scripts/java_ext_dirs" >/dev/null
    88   pushd "$ISABELLE_HOME/src/Pure" >/dev/null
    89   "$ISABELLE_TOOL" env ./build-jars "$@" || exit $?
    90   popd >/dev/null
    91 }
    92 
    93 
    94 ## main
    95 
    96 for MODULE in $MODULES
    97 do
    98   case $MODULE in
    99     all) build_all;;
   100     browser) build_browser;;
   101     doc) build_doc;;
   102     jars) build_jars;;
   103     jars_fresh) build_jars -f;;
   104     *) fail "Bad module $MODULE"
   105   esac
   106 done