build
author wenzelm
Thu, 26 Jul 2012 19:08:14 +0200
changeset 48524 5af593945522
parent 40775 ed7a4eadb2f6
permissions -rwxr-xr-x
avoid clash of Misc/pairs.thy and Types/Pairs.thy on case-insensible file-system;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10555
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10511
diff changeset
     1
#!/usr/bin/env bash
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
     2
#
9817
wenzelm
parents: 9789
diff changeset
     3
# Author: Markus Wenzel, TU Muenchen
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
     4
#
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
     5
# build - compile the Isabelle system and object-logics
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
     6
15844
6b1e5f703246 improved handling of symlinks;
wenzelm
parents: 15779
diff changeset
     7
if [ -L "$0" ]; then
6b1e5f703246 improved handling of symlinks;
wenzelm
parents: 15779
diff changeset
     8
  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
15967
f9163c6f69d6 proper treatment of directory links;
wenzelm
parents: 15877
diff changeset
     9
  exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
15844
6b1e5f703246 improved handling of symlinks;
wenzelm
parents: 15779
diff changeset
    10
fi
6b1e5f703246 improved handling of symlinks;
wenzelm
parents: 15779
diff changeset
    11
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
    12
4457
wenzelm
parents: 3255
diff changeset
    13
## global settings
wenzelm
parents: 3255
diff changeset
    14
40775
ed7a4eadb2f6 remove HOLCF from build script, since it no longer works
huffman
parents: 34238
diff changeset
    15
ALL_LOGICS="Pure FOL HOL ZF CCL CTT Cube FOLP LCF Sequents"
4457
wenzelm
parents: 3255
diff changeset
    16
wenzelm
parents: 3255
diff changeset
    17
2789
69cf3aea45ee major tuning;
wenzelm
parents: 2781
diff changeset
    18
## settings
69cf3aea45ee major tuning;
wenzelm
parents: 2781
diff changeset
    19
15967
f9163c6f69d6 proper treatment of directory links;
wenzelm
parents: 15877
diff changeset
    20
PRG="$(basename "$0")"
f9163c6f69d6 proper treatment of directory links;
wenzelm
parents: 15877
diff changeset
    21
f9163c6f69d6 proper treatment of directory links;
wenzelm
parents: 15877
diff changeset
    22
ISABELLE_HOME="$(cd "$(dirname "$0")"; pwd -P)"
f9163c6f69d6 proper treatment of directory links;
wenzelm
parents: 15877
diff changeset
    23
source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
    24
26211
ffd91f7a78a2 removed obsolete THIS_IS_ISABELLE_BUILD feature: change environment after getsettings (works due to static scoping);
wenzelm
parents: 18321
diff changeset
    25
ISABELLE_OUTPUT="$ISABELLE_HOME/heaps/$ML_IDENTIFIER"
ffd91f7a78a2 removed obsolete THIS_IS_ISABELLE_BUILD feature: change environment after getsettings (works due to static scoping);
wenzelm
parents: 18321
diff changeset
    26
ISABELLE_BROWSER_INFO="$ISABELLE_HOME/browser_info"
ffd91f7a78a2 removed obsolete THIS_IS_ISABELLE_BUILD feature: change environment after getsettings (works due to static scoping);
wenzelm
parents: 18321
diff changeset
    27
2789
69cf3aea45ee major tuning;
wenzelm
parents: 2781
diff changeset
    28
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    29
## diagnostics
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    30
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    31
function usage()
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    32
{
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    33
  echo
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    34
  echo "Usage: $PRG [OPTIONS] [LOGICS ...]"
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    35
  echo
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    36
  echo "  Options are:"
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    37
  echo "    -a           all logics"
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
    38
  echo "    -b           batch mode"
6256
e17fb80b3ce1 -i option;
wenzelm
parents: 5393
diff changeset
    39
  echo "    -i           make images"
7889
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    40
  echo "    -m TARGET    make this target"
6256
e17fb80b3ce1 -i option;
wenzelm
parents: 5393
diff changeset
    41
  echo "    -t           make test"
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    42
  echo
3184
4e0bbfb113d5 renamed DEFAULT_LOGIC to ISABELLE_LOGIC;
wenzelm
parents: 3007
diff changeset
    43
  echo "  Compile the named LOGICS (default $ISABELLE_LOGIC), or all object logics"
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    44
  echo "  in the distribution."
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    45
  echo
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    46
  exit 1
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    47
}
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    48
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    49
function fail()
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    50
{
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    51
  echo "$1" >&2
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    52
  exit 2
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    53
}
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    54
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    55
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    56
## process command line
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    57
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    58
# options
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    59
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    60
ALL=""
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
    61
BATCH=""
7889
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    62
TARGETS=""
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
    63
15844
6b1e5f703246 improved handling of symlinks;
wenzelm
parents: 15779
diff changeset
    64
while getopts "abim:t" OPT
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    65
do
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    66
  case "$OPT" in
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    67
    a)
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    68
      ALL=true
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    69
      ;;
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
    70
    b)
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
    71
      BATCH=true
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
    72
      ;;
6256
e17fb80b3ce1 -i option;
wenzelm
parents: 5393
diff changeset
    73
    i)
7889
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    74
      TARGETS="$TARGETS images"
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    75
      ;;
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    76
    m)
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    77
      TARGETS="$TARGETS $OPTARG"
6256
e17fb80b3ce1 -i option;
wenzelm
parents: 5393
diff changeset
    78
      ;;
2918
0305b0acba78 added -t (run tests) option;
wenzelm
parents: 2914
diff changeset
    79
    t)
7889
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    80
      TARGETS="$TARGETS test"
2918
0305b0acba78 added -t (run tests) option;
wenzelm
parents: 2914
diff changeset
    81
      ;;
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    82
    \?)
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    83
      usage
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    84
      ;;
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    85
  esac
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    86
done
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    87
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    88
shift $(($OPTIND - 1))
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    89
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    90
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    91
# args
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    92
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    93
LOGICS="$@"
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    94
4457
wenzelm
parents: 3255
diff changeset
    95
[ -n "$ALL" ] && LOGICS="$LOGICS $ALL_LOGICS"
wenzelm
parents: 3255
diff changeset
    96
[ -z "$LOGICS" ] && LOGICS="$ISABELLE_LOGIC"
wenzelm
parents: 3255
diff changeset
    97
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    98
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    99
## main
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   100
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   101
# tell the user about current values
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   102
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   103
if [ -z "$BATCH" ]; then
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   104
  echo
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   105
  echo "                *****************************"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   106
  echo "                * Welcome to Isabelle build *"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   107
  echo "                *****************************"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   108
  echo
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   109
  echo "Please check $ISABELLE_HOME/etc/settings"
9789
wenzelm
parents: 7889
diff changeset
   110
  [ -f "$ISABELLE_HOME_USER/etc/settings" ] && echo "AND $ISABELLE_HOME_USER/etc/settings"
5386
wenzelm
parents: 4581
diff changeset
   111
  echo "to make sure that Isabelle's ML system settings and compilation options"
wenzelm
parents: 4581
diff changeset
   112
  echo "are appropriate."
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   113
  echo
5386
wenzelm
parents: 4581
diff changeset
   114
  echo "The current values are:"
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   115
  echo
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   116
  echo "  ML_SYSTEM=$ML_SYSTEM"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   117
  echo "  ML_HOME=$ML_HOME"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   118
  echo "  ML_OPTIONS=$ML_OPTIONS"
7277
bb9502f9154a improved messages;
wenzelm
parents: 6256
diff changeset
   119
  echo "  ML_PLATFORM=$ML_PLATFORM"
5386
wenzelm
parents: 4581
diff changeset
   120
  echo
wenzelm
parents: 4581
diff changeset
   121
  echo "  ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS"
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   122
fi
2789
69cf3aea45ee major tuning;
wenzelm
parents: 2781
diff changeset
   123
69cf3aea45ee major tuning;
wenzelm
parents: 2781
diff changeset
   124
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   125
# check logics
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
   126
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   127
if [ -z "$BATCH" ]; then
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   128
  echo
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   129
  echo
9817
wenzelm
parents: 9789
diff changeset
   130
  echo "Press RETURN to compilation of"
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   131
  echo
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   132
fi
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   133
4457
wenzelm
parents: 3255
diff changeset
   134
wenzelm
parents: 3255
diff changeset
   135
MAKE_LOGICS=""
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   136
4457
wenzelm
parents: 3255
diff changeset
   137
for L in $LOGICS
wenzelm
parents: 3255
diff changeset
   138
do
9789
wenzelm
parents: 7889
diff changeset
   139
  DIR="$ISABELLE_HOME/src/$L"
wenzelm
parents: 7889
diff changeset
   140
  if [ -f "$DIR/IsaMakefile" ]; then
4457
wenzelm
parents: 3255
diff changeset
   141
    MAKE_LOGICS="$MAKE_LOGICS $L"
wenzelm
parents: 3255
diff changeset
   142
  else
wenzelm
parents: 3255
diff changeset
   143
    echo "No such logic: $L"
wenzelm
parents: 3255
diff changeset
   144
  fi
wenzelm
parents: 3255
diff changeset
   145
done
wenzelm
parents: 3255
diff changeset
   146
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   147
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   148
if [ -z "$BATCH" ]; then
9789
wenzelm
parents: 7889
diff changeset
   149
  echo " $MAKE_LOGICS"
9817
wenzelm
parents: 9789
diff changeset
   150
  [ -n "$TARGETS" ] && echo "  (targets:$TARGETS)"
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   151
  echo
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   152
  read
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   153
else
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   154
  echo
9789
wenzelm
parents: 7889
diff changeset
   155
  echo "Isabelle build: $MAKE_LOGICS"
9817
wenzelm
parents: 9789
diff changeset
   156
  [ -n "$TARGETS" ] && echo "(targets:$TARGETS)"
2914
01d24f98528f improved messages;
wenzelm
parents: 2902
diff changeset
   157
  echo
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   158
  echo "ML_SYSTEM=$ML_SYSTEM"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   159
  echo "ML_HOME=$ML_HOME"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   160
  echo "ML_OPTIONS=$ML_OPTIONS"
7311
1ef2c659023d echo ML_PLATFORM;
wenzelm
parents: 7277
diff changeset
   161
  echo "ML_PLATFORM=$ML_PLATFORM"
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   162
  echo
5393
7299e531d481 fixed ISABELLE_USEDIR_OPTIONS;
wenzelm
parents: 5386
diff changeset
   163
  echo "ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS"
7299e531d481 fixed ISABELLE_USEDIR_OPTIONS;
wenzelm
parents: 5386
diff changeset
   164
  echo
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   165
fi
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
   166
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
   167
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   168
# build it
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   169
10511
wenzelm
parents: 9817
diff changeset
   170
echo "Started at $(date) ($ML_IDENTIFIER on $(hostname))"
18321
3414557c2dda replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents: 17649
diff changeset
   171
. "$ISABELLE_HOME/lib/scripts/timestart.bash"
2914
01d24f98528f improved messages;
wenzelm
parents: 2902
diff changeset
   172
4457
wenzelm
parents: 3255
diff changeset
   173
for L in $MAKE_LOGICS
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
   174
do
28500
4b79e5d3d0aa replaced ISATOOL by ISABELLE_TOOL;
wenzelm
parents: 26211
diff changeset
   175
  ( cd "$ISABELLE_HOME/src/$L"; "$ISABELLE_TOOL" make $TARGETS )
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
   176
done
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   177
2914
01d24f98528f improved messages;
wenzelm
parents: 2902
diff changeset
   178
echo -n "Finished at "; date
4457
wenzelm
parents: 3255
diff changeset
   179
18321
3414557c2dda replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents: 17649
diff changeset
   180
. "$ISABELLE_HOME/lib/scripts/timestop.bash"
3414557c2dda replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents: 17649
diff changeset
   181
echo "$TIMES_REPORT"