Admin/MacOS/script
author wenzelm
Wed, 17 Dec 2008 14:39:38 +0100
changeset 29136 de5b29c25af9
child 29149 eae45c2a6811
permissions -rwxr-xr-x
basic setup for MacOS application bundle;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29136
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
     1
#!/bin/bash
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
     2
#
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
     3
# Author: Makarius
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
     4
#
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
     5
# Isabelle application wrapper
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
     6
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
     7
THIS="$(cd "$(dirname "$0")"; pwd)"
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
     8
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
     9
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    10
# global defaults
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    11
ISABELLE_TOOL=""
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    12
ISABELLE_INTERFACE="emacs"
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    13
#ISABELLE_INTERFACE="jedit"
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    14
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    15
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    16
# sane environment defaults
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    17
PATH="$PATH:/opt/local/bin"
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    18
cd "$HOME"
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    19
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    20
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    21
# Isabelle location
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    22
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    23
if [ -z "$ISABELLE_TOOL" ]; then
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    24
  if [ -e "$THIS/Isabelle/bin/isabelle" ]; then
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    25
    ISABELLE_TOOL="$THIS/Isabelle/bin/isabelle"
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    26
  elif [ -e "$HOME/bin/isabelle" ]; then
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    27
    ISABELLE_TOOL="$HOME/bin/isabelle"
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    28
  else
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    29
    ISABELLE_TOOL=isabelle
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    30
  fi
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    31
fi
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    32
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    33
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    34
# run interface
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    35
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    36
OUTPUT="/tmp/isabelle$$.out"
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    37
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    38
( "$HOME/bin/isabelle" "$ISABELLE_INTERFACE" "$@" ) > "$OUTPUT" 2>&1
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    39
RC=$?
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    40
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    41
if [ "$RC" != 0 ]; then
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    42
  echo >> "$OUTPUT"
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    43
  echo "Return code: $RC" >> "$OUTPUT"
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    44
fi
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    45
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    46
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    47
# error feedback
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    48
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    49
if [ -n "$OUTPUT" ]; then
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    50
  "$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" textbox \
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    51
    --title "Isabelle" \
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    52
    --informative-text "Isabelle output" \
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    53
    --text-from-file "$OUTPUT" \
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    54
    --button1 "OK"
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    55
fi
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    56
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    57
rm -f "$OUTPUT"
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    58
de5b29c25af9 basic setup for MacOS application bundle;
wenzelm
parents:
diff changeset
    59
exit "$RC"