Admin/build
author wenzelm
Mon Aug 06 14:19:56 2012 +0200 (2012-08-06)
changeset 48691 335d60e1e328
parent 48498 62f183129ae6
child 48972 196520d51afd
permissions -rwxr-xr-x
discontinued presumably obsolete attempts at doc-src testing (cf. 3b02b0ef8d48, 89cc3dfb383b);
     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)
    29     jars            Isabelle/Scala layer (requires \$ISABELLE_JDK_HOME and \$SCALA_HOME)
    30     jars_test       test separate build of jars
    31     jars_fresh      fresh build of jars
    32 
    33 EOF
    34   exit 1
    35 }
    36 
    37 function fail()
    38 {
    39   echo "$1" >&2
    40   exit 2
    41 }
    42 
    43 
    44 ## process command line
    45 
    46 [ "$#" -eq 0 ] && usage
    47 
    48 MODULES="$@"; shift "$#"
    49 
    50 
    51 ## modules
    52 
    53 function build_all ()
    54 {
    55   build_doc
    56   build_browser
    57   build_jars
    58 }
    59 
    60 
    61 function build_browser ()
    62 {
    63   pushd "$ISABELLE_HOME/lib/browser" >/dev/null
    64   "$ISABELLE_TOOL" env ./build || exit $?
    65   popd >/dev/null
    66 }
    67 
    68 
    69 function build_doc ()
    70 {
    71   echo "###"
    72   echo "### Building documentation ..."
    73   echo "###"
    74 
    75   cd "$ISABELLE_HOME/doc-src"
    76   for DOC in $(cat Dirs)
    77   do
    78     pushd "$DOC" >/dev/null
    79     make clean dvi || fail "DVI document for $DOC failed!"
    80     make clean pdf || fail "PDF document for $DOC failed!"
    81     popd >/dev/null
    82   done
    83 }
    84 
    85 
    86 function build_jars ()
    87 {
    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     jars_test) build_jars -t;;
   105     *) fail "Bad module $MODULE"
   106   esac
   107 done