src/Pure/build-jars
author wenzelm
Wed, 06 Jan 2010 22:21:25 +0100
changeset 34284 33ad3571ad83
parent 34282 src/Pure/mk-jars@549969a7f582
child 34871 e596a0b71f3c
permissions -rwxr-xr-x
tuned Isabelle/Scala build;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34282
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
     2
#
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
     3
# Author: Makarius
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
     4
#
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
     5
# mk-jars - build Isabelle/Scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
     6
#
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
     7
# Requires proper Isabelle settings environment.
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
     8
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
     9
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    10
## diagnostics
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    11
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    12
function fail()
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    13
{
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    14
  echo "$1" >&2
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    15
  exit 2
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    16
}
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    17
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    18
[ -n "$ISABELLE_HOME" ] || fail "Missing Isabelle settings environment"
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    19
[ -z "$SCALA_HOME" ] && fail "Scala unavailable: unknown SCALA_HOME"
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    20
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    21
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    22
## dependencies
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    23
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    24
declare -a SOURCES=(
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    25
  Concurrent/future.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    26
  General/download.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    27
  General/event_bus.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    28
  General/exn.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    29
  General/linear_set.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    30
  General/markup.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    31
  General/position.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    32
  General/scan.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    33
  General/swing_thread.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    34
  General/symbol.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    35
  General/xml.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    36
  General/yxml.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    37
  Isar/isar_document.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    38
  Isar/outer_keyword.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    39
  Isar/outer_lex.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    40
  Isar/outer_parse.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    41
  Isar/outer_syntax.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    42
  System/cygwin.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    43
  System/gui_setup.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    44
  System/isabelle_process.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    45
  System/isabelle_syntax.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    46
  System/isabelle_system.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    47
  System/platform.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    48
  System/session_manager.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    49
  System/standard_system.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    50
  Thy/completion.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    51
  Thy/html.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    52
  Thy/text_edit.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    53
  Thy/thy_header.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    54
  Thy/thy_syntax.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    55
  library.scala
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    56
)
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    57
34284
33ad3571ad83 tuned Isabelle/Scala build;
wenzelm
parents: 34282
diff changeset
    58
TARGET_DIR="$ISABELLE_HOME/lib/classes"
33ad3571ad83 tuned Isabelle/Scala build;
wenzelm
parents: 34282
diff changeset
    59
PURE_JAR="$TARGET_DIR/Pure.jar"
33ad3571ad83 tuned Isabelle/Scala build;
wenzelm
parents: 34282
diff changeset
    60
FULL_JAR="$TARGET_DIR/isabelle-scala.jar"
33ad3571ad83 tuned Isabelle/Scala build;
wenzelm
parents: 34282
diff changeset
    61
33ad3571ad83 tuned Isabelle/Scala build;
wenzelm
parents: 34282
diff changeset
    62
declare -a TARGETS=("$PURE_JAR" "$FULL_JAR")
34282
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    63
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    64
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    65
## main
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    66
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    67
OUTDATED=false
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    68
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    69
for SOURCE in "${SOURCES[@]}"
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    70
do
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    71
  [ ! -e "$SOURCE" ] && fail "Missing source file: $SOURCE"
34284
33ad3571ad83 tuned Isabelle/Scala build;
wenzelm
parents: 34282
diff changeset
    72
  for TARGET in "${TARGETS[@]}"
34282
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    73
  do
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    74
    [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    75
  done
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    76
done
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    77
34284
33ad3571ad83 tuned Isabelle/Scala build;
wenzelm
parents: 34282
diff changeset
    78
if [ "$OUTDATED" = true ]
33ad3571ad83 tuned Isabelle/Scala build;
wenzelm
parents: 34282
diff changeset
    79
then
34282
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    80
  echo "###"
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    81
  echo "### Building Isabelle/Scala components ..."
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    82
  echo "###"
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    83
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    84
  rm -rf classes && mkdir classes
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    85
  "$SCALA_HOME/bin/scalac" -unchecked -deprecation -d classes -target jvm-1.5 "${SOURCES[@]}" || \
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    86
    fail "Failed to compile sources"
34284
33ad3571ad83 tuned Isabelle/Scala build;
wenzelm
parents: 34282
diff changeset
    87
  mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR"
34282
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    88
  (
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    89
    cd classes
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    90
    jar cfe "$(jvmpath "$PURE_JAR")" isabelle.GUI_Setup isabelle || \
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    91
      fail "Failed to produce $PURE_JAR"
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    92
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    93
    cp "$SCALA_HOME/lib/scala-swing.jar" .
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    94
    jar xf scala-swing.jar
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    95
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    96
    cp "$SCALA_HOME/lib/scala-library.jar" "$FULL_JAR"
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    97
    jar ufe "$(jvmpath "$FULL_JAR")" isabelle.GUI_Setup isabelle scala || \
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    98
      fail "Failed to produce $FULL_JAR"
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
    99
  )
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
   100
  rm -rf classes
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff changeset
   101
fi