direct support for component forests via init_components;
explicit ISABELLE_COMPONENTS_MISSING;
# -*- shell-script -*- :mode=shellscript:
#
# Author: Markus Wenzel, TU Muenchen
#
# getsettings - bash source script to augment current env.
if [ -z "$ISABELLE_SETTINGS_PRESENT" ]
then
set -o allexport
ISABELLE_SETTINGS_PRESENT=true
#Cygwin vs. POSIX
if [ "$OSTYPE" = cygwin ]
then
if [ -z "$USER_HOME" ]; then
USER_HOME="$(cygpath -u "$HOMEDRIVE\\$HOMEPATH")"
fi
ISABELLE_HOME_WINDOWS="$(cygpath -w "$(dirname "$ISABELLE_HOME")")\\$(basename "$ISABELLE_HOME")"
ISABELLE_HOME="$(cygpath -u "$ISABELLE_HOME_WINDOWS")"
CLASSPATH="$(cygpath -i -u -p "$CLASSPATH")"
function jvmpath() { cygpath -i -C UTF8 -w -p "$@"; }
CYGWIN_ROOT="$(jvmpath "/")"
else
if [ -z "$USER_HOME" ]; then
USER_HOME="$HOME"
fi
function jvmpath() { echo "$@"; }
CLASSPATH="$CLASSPATH"
fi
export ISABELLE_HOME
#key executables
ISABELLE_PROCESS="$ISABELLE_HOME/bin/isabelle-process"
ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"
function isabelle ()
{
"$ISABELLE_TOOL" "$@"
}
#platform
source "$ISABELLE_HOME/lib/scripts/isabelle-platform"
if [ -z "$ISABELLE_PLATFORM" ]; then
echo 1>&2 "Failed to determine hardware and operating system type!"
exit 2
fi
#Isabelle distribution identifier -- filled in automatically!
ISABELLE_ID=""
[ -z "$ISABELLE_IDENTIFIER" ] && ISABELLE_IDENTIFIER=""
#sometimes users put strange things in here ...
unset ENV
unset BASH_ENV
#support easy settings
function choosefrom ()
{
local RESULT=""
local FILE=""
for FILE in "$@"
do
[ -z "$RESULT" -a -e "$FILE" ] && RESULT="$FILE"
done
[ -z "$RESULT" ] && RESULT="$FILE"
echo "$RESULT"
}
#shared library convenience
function librarypath () {
for X in "$@"
do
case "$ISABELLE_PLATFORM" in
*-darwin)
if [ -z "$DYLD_LIBRARY_PATH" ]; then
DYLD_LIBRARY_PATH="$X"
else
DYLD_LIBRARY_PATH="$X:$DYLD_LIBRARY_PATH"
fi
export DYLD_LIBRARY_PATH
;;
*)
if [ -z "$LD_LIBRARY_PATH" ]; then
LD_LIBRARY_PATH="$X"
else
LD_LIBRARY_PATH="$X:$LD_LIBRARY_PATH"
fi
export LD_LIBRARY_PATH
;;
esac
done
}
#robust invocation via ISABELLE_JDK_HOME
function isabelle_jdk () {
if [ -z "$ISABELLE_JDK_HOME" ]; then
echo "Unknown ISABELLE_JDK_HOME -- Java tools unavailable" >&2
return 127
else
local PRG="$1"; shift
"$ISABELLE_JDK_HOME/bin/$PRG" "$@"
fi
}
#robust invocation via SCALA_HOME
function isabelle_scala () {
if [ -z "$ISABELLE_JDK_HOME" ]; then
echo "Unknown ISABELLE_JDK_HOME -- Java tools unavailable" >&2
return 127
elif [ -z "$SCALA_HOME" ]; then
echo "Unknown SCALA_HOME -- Scala unavailable" >&2
return 127
else
local PRG="$1"; shift
"$SCALA_HOME/bin/$PRG" "$@"
fi
}
#CLASSPATH convenience
function classpath () {
for X in "$@"
do
if [ -z "$CLASSPATH" ]; then
CLASSPATH="$X"
else
CLASSPATH="$X:$CLASSPATH"
fi
done
export CLASSPATH
}
#arrays
function splitarray ()
{
SPLITARRAY=()
local IFS="$1"; shift
for X in $*
do
SPLITARRAY["${#SPLITARRAY[@]}"]="$X"
done
}
# components
ISABELLE_COMPONENTS=""
ISABELLE_COMPONENTS_MISSING=""
#init component tree
function init_component ()
{
local COMPONENT="$1"
case "$COMPONENT" in
/*) ;;
*)
echo >&2 "Absolute component path required: \"$COMPONENT\""
exit 2
;;
esac
if [ -d "$COMPONENT" ]; then
if [ -z "$ISABELLE_COMPONENTS" ]; then
ISABELLE_COMPONENTS="$COMPONENT"
else
ISABELLE_COMPONENTS="$ISABELLE_COMPONENTS:$COMPONENT"
fi
else
echo >&2 "### Missing Isabelle component: \"$COMPONENT\""
if [ -z "$ISABELLE_COMPONENTS_MISSING" ]; then
ISABELLE_COMPONENTS_MISSING="$COMPONENT"
else
ISABELLE_COMPONENTS_MISSING="$ISABELLE_COMPONENTS_MISSING:$COMPONENT"
fi
fi
if [ -f "$COMPONENT/etc/settings" ]; then
source "$COMPONENT/etc/settings"
local RC="$?"
if [ "$RC" -ne 0 ]; then
echo >&2 "Return code $RC from bash script: \"$COMPONENT/etc/settings\""
exit 2
fi
fi
if [ -f "$COMPONENT/etc/components" ]; then
init_components "$COMPONENT" "$COMPONENT/etc/components"
fi
}
#init component forest
function init_components ()
{
local BASE="$1"
local CATALOG="$2"
if [ ! -d "$BASE" ]; then
echo >&2 "Bad component base directory: \"$BASE\""
exit 2
fi
if [ ! -f "$CATALOG" ]; then
echo >&2 "Bad component catalog file: \"$CATALOG\""
exit 2
fi
{
while { unset REPLY; read -r; test "$?" = 0 -o -n "$REPLY"; }
do
case "$REPLY" in
\#* | "") ;;
/*) init_component "$REPLY" ;;
*) init_component "$BASE/$REPLY" ;;
esac
done
} < "$CATALOG"
}
#main components
init_component "$ISABELLE_HOME"
[ -d "$ISABELLE_HOME/Admin" ] && init_component "$ISABELLE_HOME/Admin"
[ -d "$ISABELLE_HOME_USER" ] && init_component "$ISABELLE_HOME_USER"
#ML system identifier
if [ -z "$ML_PLATFORM" ]; then
ML_IDENTIFIER="$ML_SYSTEM"
else
ML_IDENTIFIER="${ML_SYSTEM}_${ML_PLATFORM}"
fi
ISABELLE_OUTPUT="$ISABELLE_OUTPUT/$ML_IDENTIFIER"
#enforce JAVA_HOME
export JAVA_HOME="$ISABELLE_JDK_HOME"
#build condition etc.
case "$ML_SYSTEM" in
polyml*)
ISABELLE_POLYML="true"
;;
*)
ISABELLE_POLYML=""
;;
esac
set +o allexport
fi