Admin/build
author wenzelm
Fri Aug 15 22:16:13 2008 +0200 (2008-08-15)
changeset 27904 343696007eca
parent 27655 cf0c60e821bb
child 27915 42581956d75b
permissions -rwxr-xr-x
jars: build Pure.jar;
     1 #!/usr/bin/env bash
     2 #
     3 # $Id$
     4 #
     5 # Administrative build for Isabelle source distribution.
     6 
     7 ## global environment
     8 
     9 #paranoia setting for sunbroy
    10 PATH="/usr/local/dist/DIR/j2sdk1.5.0/bin:$PATH"
    11 
    12 PATH="/home/scala/scala/bin:$PATH"
    13 
    14 
    15 ## directory layout
    16 
    17 ISABELLE_DIR="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
    18 
    19 if [ -d "$ISABELLE_DIR/Distribution" ]; then
    20   OLD_LAYOUT=true
    21   ISATOOL="$ISABELLE_DIR/Distribution/bin/isatool"
    22 else
    23   OLD_LAYOUT=false
    24   ISATOOL="$ISABELLE_DIR/bin/isatool"
    25 fi
    26 
    27 
    28 ## diagnostics
    29 
    30 PRG="$(basename "$0")"
    31 
    32 function usage()
    33 {
    34   cat <<EOF
    35 
    36 Usage: $PRG [MODULES]
    37 
    38   Produce Isabelle distribution modules from current repository sources.
    39   The MODULES list may contain any of the following:
    40 
    41     all             all modules below
    42     browser         graph browser (requires jdk)
    43     doc             documentation (requires latex and rail)
    44     jars            JVM components (requires jdk and scala)
    45 
    46 EOF
    47   exit 1
    48 }
    49 
    50 function fail()
    51 {
    52   echo "$1" >&2
    53   exit 2
    54 }
    55 
    56 
    57 ## process command line
    58 
    59 [ "$#" -eq 0 ] && usage
    60 
    61 MODULES="$@"; shift "$#"
    62 
    63 
    64 ## modules
    65 
    66 function build_all ()
    67 {
    68   build_doc
    69   build_browser
    70   build_jars
    71 }
    72 
    73 
    74 function build_browser ()
    75 {
    76   echo "###"
    77   echo "### Building graph browser ..."
    78   echo "###"
    79 
    80   if [ "$OLD_LAYOUT" = true ]; then
    81     cd "$ISABELLE_DIR/Distribution/lib/browser"
    82   else
    83     cd "$ISABELLE_DIR/lib/browser"
    84   fi
    85   make clean all || fail "Failed to build graph browser!"
    86 }
    87 
    88 
    89 function build_doc ()
    90 {
    91   echo "###"
    92   echo "### Building documentation ..."
    93   echo "###"
    94 
    95   if [ "$OLD_LAYOUT" = true ]; then
    96     cd "$ISABELLE_DIR/Doc"
    97   else
    98     cd "$ISABELLE_DIR/doc-src"
    99   fi
   100 
   101   for DOC in $(cat Dirs)
   102   do
   103     pushd "$DOC" >/dev/null
   104     make clean dvi || fail "DVI document for $DOC failed!"
   105     make clean pdf || fail "PDF document for $DOC failed!"
   106     popd >/dev/null
   107   done
   108 }
   109 
   110 
   111 function build_jars ()
   112 {
   113   echo "###"
   114   echo "### Building JVM components ..."
   115   echo "###"
   116 
   117   if [ "$OLD_LAYOUT" = true ]; then
   118     cd "$ISABELLE_DIR/Distribution"
   119   else
   120     cd "$ISABELLE_DIR"
   121   fi
   122 
   123   pushd src/Pure >/dev/null
   124   "$ISATOOL" make jar || fail "Failed to build Pure.jar!"
   125   popd >/dev/null
   126 
   127   pushd lib/classes >/dev/null
   128   ./mk
   129   [ -f isabelle.jar ] || fail "Failed to build Isabelle process wrapper!"
   130   popd >/dev/null
   131 
   132   if [ -d "$HOME/lib/jedit/current" ]; then
   133     type -p scalac >/dev/null || fail "Scala compiler unavailable"
   134     pushd lib/jedit/plugin >/dev/null
   135     ./mk
   136     [ -f ../isabelle.jar ] || fail "Failed to build jEdit plugin!"
   137     popd >/dev/null
   138   else
   139     echo "Warning: skipping jedit plugin"
   140   fi
   141 }
   142 
   143 
   144 ## main
   145 
   146 for MODULE in $MODULES
   147 do
   148   case $MODULE in
   149     all) build_all;;
   150     browser) build_browser;;
   151     doc) build_doc;;
   152     jars) build_jars;;
   153     *) fail "Bad module $MODULE"
   154   esac
   155 done