Admin/makedist
author wenzelm
Wed Sep 21 14:03:30 2005 +0200 (2005-09-21)
changeset 17558 de236aeb867c
parent 17554 d16abc8f4fb0
child 17560 b4b885858036
permissions -rwxr-xr-x
tuned;
wenzelm@12721
     1
#!/usr/bin/env bash
wenzelm@2667
     2
#
wenzelm@2667
     3
# $Id$
wenzelm@2667
     4
#
wenzelm@10077
     5
# makedist -- make Isabelle source distribution.
wenzelm@2667
     6
wenzelm@2667
     7
wenzelm@2667
     8
## global settings
wenzelm@2667
     9
wenzelm@17554
    10
DISTPREFIX=${DISTPREFIX:-~/tmp/isadist}
wenzelm@7993
    11
LOGICS="CCL CTT Cube FOL FOLP HOL HOLCF LCF Provers Pure Sequents TFL ZF"
wenzelm@2667
    12
wenzelm@17554
    13
export CVSROOT=/usr/proj/isabelle-repository/archive
wenzelm@17554
    14
[ ! -d "$CVSROOT" ] && CVSROOT="sunbroy2.informatik.tu-muenchen.de:$CVSROOT"
wenzelm@2667
    15
wenzelm@9797
    16
umask 022
wenzelm@9797
    17
wenzelm@9920
    18
TAR=tar
wenzelm@9920
    19
type -path gtar >/dev/null && TAR=gtar
wenzelm@9920
    20
wenzelm@9920
    21
FIND=find
wenzelm@9920
    22
type -path gfind >/dev/null && FIND=gfind
wenzelm@9920
    23
wenzelm@2667
    24
wenzelm@2667
    25
## diagnostics
wenzelm@2667
    26
wenzelm@9797
    27
PRG=$(basename "$0")
wenzelm@9797
    28
THIS=$(cd $(dirname "$0"); echo "$PWD")
wenzelm@2667
    29
wenzelm@2667
    30
function usage()
wenzelm@2667
    31
{
wenzelm@2667
    32
  cat <<EOF
wenzelm@11062
    33
wenzelm@17554
    34
Usage: $PRG VERSION [NAME]
wenzelm@11062
    35
wenzelm@2667
    36
  Make Isabelle distribution from the master sources at TUM.
wenzelm@2667
    37
wenzelm@17554
    38
  VERSION may be either a tag like "Isabelle2005" that specifies the
wenzelm@2667
    39
  release to be exported from the repository, or "-" to checkout the
wenzelm@17554
    40
  current sources as an unofficial release.
wenzelm@17554
    41
wenzelm@17554
    42
  NAME specifies an explicit distribution name, by default it is
wenzelm@17554
    43
  derived from VERSION.
wenzelm@2667
    44
wenzelm@2667
    45
  Checklist for official releases (before running this script):
wenzelm@2667
    46
wenzelm@17554
    47
    * Check Admin/website contents.
wenzelm@17554
    48
    * Check ANNOUNCE, README.html, INSTALL, NEWS, COPYRIGHT, CONTRIBUTORS.
wenzelm@11062
    49
    * Try "isatool makeall all" with Poly/ML, SML/NJ, etc.
wenzelm@2667
    50
    * Tag the current repository version, e.g.:
wenzelm@17554
    51
        cvs -d /usr/proj/isabelle-repository/archive rtag Isabelle2005 isabelle
wenzelm@11062
    52
      PLEASE DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING!
wenzelm@5727
    53
wenzelm@2667
    54
EOF
wenzelm@2667
    55
  exit 1
wenzelm@2667
    56
}
wenzelm@2667
    57
wenzelm@2667
    58
function fail()
wenzelm@2667
    59
{
wenzelm@2667
    60
  echo "$1" >&2
wenzelm@2667
    61
  exit 2
wenzelm@2667
    62
}
wenzelm@2667
    63
wenzelm@2667
    64
wenzelm@2667
    65
## process command line
wenzelm@2667
    66
wenzelm@17554
    67
[ "$#" -ne 1 -a "$#" -ne 2 ] && usage
wenzelm@17554
    68
wenzelm@17554
    69
VERSION="$1"; shift
wenzelm@2667
    70
wenzelm@17554
    71
if [ "$#" -eq 0 ]; then
wenzelm@17554
    72
  DISTNAME=""
wenzelm@17554
    73
else
wenzelm@17554
    74
  DISTNAME="$1"; shift
wenzelm@17554
    75
fi
wenzelm@2667
    76
wenzelm@2667
    77
wenzelm@2667
    78
## main
wenzelm@2667
    79
wenzelm@2667
    80
# dist version
wenzelm@2667
    81
wenzelm@2667
    82
DATE=$(date "+%d-%b-%Y")
wenzelm@4979
    83
DISTDATE=$(date "+%B %Y")
wenzelm@2667
    84
wenzelm@17554
    85
if [ "$VERSION" = "-" ]; then
wenzelm@17554
    86
  DISTIDENT="Isabelle_$DATE"
wenzelm@17554
    87
  [ -z "$DISTNAME" ] && DISTNAME="$DISTIDENT"
wenzelm@9797
    88
  DISTVERSION="$DISTNAME"
wenzelm@9797
    89
  EXPORT="cvs -f -q checkout -P -d $DISTNAME isabelle"
wenzelm@17558
    90
  UNOFFICIAL=true
wenzelm@2667
    91
else
wenzelm@17554
    92
  DISTIDENT="$VERSION"
wenzelm@17554
    93
  [ -z "$DISTNAME" ] && DISTNAME="$DISTIDENT"
wenzelm@4982
    94
  DISTVERSION="$DISTNAME: $DISTDATE"
wenzelm@17554
    95
  EXPORT="cvs -f -q export -P -r $VERSION -d $DISTNAME isabelle"
wenzelm@2667
    96
  UNOFFICIAL=""
wenzelm@2667
    97
fi
wenzelm@2667
    98
wenzelm@9797
    99
DISTBASE="$DISTPREFIX/dist-$DISTNAME"
wenzelm@9797
   100
mkdir -p "$DISTBASE" || fail "Unable to create distribution base dir $DISTBASE!"
wenzelm@9797
   101
[ -e "$DISTBASE/$DISTNAME" ] && fail "$DISTBASE/$DISTNAME already exists!"
wenzelm@9797
   102
[ -e "$DISTBASE/pdf/$DISTNAME" ] && fail "$DISTBASE/pdf/$DISTNAME already exists!"
wenzelm@2667
   103
wenzelm@2667
   104
wenzelm@9797
   105
# export repository
wenzelm@2667
   106
wenzelm@9797
   107
echo "###"
wenzelm@17554
   108
echo "### Exporting $DISTIDENT ..."
wenzelm@9797
   109
echo "###"
wenzelm@2667
   110
wenzelm@9797
   111
cd "$DISTBASE"
wenzelm@2667
   112
kleing@13230
   113
$EXPORT || fail "Export failed!"
berghofe@15438
   114
berghofe@15438
   115
if [ -n "$CVS2CL" ]; then
berghofe@15438
   116
  cd $DISTNAME
berghofe@15438
   117
  $CVS2CL
berghofe@15438
   118
  gzip ChangeLog
berghofe@15438
   119
  mv ChangeLog.gz ..
berghofe@15438
   120
  cd ..
berghofe@15438
   121
fi
berghofe@15438
   122
wenzelm@9920
   123
$FIND . -name CVS -print | xargs rm -rf
wenzelm@12986
   124
$FIND . -name .cvsignore -print | xargs rm -rf
wenzelm@17554
   125
$FIND . "(" -name \*.thy -o -name \*.ML ")" -perm +111 -print | xargs chmod -x
wenzelm@2667
   126
wenzelm@2667
   127
wenzelm@9797
   128
# build docs
wenzelm@2667
   129
wenzelm@9797
   130
echo "###"
wenzelm@9797
   131
echo "### Building docs ..."
wenzelm@9797
   132
echo "###"
wenzelm@9797
   133
wenzelm@9797
   134
cd "$DISTBASE/$DISTNAME/Doc"
wenzelm@6630
   135
PDFLATEX=$(type -path pdflatex)
wenzelm@3169
   136
wenzelm@3169
   137
for DOC in $(cat Contents)
wenzelm@2667
   138
do
wenzelm@9797
   139
  cd "$DOC"
kleing@13230
   140
  make dvi || fail "DVI document for $DOC failed!"
wenzelm@17554
   141
  { [ -n "$PDFLATEX" ] && make clean pdf; } || fail "PDF document for $DOC failed!"
wenzelm@3169
   142
  cd ..
wenzelm@2667
   143
done
wenzelm@2667
   144
wenzelm@9052
   145
wenzelm@9920
   146
# prepare dist dir for release
kleing@8059
   147
wenzelm@9920
   148
echo "###"
wenzelm@9920
   149
echo "### Preparing distribution ..."
wenzelm@9920
   150
echo "###"
wenzelm@2667
   151
wenzelm@17554
   152
cd "$DISTBASE/$DISTNAME" || fail "No dist directory: $DISTBASE/$DISTNAME"
wenzelm@2667
   153
haftmann@16301
   154
cp -R Admin/website ..
haftmann@16301
   155
mkdir -p ../website/conf
haftmann@16301
   156
cat > ../website/conf/distname.mak <<EOF
wenzelm@17554
   157
# this is a generated file - do not edit!
haftmann@16301
   158
haftmann@16301
   159
DISTNAME=$DISTNAME
wenzelm@17554
   160
DISTIDENT=$DISTIDENT
haftmann@16301
   161
EOF
wenzelm@9920
   162
wenzelm@16481
   163
MOVE=$($FIND Doc \( -type f -a -not -type l -a -not -name pghead.pdf -a \( -name \*.dvi -o -name \*.eps -o -name \*.ps -o -name \*.pdf \) -a -print \) | grep -v 'gfx/.*pdf')
wenzelm@6630
   164
mv -f $MOVE Distribution/doc
wenzelm@3305
   165
rm Distribution/doc/Isa-logics.eps
wenzelm@9052
   166
rm -rf Doc Tools
wenzelm@2667
   167
wenzelm@7115
   168
mkdir src contrib
wenzelm@2667
   169
mv $LOGICS src
wenzelm@2667
   170
wenzelm@2667
   171
mv Distribution/* .
wenzelm@2667
   172
rmdir Distribution
wenzelm@2667
   173
kleing@13230
   174
( cd lib/browser; make; ) || fail "Graph browser build failed!"
berghofe@3638
   175
wenzelm@5385
   176
cp doc/isabelle*.eps lib/logo
wenzelm@5385
   177
berghofe@3638
   178
wenzelm@2667
   179
if [ -n "$UNOFFICIAL" ]; then
wenzelm@2667
   180
  {
wenzelm@2667
   181
    echo
wenzelm@2667
   182
    echo "IMPORTANT NOTE"
wenzelm@2667
   183
    echo "=============="
wenzelm@2667
   184
    echo
wenzelm@17554
   185
    echo "This is an unofficial release of Isabelle, created by $LOGNAME $DATE."
wenzelm@2667
   186
    echo
wenzelm@9925
   187
  } >ANNOUNCE
wenzelm@2667
   188
fi
wenzelm@2667
   189
wenzelm@8810
   190
perl -pi -e "s/{ISABELLE}/$DISTNAME/g;" lib/html/index.html
wenzelm@17554
   191
perl -pi -e "s/Isabelle repository version/$DISTVERSION/" src/Pure/ROOT.ML lib/Tools/version
wenzelm@4986
   192
perl -pi -e "s/the internal repository version of Isabelle/$DISTVERSION/" README.html
wenzelm@3257
   193
lynx -dump README.html >README
wenzelm@3257
   194
wenzelm@9052
   195
( cd src; ../Admin/maketags; )
wenzelm@10077
   196
wenzelm@9052
   197
rm -rf Admin
wenzelm@16286
   198
rm -f TODO
wenzelm@9052
   199
wenzelm@2667
   200
wenzelm@2667
   201
# create archive
wenzelm@2667
   202
wenzelm@9797
   203
echo "###"
wenzelm@9797
   204
echo "### Creating archives ..."
wenzelm@9797
   205
echo "###"
wenzelm@2667
   206
wenzelm@9797
   207
cd "$DISTBASE"
wenzelm@9797
   208
wenzelm@10087
   209
echo "$DISTBASE/$DISTNAME.tar.gz" > ../ISABELLE_DIST
wenzelm@10087
   210
wenzelm@10068
   211
rm -f Isabelle
wenzelm@10068
   212
ln -s "$DISTNAME" Isabelle
wenzelm@10068
   213
wenzelm@9797
   214
chown -R "$LOGNAME" "$DISTNAME"
wenzelm@9797
   215
chmod -R u+w "$DISTNAME"
wenzelm@9797
   216
chmod -R g=o "$DISTNAME"
wenzelm@10077
   217
chgrp -R isabelle "$DISTNAME" Isabelle
wenzelm@2667
   218
wenzelm@9797
   219
mkdir -p "pdf/$DISTNAME/doc"
wenzelm@9797
   220
mv "$DISTNAME/doc/"*.pdf "pdf/$DISTNAME/doc"
wenzelm@6748
   221
haftmann@16508
   222
#~ page/bin/mkcontents "$DISTNAME/doc/Contents" "pdf/$DISTNAME/doc/index"
haftmann@16508
   223
#~ cat > "pdf/$DISTNAME/doc/index.html" <<EOF
haftmann@16508
   224
#~ <html>
haftmann@16508
   225
#~ <head>
haftmann@16508
   226
#~ <title>$DISTNAME Documentation</title>
haftmann@16508
   227
#~ </head>
haftmann@16508
   228
#~ <body>
haftmann@16508
   229
#~ <h1>$DISTNAME Documentation</h1>
haftmann@16508
   230
#~ $(cat "pdf/$DISTNAME/doc/index")
haftmann@16508
   231
#~ </body>
haftmann@16508
   232
#~ </html>
haftmann@16508
   233
#~ EOF
haftmann@16508
   234
#~ rm "pdf/$DISTNAME/doc/index"
wenzelm@10928
   235
wenzelm@10096
   236
echo "$DISTNAME.tar.gz"
wenzelm@10077
   237
"$TAR" cf "$DISTNAME.tar" Isabelle "$DISTNAME"
wenzelm@10096
   238
gzip "$DISTNAME.tar"
wenzelm@10096
   239
wenzelm@10096
   240
echo "${DISTNAME}_pdf.tar.gz"
wenzelm@10112
   241
( cd pdf; "$TAR" cf "../${DISTNAME}_pdf.tar" "$DISTNAME"; )
wenzelm@10096
   242
gzip "${DISTNAME}_pdf.tar"
wenzelm@6748
   243
wenzelm@10928
   244
mv "pdf/$DISTNAME/doc/"*.pdf "pdf/$DISTNAME/doc/index.html" "$DISTNAME/doc"
wenzelm@9797
   245
rmdir "pdf/$DISTNAME/doc" "pdf/$DISTNAME" pdf
wenzelm@6750
   246
wenzelm@6304
   247
wenzelm@9782
   248
# cleanup dist
wenzelm@9782
   249
wenzelm@9797
   250
mv "$DISTNAME" "${DISTNAME}-old"
wenzelm@9797
   251
mkdir "$DISTNAME"
wenzelm@9782
   252
haftmann@16328
   253
mv "${DISTNAME}-old/README.html" "${DISTNAME}-old/INSTALL" "${DISTNAME}-old/NEWS" \
wenzelm@17554
   254
  "${DISTNAME}-old/ANNOUNCE" "${DISTNAME}-old/COPYRIGHT" "${DISTNAME}-old/CONTRIBUTORS" \
wenzelm@17554
   255
  "$DISTNAME"
wenzelm@9797
   256
mkdir "$DISTNAME/doc"
wenzelm@10928
   257
mv "${DISTNAME}-old/doc/"*.pdf "${DISTNAME}-old/doc/index.html" "$DISTNAME/doc"
wenzelm@9782
   258
wenzelm@9867
   259
chgrp -R isabelle "$DISTNAME"
wenzelm@9867
   260
wenzelm@9797
   261
rm -rf "${DISTNAME}-old"
wenzelm@9782
   262
wenzelm@9782
   263
wenzelm@2667
   264
# final note
wenzelm@2667
   265
wenzelm@9797
   266
echo "###"
wenzelm@10112
   267
echo "### Finished makedist."
wenzelm@9797
   268
echo "###"