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