simplified build/bootstrap of graph browser -- avoid make;
authorwenzelm
Wed Jan 06 22:18:52 2010 +0100 (2010-01-06)
changeset 342837911e83d06c0
parent 34282 549969a7f582
child 34284 33ad3571ad83
simplified build/bootstrap of graph browser -- avoid make;
Admin/build
lib/Tools/browser
lib/browser/Makefile
lib/browser/build
     1.1 --- a/Admin/build	Wed Jan 06 20:00:22 2010 +0100
     1.2 +++ b/Admin/build	Wed Jan 06 22:18:52 2010 +0100
     1.3 @@ -58,12 +58,9 @@
     1.4  
     1.5  function build_browser ()
     1.6  {
     1.7 -  echo "###"
     1.8 -  echo "### Building graph browser ..."
     1.9 -  echo "###"
    1.10 -
    1.11 -  cd "$ISABELLE_HOME/lib/browser"
    1.12 -  make clean all || fail "Failed to build graph browser!"
    1.13 +  pushd "$ISABELLE_HOME/lib/browser" >/dev/null
    1.14 +  "$ISABELLE_TOOL" env ./build || fail "Failed!"
    1.15 +  popd >/dev/null
    1.16  }
    1.17  
    1.18  
     2.1 --- a/lib/Tools/browser	Wed Jan 06 20:00:22 2010 +0100
     2.2 +++ b/lib/Tools/browser	Wed Jan 06 22:18:52 2010 +0100
     2.3 @@ -60,6 +60,8 @@
     2.4  
     2.5  ## main
     2.6  
     2.7 +[ -e "$ISABELLE_HOME/Admin/build" ] && "$ISABELLE_HOME/Admin/build" browser
     2.8 +
     2.9  classpath "$ISABELLE_HOME/lib/browser/GraphBrowser.jar"
    2.10  
    2.11  if [ -z "$GRAPHFILE" ]; then
     3.1 --- a/lib/browser/Makefile	Wed Jan 06 20:00:22 2010 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,16 +0,0 @@
     3.4 -
     3.5 -DST=classes
     3.6 -
     3.7 -all: GraphBrowser.jar
     3.8 -
     3.9 -GraphBrowser.jar: GraphBrowser/*.java awtUtilities/*.java
    3.10 -	mkdir -p $(DST)
    3.11 -	javac -source 1.4 -d $(DST) GraphBrowser/GraphBrowser.java GraphBrowser/Console.java
    3.12 -	jar cf GraphBrowser.jar -C $(DST) . 
    3.13 -	rm -rf $(DST)
    3.14 -
    3.15 -clean:
    3.16 -	rm -f GraphBrowser/*.class
    3.17 -	rm -f awtUtilities/*.class
    3.18 -	rm -rf $(DST)
    3.19 -	rm -f GraphBrowser.jar
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/lib/browser/build	Wed Jan 06 22:18:52 2010 +0100
     4.3 @@ -0,0 +1,74 @@
     4.4 +#!/usr/bin/env bash
     4.5 +#
     4.6 +# Author: Makarius
     4.7 +#
     4.8 +# mk - build graph browser
     4.9 +#
    4.10 +# Requires proper Isabelle settings environment.
    4.11 +
    4.12 +
    4.13 +## diagnostics
    4.14 +
    4.15 +function fail()
    4.16 +{
    4.17 +  echo "$1" >&2
    4.18 +  exit 2
    4.19 +}
    4.20 +
    4.21 +[ -n "$ISABELLE_HOME" ] || fail "Missing Isabelle settings environment"
    4.22 +
    4.23 +
    4.24 +## dependencies
    4.25 +
    4.26 +declare -a SOURCES=(
    4.27 +  GraphBrowser/AWTFontMetrics.java
    4.28 +  GraphBrowser/AbstractFontMetrics.java
    4.29 +  GraphBrowser/Box.java
    4.30 +  GraphBrowser/Console.java
    4.31 +  GraphBrowser/DefaultFontMetrics.java
    4.32 +  GraphBrowser/Directory.java
    4.33 +  GraphBrowser/DummyVertex.java
    4.34 +  GraphBrowser/Graph.java
    4.35 +  GraphBrowser/GraphBrowser.java
    4.36 +  GraphBrowser/GraphBrowserFrame.java
    4.37 +  GraphBrowser/GraphView.java
    4.38 +  GraphBrowser/NormalVertex.java
    4.39 +  GraphBrowser/ParseError.java
    4.40 +  GraphBrowser/Region.java
    4.41 +  GraphBrowser/Spline.java
    4.42 +  GraphBrowser/TreeBrowser.java
    4.43 +  GraphBrowser/TreeNode.java
    4.44 +  GraphBrowser/Vertex.java
    4.45 +  awtUtilities/Border.java
    4.46 +  awtUtilities/MessageDialog.java
    4.47 +  awtUtilities/TextFrame.java
    4.48 +)
    4.49 +
    4.50 +TARGET="$ISABELLE_HOME/lib/browser/GraphBrowser.jar"
    4.51 +
    4.52 +
    4.53 +## main
    4.54 +
    4.55 +OUTDATED=false
    4.56 +
    4.57 +for SOURCE in "${SOURCES[@]}"
    4.58 +do
    4.59 +  [ ! -e "$SOURCE" ] && fail "Missing source file: $SOURCE"
    4.60 +  [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
    4.61 +done
    4.62 +
    4.63 +if [ "$OUTDATED" = true ]
    4.64 +then
    4.65 +  echo "###"
    4.66 +  echo "### Building graph browser ..."
    4.67 +  echo "###"
    4.68 +
    4.69 +  rm -rf classes && mkdir classes
    4.70 +
    4.71 +  javac -d classes -source 1.4 "${SOURCES[@]}" || \
    4.72 +    fail "Failed to compile sources"
    4.73 +  jar cf "$(jvmpath "$TARGET")" -C classes . ||
    4.74 +    fail "Failed to produce $TARGET"
    4.75 +
    4.76 +  rm -rf classes
    4.77 +fi