Admin/lib/Tools/makedist
author wenzelm
Mon, 22 May 2017 00:23:25 +0200
changeset 65897 94b0da1b242e
parent 64404 d75397e0aad5
child 66242 a912f4a701bf
permissions -rwxr-xr-x
back to scala-2.11.8 due to apparent non-termination of HOL-Codegenerator_Test;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
     2
#
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
     3
# Author: Makarius
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
     4
#
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
     5
# DESCRIPTION: make Isabelle distribution from repository
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
     6
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
     7
## global parameters
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
     8
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
     9
umask 022
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    10
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    11
HG="${HG:-hg}"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    12
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    13
DISTPREFIX="${DISTPREFIX:-$HOME/tmp/isadist}"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    14
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    15
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    16
## diagnostics
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    17
30885
a3cfe0e27deb misc tuning and updates;
wenzelm
parents: 30884
diff changeset
    18
PRG="$(basename "$0")"
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    19
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    20
function usage()
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    21
{
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    22
  echo
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    23
  echo "Usage: isabelle $PRG [OPTIONS] [VERSION]"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    24
  echo
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    25
  echo "  Options are:"
57649
a43898f76ae9 further distinction of Isabelle distribution: alert for identified release candidates;
wenzelm
parents: 53913
diff changeset
    26
  echo "    -O           official release (not release-candidate)"
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    27
  echo "    -d DIR       global directory prefix (default: \"$DISTPREFIX\")"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    28
  echo "    -j INT       maximum number of parallel jobs (default 1)"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    29
  echo "    -r RELEASE   proper release with name"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    30
  echo
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    31
  echo "  Make Isabelle distribution from the local repository clone."
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    32
  echo
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    33
  echo "  VERSION identifies the snapshot, using usual Mercurial terminology;"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    34
  echo "  the default is RELEASE if given, otherwise \"tip\"."
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    35
  echo
50789
wenzelm
parents: 49007
diff changeset
    36
  echo "  Add-on components are that of the running Isabelle version!"
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    37
  echo
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    38
  exit 1
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    39
}
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    40
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    41
function fail()
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    42
{
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    43
  echo "$1" >&2
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    44
  exit 2
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    45
}
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    46
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    47
function check_number()
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    48
{
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    49
  [ -n "$1" -a -z "$(echo "$1" | tr -d '[0-9]')" ] || fail "Bad number: \"$1\""
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    50
}
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    51
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    52
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    53
## process command line
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    54
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    55
# options
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    56
57649
a43898f76ae9 further distinction of Isabelle distribution: alert for identified release candidates;
wenzelm
parents: 53913
diff changeset
    57
OFFICIAL_RELEASE="false"
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    58
JOBS=""
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    59
RELEASE=""
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    60
57685
34ec8a580917 proper option -O;
wenzelm
parents: 57652
diff changeset
    61
while getopts "Od:j:r:" OPT
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    62
do
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    63
  case "$OPT" in
57649
a43898f76ae9 further distinction of Isabelle distribution: alert for identified release candidates;
wenzelm
parents: 53913
diff changeset
    64
    O)
a43898f76ae9 further distinction of Isabelle distribution: alert for identified release candidates;
wenzelm
parents: 53913
diff changeset
    65
      OFFICIAL_RELEASE="true"
a43898f76ae9 further distinction of Isabelle distribution: alert for identified release candidates;
wenzelm
parents: 53913
diff changeset
    66
      ;;
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    67
    d)
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    68
      DISTPREFIX="$OPTARG"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    69
      ;;
43357
07889e32bc58 makedist -j: build Isabelle/jEdit via given jedit_build component;
wenzelm
parents: 41984
diff changeset
    70
    j)
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    71
      check_number "$OPTARG"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    72
      JOBS="-j $OPTARG"
43357
07889e32bc58 makedist -j: build Isabelle/jEdit via given jedit_build component;
wenzelm
parents: 41984
diff changeset
    73
      ;;
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    74
    r)
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    75
      RELEASE="$OPTARG"
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    76
      ;;
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    77
    \?)
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    78
      usage
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    79
      ;;
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    80
  esac
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    81
done
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    82
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    83
shift $(($OPTIND - 1))
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    84
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    85
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    86
# args
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    87
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    88
VERSION=""
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    89
[ "$#" -gt 0 ] && { VERSION="$1"; shift; }
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    90
[ -z "$VERSION" ] && VERSION="$RELEASE"
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    91
[ -z "$VERSION" ] && VERSION="tip"
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    92
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    93
[ "$#" -gt 0 ] && usage
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    94
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    95
IDENT=$("$HG" --repository "$ISABELLE_HOME" id -r "$VERSION" -i)
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    96
[ -z "$IDENT" ] && fail "Bad repository version: \"$VERSION\""
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    97
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
    98
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
    99
## main
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   100
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   101
# dist name
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   102
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   103
DATE=$(env LC_ALL=C date "+%d-%b-%Y")
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   104
DISTDATE=$(env LC_ALL=C date "+%B %Y")
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   105
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   106
if [ -z "$RELEASE" ]; then
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   107
  DISTNAME="Isabelle_$DATE"
40573
113ccf02d323 less parentheses, cf. Session.welcome;
wenzelm
parents: 37485
diff changeset
   108
  DISTVERSION="Isabelle repository snapshot $IDENT $DATE"
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   109
else
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   110
  DISTNAME="$RELEASE"
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   111
  DISTVERSION="$DISTNAME: $DISTDATE"
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   112
fi
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   113
51073
a25b899a649d allow relative directory;
wenzelm
parents: 50899
diff changeset
   114
DISTPREFIX="$(cd "$DISTPREFIX"; pwd)"
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   115
DISTBASE="$DISTPREFIX/dist-$DISTNAME"
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   116
mkdir -p "$DISTBASE" || fail "Unable to create distribution base dir \"$DISTBASE\""
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   117
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   118
DIR="$DISTBASE/$DISTNAME"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   119
[ -e "$DIR" ] && fail "Directory \"$DIR\" already exists"
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   120
64221
407f69c4959f identify release;
wenzelm
parents: 64183
diff changeset
   121
rm -f "$DISTPREFIX/ISABELLE_DIST" "$DISTPREFIX/ISABELLE_IDENT"
407f69c4959f identify release;
wenzelm
parents: 64183
diff changeset
   122
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   123
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   124
# retrieve repository archive
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   125
64404
wenzelm
parents: 64373
diff changeset
   126
echo "### Retrieving Mercurial repository version $VERSION"
47010
ceba98191816 more ambitious scalac options for makedist;
wenzelm
parents: 46930
diff changeset
   127
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   128
"$HG" --repository "$ISABELLE_HOME" archive --type files -r "$IDENT" "$DIR" || \
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   129
  fail "Failed to retrieve $VERSION"
43357
07889e32bc58 makedist -j: build Isabelle/jEdit via given jedit_build component;
wenzelm
parents: 41984
diff changeset
   130
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   131
rm -f "$DIR/.hg_archival.txt"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   132
rm -f "$DIR/.hgtags"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   133
rm -f "$DIR/.hgignore"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   134
rm -f "$DIR/README_REPOSITORY"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   135
43357
07889e32bc58 makedist -j: build Isabelle/jEdit via given jedit_build component;
wenzelm
parents: 41984
diff changeset
   136
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   137
# partial context switch to new version
48606
4b6c90e121b1 makedist -D retains doc-src component with its "doc" sessions (relevant for testing);
wenzelm
parents: 48190
diff changeset
   138
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   139
cd "$DIR"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   140
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   141
unset ISABELLE_SETTINGS_PRESENT
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   142
unset ISABELLE_SITE_SETTINGS_PRESENT
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   143
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   144
if [ -z "$RELEASE" ]; then
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   145
  {
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   146
    echo
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   147
    echo "IMPORTANT NOTE"
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   148
    echo "=============="
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   149
    echo
53436
wenzelm
parents: 53208
diff changeset
   150
    echo "This is a snapshot of Isabelle/${IDENT} from the repository."
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   151
    echo
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   152
  } >ANNOUNCE
57649
a43898f76ae9 further distinction of Isabelle distribution: alert for identified release candidates;
wenzelm
parents: 53913
diff changeset
   153
fi
a43898f76ae9 further distinction of Isabelle distribution: alert for identified release candidates;
wenzelm
parents: 53913
diff changeset
   154
a43898f76ae9 further distinction of Isabelle distribution: alert for identified release candidates;
wenzelm
parents: 53913
diff changeset
   155
if [ -n "$RELEASE" -a "$OFFICIAL_RELEASE" = true ]; then
a43898f76ae9 further distinction of Isabelle distribution: alert for identified release candidates;
wenzelm
parents: 53913
diff changeset
   156
  IS_OFFICIAL="true"
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   157
else
57649
a43898f76ae9 further distinction of Isabelle distribution: alert for identified release candidates;
wenzelm
parents: 53913
diff changeset
   158
  IS_OFFICIAL="false"
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   159
fi
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   160
57649
a43898f76ae9 further distinction of Isabelle distribution: alert for identified release candidates;
wenzelm
parents: 53913
diff changeset
   161
perl -pi \
57652
e7fe592ee089 proper perl;
wenzelm
parents: 57649
diff changeset
   162
  -e "s,val is_identified = false,val is_identified = true,g;" \
e7fe592ee089 proper perl;
wenzelm
parents: 57649
diff changeset
   163
  -e "s,val is_official = false,val is_official = ${IS_OFFICIAL},g;" \
62845
31177a9c3025 clarified modules;
wenzelm
parents: 62171
diff changeset
   164
  src/Pure/System/distribution.ML src/Pure/System/distribution.scala
57649
a43898f76ae9 further distinction of Isabelle distribution: alert for identified release candidates;
wenzelm
parents: 53913
diff changeset
   165
41511
2fe62d602681 isabelle version -i;
wenzelm
parents: 40713
diff changeset
   166
perl -pi -e "s,ISABELLE_ID=\"\",ISABELLE_ID=\"$IDENT\",g" lib/scripts/getsettings
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   167
perl -pi -e "s,ISABELLE_IDENTIFIER=\"\",ISABELLE_IDENTIFIER=\"$DISTNAME\",g" lib/scripts/getsettings
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   168
perl -pi -e "s,{ISABELLE},$DISTNAME,g" lib/html/library_index_header.template
62845
31177a9c3025 clarified modules;
wenzelm
parents: 62171
diff changeset
   169
perl -pi -e "s,unidentified repository version,$DISTVERSION,g" \
31177a9c3025 clarified modules;
wenzelm
parents: 62171
diff changeset
   170
  src/Pure/System/distribution.ML src/Pure/System/distribution.scala lib/Tools/version
32361
141e5151b918 clarified situation about unidentified repository versions -- in a distributed setting there is not "the" repository;
wenzelm
parents: 31842
diff changeset
   171
perl -pi -e "s,some unidentified repository version of Isabelle,$DISTVERSION,g" README
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   172
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   173
mkdir -p contrib
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   174
cat >contrib/README <<EOF
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   175
This directory contains add-on components that contribute to the main
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   176
Isabelle distribution.  Separate licensing conditions apply, see each
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   177
directory individually.
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   178
EOF
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   179
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   180
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   181
# prepare dist for release
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   182
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   183
echo "### Preparing distribution $DISTNAME"
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   184
63058
8804faa80bc9 more portable: GNU find no longer supports "-perm +mode";
wenzelm
parents: 62845
diff changeset
   185
find . "(" -name \*.thy -o -name \*.ML -o -name \*.scala ")" -print | xargs chmod -f -x
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   186
find . -print | xargs chmod -f u+rw
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   187
53579
602dc7e63757 propagate ISABELLE_CLASSPATH;
wenzelm
parents: 53436
diff changeset
   188
export CLASSPATH="$ISABELLE_CLASSPATH"
602dc7e63757 propagate ISABELLE_CLASSPATH;
wenzelm
parents: 53436
diff changeset
   189
57692
65dc798bb1fb no -optimise -- produces bad bytecode;
wenzelm
parents: 57685
diff changeset
   190
./Admin/build all || fail "Failed to build distribution"
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   191
57692
65dc798bb1fb no -optimise -- produces bad bytecode;
wenzelm
parents: 57685
diff changeset
   192
./bin/isabelle jedit -b || fail "Failed to build Isabelle/jEdit"
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   193
50797
6b45a1568637 unconditional jedit_build;
wenzelm
parents: 50789
diff changeset
   194
cp -a src src.orig
6b45a1568637 unconditional jedit_build;
wenzelm
parents: 50789
diff changeset
   195
env ISABELLE_IDENTIFIER="${DISTNAME}-build" \
53208
bec95e287d26 prefer build_doc -s to avoid heaps left behind in $ISABELLE_HOME_USER (especially relevant to isatest);
wenzelm
parents: 51073
diff changeset
   196
  ./bin/isabelle build_doc $JOBS -s -a || fail "Failed to build documentation"
50797
6b45a1568637 unconditional jedit_build;
wenzelm
parents: 50789
diff changeset
   197
rm -rf src
6b45a1568637 unconditional jedit_build;
wenzelm
parents: 50789
diff changeset
   198
mv src.orig src
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   199
64373
5a3e35cb6f54 retain Admin component for isabelle tool invocation;
wenzelm
parents: 64369
diff changeset
   200
./bin/isabelle news
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   201
64373
5a3e35cb6f54 retain Admin component for isabelle tool invocation;
wenzelm
parents: 64369
diff changeset
   202
rm -rf Admin browser_info heaps
62114
a7cf464933f7 generate HTML version of NEWS, with proper symbol rendering;
wenzelm
parents: 61737
diff changeset
   203
64183
c69a77e0124a more cleanup;
wenzelm
parents: 63897
diff changeset
   204
rmdir "$USER_HOME/.isabelle/${DISTNAME}-build"
c69a77e0124a more cleanup;
wenzelm
parents: 63897
diff changeset
   205
rmdir "$USER_HOME/.isabelle/${DISTNAME}"
c69a77e0124a more cleanup;
wenzelm
parents: 63897
diff changeset
   206
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   207
37341
wenzelm
parents: 37217
diff changeset
   208
# create archive
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   209
63897
85c83757788c consolidate implicit use of gnutar, via somewhat fragile dynamic scoping within existing shell scripts;
wenzelm
parents: 63058
diff changeset
   210
#GNU tar (notably on Mac OS X)
85c83757788c consolidate implicit use of gnutar, via somewhat fragile dynamic scoping within existing shell scripts;
wenzelm
parents: 63058
diff changeset
   211
type -p gnutar >/dev/null && function tar() { gnutar "$@"; }
85c83757788c consolidate implicit use of gnutar, via somewhat fragile dynamic scoping within existing shell scripts;
wenzelm
parents: 63058
diff changeset
   212
49004
3a324a3f4aea more formal isabelle makedist from repository;
wenzelm
parents: 48998
diff changeset
   213
echo "### Creating archive"
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   214
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   215
cd "$DISTBASE"
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   216
64221
407f69c4959f identify release;
wenzelm
parents: 64183
diff changeset
   217
echo "$DISTBASE/$DISTNAME.tar.gz" > "$DISTPREFIX/ISABELLE_DIST"
407f69c4959f identify release;
wenzelm
parents: 64183
diff changeset
   218
echo "$IDENT" > "$DISTPREFIX/ISABELLE_IDENT"
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   219
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   220
chown -R "$LOGNAME" "$DISTNAME"
61737
b91b1ebfc8a0 bundle main sources read-only, to avoid accidental editing of imported theories etc.;
wenzelm
parents: 57692
diff changeset
   221
chmod -R g=o "$DISTNAME"
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   222
chmod -R u+w "$DISTNAME"
61737
b91b1ebfc8a0 bundle main sources read-only, to avoid accidental editing of imported theories etc.;
wenzelm
parents: 57692
diff changeset
   223
find "$DISTNAME" -type f "(" -name '*.scala' -o -name '*.ML' -o -name '*.thy' ")" -print | xargs chmod -f u-w
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   224
49007
f781bbe0d91b tuned message;
wenzelm
parents: 49004
diff changeset
   225
echo "$DISTBASE/$DISTNAME.tar.gz"
53913
5ff12177a067 prefer GNU tar for Isabelle to avoid odd extended header keywords produced by Apple's bsdtar (see also 8f6046b7f850);
wenzelm
parents: 53579
diff changeset
   226
tar -c -z -f "$DISTNAME.tar.gz" "$DISTNAME"
50899
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents: 50863
diff changeset
   227
[ "$?" = 0 ] || exit "$?"
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   228
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   229
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   230
# cleanup dist
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   231
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   232
mv "$DISTNAME" "${DISTNAME}-old"
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   233
mkdir "$DISTNAME"
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   234
37368
1c816f2abb0e removed outdated/confusing INSTALL file;
wenzelm
parents: 37356
diff changeset
   235
mv "${DISTNAME}-old/README" "${DISTNAME}-old/NEWS" "${DISTNAME}-old/ANNOUNCE" \
1c816f2abb0e removed outdated/confusing INSTALL file;
wenzelm
parents: 37356
diff changeset
   236
  "${DISTNAME}-old/COPYRIGHT" "${DISTNAME}-old/CONTRIBUTORS" "$DISTNAME"
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   237
mkdir "$DISTNAME/doc"
62167
cb806a024bba more doc content;
wenzelm
parents: 62114
diff changeset
   238
mv "${DISTNAME}-old/doc/"*.pdf \
cb806a024bba more doc content;
wenzelm
parents: 62114
diff changeset
   239
  "${DISTNAME}-old/doc/"*.html \
62171
46f0dfedf9ef more doc content;
wenzelm
parents: 62167
diff changeset
   240
  "${DISTNAME}-old/doc/"*.css \
62167
cb806a024bba more doc content;
wenzelm
parents: 62114
diff changeset
   241
  "${DISTNAME}-old/doc/"*.ttf \
cb806a024bba more doc content;
wenzelm
parents: 62114
diff changeset
   242
  "${DISTNAME}-old/doc/Contents" "$DISTNAME/doc"
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   243
41984
e5dba3d75e9e recover Isabelle symlink for public distribution, notably website;
wenzelm
parents: 41665
diff changeset
   244
rm -f Isabelle && ln -sf "$DISTNAME" Isabelle
e5dba3d75e9e recover Isabelle symlink for public distribution, notably website;
wenzelm
parents: 41665
diff changeset
   245
28932
ccaa3355f7d3 makedist -- make Isabelle source distribution (Mercurial version);
wenzelm
parents:
diff changeset
   246
rm -rf "${DISTNAME}-old"