simplified build/bootstrap of Isabelle/Scala components -- avoid make;
authorwenzelm
Wed Jan 06 20:00:22 2010 +0100 (2010-01-06)
changeset 34282549969a7f582
parent 34281 eedea6f0b37e
child 34283 7911e83d06c0
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
Admin/build
Isabelle
lib/Tools/scala
src/Pure/IsaMakefile
src/Pure/mk
src/Pure/mk-jars
     1.1 --- a/Admin/build	Wed Jan 06 18:22:43 2010 +0100
     1.2 +++ b/Admin/build	Wed Jan 06 20:00:22 2010 +0100
     1.3 @@ -2,21 +2,12 @@
     1.4  #
     1.5  # Administrative build for Isabelle source distribution.
     1.6  
     1.7 -## global environment
     1.8 -
     1.9 -#paranoia setting for sunbroy
    1.10 -PATH="/usr/local/dist/DIR/j2sdk1.5.0/bin:$PATH"
    1.11 -
    1.12 -PATH="/home/scala/current/bin:$PATH"
    1.13 -if [ -z "$SCALA_HOME" ]; then
    1.14 -  export SCALA_HOME="$(dirname "$(dirname "$(type -p scalac)")")"
    1.15 -fi
    1.16 -
    1.17 -
    1.18  ## directory layout
    1.19  
    1.20 -ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
    1.21 -ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"
    1.22 +if [ -z "$ISABELLE_HOME" ]; then
    1.23 +  ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
    1.24 +  ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"
    1.25 +fi
    1.26  
    1.27  
    1.28  ## diagnostics
    1.29 @@ -35,7 +26,7 @@
    1.30      all             all modules below
    1.31      browser         graph browser (requires jdk)
    1.32      doc             documentation (requires latex and rail)
    1.33 -    jars            Scala/JVM components (requires scala)
    1.34 +    jars            Scala/JVM components (requires scala in SCALA_HOME)
    1.35  
    1.36  EOF
    1.37    exit 1
    1.38 @@ -95,14 +86,8 @@
    1.39  
    1.40  function build_jars ()
    1.41  {
    1.42 -  echo "###"
    1.43 -  echo "### Building Scala/JVM components ..."
    1.44 -  echo "###"
    1.45 -
    1.46 -  [ -z "$SCALA_HOME" ] && fail "Scala unavailable: unknown SCALA_HOME"
    1.47 -
    1.48    pushd "$ISABELLE_HOME/src/Pure" >/dev/null
    1.49 -  "$ISABELLE_TOOL" make jars || fail "Failed to build isabelle-scala.jar"
    1.50 +  "$ISABELLE_TOOL" env ./mk-jars || fail "Failed."
    1.51    popd >/dev/null
    1.52  }
    1.53  
     2.1 --- a/Isabelle	Wed Jan 06 18:22:43 2010 +0100
     2.2 +++ b/Isabelle	Wed Jan 06 20:00:22 2010 +0100
     2.3 @@ -16,12 +16,14 @@
     2.4  source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
     2.5  
     2.6  unset ISABELLE_SETTINGS_PRESENT
     2.7 +unset ISABELLE_SITE_SETTINGS_PRESENT
     2.8  
     2.9  
    2.10  ## main
    2.11  
    2.12 +[ -e "$ISABELLE_HOME/Admin/build" ] && "$ISABELLE_HOME/Admin/build" jars
    2.13 +
    2.14  CLASSPATH="$(jvmpath "$CLASSPATH")"
    2.15 -
    2.16  exec "$ISABELLE_JAVA" \
    2.17    "-Disabelle.home=$(jvmpath "$ISABELLE_HOME")" \
    2.18    -jar "$(jvmpath "$ISABELLE_HOME/lib/classes/isabelle-scala.jar")" "$@"
     3.1 --- a/lib/Tools/scala	Wed Jan 06 18:22:43 2010 +0100
     3.2 +++ b/lib/Tools/scala	Wed Jan 06 20:00:22 2010 +0100
     3.3 @@ -4,5 +4,7 @@
     3.4  #
     3.5  # DESCRIPTION: invoke Scala within the Isabelle environment
     3.6  
     3.7 +[ -e "$ISABELLE_HOME/Admin/build" ] && "$ISABELLE_HOME/Admin/build" jars
     3.8 +
     3.9  CLASSPATH="$(jvmpath "$CLASSPATH")"
    3.10  exec "$ISABELLE_SCALA" "$@"
     4.1 --- a/src/Pure/IsaMakefile	Wed Jan 06 18:22:43 2010 +0100
     4.2 +++ b/src/Pure/IsaMakefile	Wed Jan 06 20:00:22 2010 +0100
     4.3 @@ -117,39 +117,3 @@
     4.4  clean:
     4.5  	@rm -f $(OUT)/Pure $(LOG)/Pure.gz $(OUT)/RAW $(LOG)/RAW.gz \
     4.6            $(LOG)/Pure-ProofGeneral.gz
     4.7 -
     4.8 -
     4.9 -## Scala material
    4.10 -
    4.11 -SCALA_FILES = Concurrent/future.scala General/download.scala		\
    4.12 -  General/event_bus.scala General/exn.scala General/linear_set.scala	\
    4.13 -  General/markup.scala General/position.scala General/scan.scala	\
    4.14 -  General/swing_thread.scala General/symbol.scala General/xml.scala	\
    4.15 -  General/yxml.scala Isar/isar_document.scala Isar/outer_keyword.scala	\
    4.16 -  Isar/outer_lex.scala Isar/outer_parse.scala Isar/outer_syntax.scala	\
    4.17 -  System/cygwin.scala System/gui_setup.scala				\
    4.18 -  System/isabelle_process.scala System/isabelle_syntax.scala		\
    4.19 -  System/isabelle_system.scala System/platform.scala			\
    4.20 -  System/session_manager.scala System/standard_system.scala		\
    4.21 -  Thy/completion.scala Thy/html.scala Thy/text_edit.scala		\
    4.22 -  Thy/thy_header.scala Thy/thy_syntax.scala library.scala
    4.23 -
    4.24 -JAR_DIR = $(ISABELLE_HOME)/lib/classes
    4.25 -PURE_JAR = $(JAR_DIR)/Pure.jar
    4.26 -FULL_JAR = $(JAR_DIR)/isabelle-scala.jar
    4.27 -
    4.28 -jars: $(FULL_JAR)
    4.29 -
    4.30 -$(FULL_JAR): $(SCALA_FILES)
    4.31 -	@rm -rf classes && mkdir classes
    4.32 -	"$(SCALA_HOME)/bin/scalac" -unchecked -deprecation -d classes -target jvm-1.5 $(SCALA_FILES)
    4.33 -	@cp $(SCALA_FILES) classes/isabelle
    4.34 -	@mkdir -p "$(JAR_DIR)"
    4.35 -	@cd classes; jar cfe `jvmpath "$(PURE_JAR)"` isabelle.GUI_Setup isabelle
    4.36 -	@cd classes; cp "$(SCALA_HOME)/lib/scala-swing.jar" .; jar xf scala-swing.jar; \
    4.37 -          cp "$(SCALA_HOME)/lib/scala-library.jar" "$(FULL_JAR)"; \
    4.38 -          jar ufe `jvmpath $(FULL_JAR)` isabelle.GUI_Setup isabelle scala
    4.39 -	@rm -rf classes
    4.40 -
    4.41 -clean-jars:
    4.42 -	@rm -f "$(PURE_JAR)" "$(FULL_JAR)"
     5.1 --- a/src/Pure/mk	Wed Jan 06 18:22:43 2010 +0100
     5.2 +++ b/src/Pure/mk	Wed Jan 06 20:00:22 2010 +0100
     5.3 @@ -2,9 +2,9 @@
     5.4  #
     5.5  # Author: Markus Wenzel, TU Muenchen
     5.6  #
     5.7 -# mk - build Pure Isabelle.
     5.8 +# mk - build Isabelle/Pure.
     5.9  #
    5.10 -# Requires proper Isabelle settings environment (cf. IsaMakefile).
    5.11 +# Requires proper Isabelle settings environment.
    5.12  
    5.13  
    5.14  ## diagnostics
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/Pure/mk-jars	Wed Jan 06 20:00:22 2010 +0100
     6.3 @@ -0,0 +1,98 @@
     6.4 +#!/usr/bin/env bash
     6.5 +#
     6.6 +# Author: Makarius
     6.7 +#
     6.8 +# mk-jars - build Isabelle/Scala
     6.9 +#
    6.10 +# Requires proper Isabelle settings environment.
    6.11 +
    6.12 +
    6.13 +## diagnostics
    6.14 +
    6.15 +function fail()
    6.16 +{
    6.17 +  echo "$1" >&2
    6.18 +  exit 2
    6.19 +}
    6.20 +
    6.21 +[ -n "$ISABELLE_HOME" ] || fail "Missing Isabelle settings environment"
    6.22 +[ -z "$SCALA_HOME" ] && fail "Scala unavailable: unknown SCALA_HOME"
    6.23 +
    6.24 +
    6.25 +## dependencies
    6.26 +
    6.27 +declare -a SOURCES=(
    6.28 +  Concurrent/future.scala
    6.29 +  General/download.scala
    6.30 +  General/event_bus.scala
    6.31 +  General/exn.scala
    6.32 +  General/linear_set.scala
    6.33 +  General/markup.scala
    6.34 +  General/position.scala
    6.35 +  General/scan.scala
    6.36 +  General/swing_thread.scala
    6.37 +  General/symbol.scala
    6.38 +  General/xml.scala
    6.39 +  General/yxml.scala
    6.40 +  Isar/isar_document.scala
    6.41 +  Isar/outer_keyword.scala
    6.42 +  Isar/outer_lex.scala
    6.43 +  Isar/outer_parse.scala
    6.44 +  Isar/outer_syntax.scala
    6.45 +  System/cygwin.scala
    6.46 +  System/gui_setup.scala
    6.47 +  System/isabelle_process.scala
    6.48 +  System/isabelle_syntax.scala
    6.49 +  System/isabelle_system.scala
    6.50 +  System/platform.scala
    6.51 +  System/session_manager.scala
    6.52 +  System/standard_system.scala
    6.53 +  Thy/completion.scala
    6.54 +  Thy/html.scala
    6.55 +  Thy/text_edit.scala
    6.56 +  Thy/thy_header.scala
    6.57 +  Thy/thy_syntax.scala
    6.58 +  library.scala
    6.59 +)
    6.60 +
    6.61 +JAR_DIR="$ISABELLE_HOME/lib/classes"
    6.62 +PURE_JAR="$JAR_DIR/Pure.jar"
    6.63 +FULL_JAR="$JAR_DIR/isabelle-scala.jar"
    6.64 +
    6.65 +
    6.66 +## main
    6.67 +
    6.68 +OUTDATED=false
    6.69 +
    6.70 +for SOURCE in "${SOURCES[@]}"
    6.71 +do
    6.72 +  [ ! -e "$SOURCE" ] && fail "Missing source file: $SOURCE"
    6.73 +  for TARGET in "$PURE_JAR" "$FULL_JAR"
    6.74 +  do
    6.75 +    [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
    6.76 +  done
    6.77 +done
    6.78 +
    6.79 +if [ "$OUTDATED" = true ]; then
    6.80 +  echo "###"
    6.81 +  echo "### Building Isabelle/Scala components ..."
    6.82 +  echo "###"
    6.83 +
    6.84 +  rm -rf classes && mkdir classes
    6.85 +  "$SCALA_HOME/bin/scalac" -unchecked -deprecation -d classes -target jvm-1.5 "${SOURCES[@]}" || \
    6.86 +    fail "Failed to compile sources"
    6.87 +  mkdir -p "$JAR_DIR" || fail "Failed to create directory $JAR_DIR"
    6.88 +  (
    6.89 +    cd classes
    6.90 +    jar cfe "$(jvmpath "$PURE_JAR")" isabelle.GUI_Setup isabelle || \
    6.91 +      fail "Failed to produce $PURE_JAR"
    6.92 +
    6.93 +    cp "$SCALA_HOME/lib/scala-swing.jar" .
    6.94 +    jar xf scala-swing.jar
    6.95 +
    6.96 +    cp "$SCALA_HOME/lib/scala-library.jar" "$FULL_JAR"
    6.97 +    jar ufe "$(jvmpath "$FULL_JAR")" isabelle.GUI_Setup isabelle scala || \
    6.98 +      fail "Failed to produce $FULL_JAR"
    6.99 +  )
   6.100 +  rm -rf classes
   6.101 +fi