Admin/makedist
author huffman
Mon May 14 09:27:24 2007 +0200 (2007-05-14)
changeset 22961 e499ded5d0fc
parent 21712 8b2fd895a7fc
child 23149 ddc5800b699f
permissions -rwxr-xr-x
remove redundant lemmas
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@18539
    14
[ ! -d "$CVSROOT" ] && CVSROOT="${ISABELLE_USER:-$USER}@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@17693
    38
  VERSION may be either a tag like "IsabelleXXXX" 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
haftmann@20990
    47
    * Symlink website to Admin/website
wenzelm@17554
    48
    * Check Admin/website contents.
wenzelm@17554
    49
    * Check ANNOUNCE, README.html, INSTALL, NEWS, COPYRIGHT, CONTRIBUTORS.
wenzelm@11062
    50
    * Try "isatool makeall all" with Poly/ML, SML/NJ, etc.
wenzelm@2667
    51
    * Tag the current repository version, e.g.:
wenzelm@17693
    52
        cvs -d /usr/proj/isabelle-repository/archive rtag IsabelleXXXX isabelle
wenzelm@11062
    53
      PLEASE DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING!
wenzelm@5727
    54
wenzelm@2667
    55
EOF
wenzelm@2667
    56
  exit 1
wenzelm@2667
    57
}
wenzelm@2667
    58
wenzelm@2667
    59
function fail()
wenzelm@2667
    60
{
wenzelm@2667
    61
  echo "$1" >&2
wenzelm@2667
    62
  exit 2
wenzelm@2667
    63
}
wenzelm@2667
    64
wenzelm@2667
    65
wenzelm@2667
    66
## process command line
wenzelm@2667
    67
wenzelm@17554
    68
[ "$#" -ne 1 -a "$#" -ne 2 ] && usage
wenzelm@17554
    69
wenzelm@17554
    70
VERSION="$1"; shift
wenzelm@2667
    71
wenzelm@17554
    72
if [ "$#" -eq 0 ]; then
wenzelm@17554
    73
  DISTNAME=""
wenzelm@17554
    74
else
wenzelm@17554
    75
  DISTNAME="$1"; shift
wenzelm@17554
    76
fi
wenzelm@2667
    77
wenzelm@2667
    78
wenzelm@2667
    79
## main
wenzelm@2667
    80
wenzelm@2667
    81
# dist version
wenzelm@2667
    82
wenzelm@21712
    83
DATE=$(env LC_ALL=C date "+%d-%b-%Y")
wenzelm@21712
    84
DISTDATE=$(env LC_ALL=C date "+%B %Y")
wenzelm@2667
    85
wenzelm@17554
    86
if [ "$VERSION" = "-" ]; then
wenzelm@17554
    87
  DISTIDENT="Isabelle_$DATE"
wenzelm@17554
    88
  [ -z "$DISTNAME" ] && DISTNAME="$DISTIDENT"
wenzelm@9797
    89
  DISTVERSION="$DISTNAME"
wenzelm@9797
    90
  EXPORT="cvs -f -q checkout -P -d $DISTNAME isabelle"
wenzelm@17558
    91
  UNOFFICIAL=true
wenzelm@2667
    92
else
wenzelm@17554
    93
  DISTIDENT="$VERSION"
wenzelm@17554
    94
  [ -z "$DISTNAME" ] && DISTNAME="$DISTIDENT"
wenzelm@4982
    95
  DISTVERSION="$DISTNAME: $DISTDATE"
wenzelm@17561
    96
  EXPORT="cvs -f -q export -r $VERSION -d $DISTNAME isabelle"
wenzelm@2667
    97
  UNOFFICIAL=""
wenzelm@2667
    98
fi
wenzelm@2667
    99
wenzelm@9797
   100
DISTBASE="$DISTPREFIX/dist-$DISTNAME"
wenzelm@9797
   101
mkdir -p "$DISTBASE" || fail "Unable to create distribution base dir $DISTBASE!"
wenzelm@9797
   102
[ -e "$DISTBASE/$DISTNAME" ] && fail "$DISTBASE/$DISTNAME already exists!"
wenzelm@9797
   103
[ -e "$DISTBASE/pdf/$DISTNAME" ] && fail "$DISTBASE/pdf/$DISTNAME already exists!"
wenzelm@2667
   104
wenzelm@2667
   105
wenzelm@9797
   106
# export repository
wenzelm@2667
   107
wenzelm@9797
   108
echo "###"
wenzelm@17554
   109
echo "### Exporting $DISTIDENT ..."
wenzelm@9797
   110
echo "###"
wenzelm@2667
   111
wenzelm@9797
   112
cd "$DISTBASE"
wenzelm@2667
   113
kleing@13230
   114
$EXPORT || fail "Export failed!"
berghofe@15438
   115
berghofe@15438
   116
if [ -n "$CVS2CL" ]; then
berghofe@15438
   117
  cd $DISTNAME
berghofe@15438
   118
  $CVS2CL
berghofe@15438
   119
  gzip ChangeLog
berghofe@15438
   120
  mv ChangeLog.gz ..
berghofe@15438
   121
  cd ..
berghofe@15438
   122
fi
berghofe@15438
   123
wenzelm@9920
   124
$FIND . -name CVS -print | xargs rm -rf
wenzelm@12986
   125
$FIND . -name .cvsignore -print | xargs rm -rf
wenzelm@17554
   126
$FIND . "(" -name \*.thy -o -name \*.ML ")" -perm +111 -print | xargs chmod -x
wenzelm@2667
   127
wenzelm@2667
   128
wenzelm@9797
   129
# build docs
wenzelm@2667
   130
wenzelm@9797
   131
echo "###"
wenzelm@9797
   132
echo "### Building docs ..."
wenzelm@9797
   133
echo "###"
wenzelm@9797
   134
wenzelm@9797
   135
cd "$DISTBASE/$DISTNAME/Doc"
wenzelm@6630
   136
PDFLATEX=$(type -path pdflatex)
wenzelm@3169
   137
wenzelm@3169
   138
for DOC in $(cat Contents)
wenzelm@2667
   139
do
haftmann@20990
   140
  pushd "$DOC" > /dev/null
kleing@13230
   141
  make dvi || fail "DVI document for $DOC failed!"
wenzelm@17554
   142
  { [ -n "$PDFLATEX" ] && make clean pdf; } || fail "PDF document for $DOC failed!"
haftmann@20990
   143
  popd
wenzelm@2667
   144
done
wenzelm@2667
   145
wenzelm@9052
   146
wenzelm@9920
   147
# prepare dist dir for release
kleing@8059
   148
wenzelm@9920
   149
echo "###"
wenzelm@9920
   150
echo "### Preparing distribution ..."
wenzelm@9920
   151
echo "###"
wenzelm@2667
   152
wenzelm@17554
   153
cd "$DISTBASE/$DISTNAME" || fail "No dist directory: $DISTBASE/$DISTNAME"
wenzelm@2667
   154
haftmann@16301
   155
cp -R Admin/website ..
haftmann@16301
   156
mkdir -p ../website/conf
haftmann@17942
   157
cat > ../website/conf/distinfo.mak <<EOF
haftmann@17942
   158
# this is a generated file - do not edit unless you know what you are doing!
haftmann@16301
   159
haftmann@16301
   160
DISTNAME=$DISTNAME
wenzelm@17554
   161
DISTIDENT=$DISTIDENT
haftmann@17910
   162
DISTBASE=$DISTBASE
haftmann@16301
   163
EOF
wenzelm@9920
   164
wenzelm@16481
   165
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
   166
mv -f $MOVE Distribution/doc
wenzelm@3305
   167
rm Distribution/doc/Isa-logics.eps
wenzelm@9052
   168
rm -rf Doc Tools
wenzelm@2667
   169
wenzelm@7115
   170
mkdir src contrib
wenzelm@2667
   171
mv $LOGICS src
wenzelm@2667
   172
wenzelm@2667
   173
mv Distribution/* .
wenzelm@2667
   174
rmdir Distribution
wenzelm@2667
   175
kleing@13230
   176
( cd lib/browser; make; ) || fail "Graph browser build failed!"
berghofe@3638
   177
wenzelm@5385
   178
cp doc/isabelle*.eps lib/logo
wenzelm@5385
   179
berghofe@3638
   180
wenzelm@2667
   181
if [ -n "$UNOFFICIAL" ]; then
wenzelm@2667
   182
  {
wenzelm@2667
   183
    echo
wenzelm@2667
   184
    echo "IMPORTANT NOTE"
wenzelm@2667
   185
    echo "=============="
wenzelm@2667
   186
    echo
wenzelm@17554
   187
    echo "This is an unofficial release of Isabelle, created by $LOGNAME $DATE."
wenzelm@2667
   188
    echo
wenzelm@9925
   189
  } >ANNOUNCE
wenzelm@2667
   190
fi
wenzelm@2667
   191
wenzelm@8810
   192
perl -pi -e "s/{ISABELLE}/$DISTNAME/g;" lib/html/index.html
wenzelm@17554
   193
perl -pi -e "s/Isabelle repository version/$DISTVERSION/" src/Pure/ROOT.ML lib/Tools/version
wenzelm@4986
   194
perl -pi -e "s/the internal repository version of Isabelle/$DISTVERSION/" README.html
wenzelm@3257
   195
lynx -dump README.html >README
wenzelm@3257
   196
wenzelm@9052
   197
( cd src; ../Admin/maketags; )
wenzelm@10077
   198
wenzelm@9052
   199
rm -rf Admin
wenzelm@16286
   200
rm -f TODO
wenzelm@9052
   201
wenzelm@2667
   202
wenzelm@2667
   203
# create archive
wenzelm@2667
   204
wenzelm@9797
   205
echo "###"
wenzelm@9797
   206
echo "### Creating archives ..."
wenzelm@9797
   207
echo "###"
wenzelm@2667
   208
wenzelm@9797
   209
cd "$DISTBASE"
wenzelm@9797
   210
wenzelm@10087
   211
echo "$DISTBASE/$DISTNAME.tar.gz" > ../ISABELLE_DIST
wenzelm@10087
   212
wenzelm@10068
   213
rm -f Isabelle
wenzelm@10068
   214
ln -s "$DISTNAME" Isabelle
wenzelm@10068
   215
wenzelm@9797
   216
chown -R "$LOGNAME" "$DISTNAME"
wenzelm@9797
   217
chmod -R u+w "$DISTNAME"
wenzelm@9797
   218
chmod -R g=o "$DISTNAME"
wenzelm@10077
   219
chgrp -R isabelle "$DISTNAME" Isabelle
wenzelm@2667
   220
wenzelm@9797
   221
mkdir -p "pdf/$DISTNAME/doc"
wenzelm@17655
   222
mv "$DISTNAME/doc/"*.pdf "pdf/$DISTNAME/doc"
wenzelm@17655
   223
wenzelm@17655
   224
sync; sleep 3
wenzelm@6748
   225
wenzelm@10096
   226
echo "$DISTNAME.tar.gz"
wenzelm@10077
   227
"$TAR" cf "$DISTNAME.tar" Isabelle "$DISTNAME"
wenzelm@10096
   228
gzip "$DISTNAME.tar"
wenzelm@10096
   229
wenzelm@10096
   230
echo "${DISTNAME}_pdf.tar.gz"
wenzelm@10112
   231
( cd pdf; "$TAR" cf "../${DISTNAME}_pdf.tar" "$DISTNAME"; )
wenzelm@10096
   232
gzip "${DISTNAME}_pdf.tar"
wenzelm@6748
   233
wenzelm@17655
   234
mv "pdf/$DISTNAME/doc/"*.pdf "$DISTNAME/doc"
wenzelm@9797
   235
rmdir "pdf/$DISTNAME/doc" "pdf/$DISTNAME" pdf
wenzelm@6750
   236
wenzelm@6304
   237
wenzelm@9782
   238
# cleanup dist
wenzelm@9782
   239
wenzelm@9797
   240
mv "$DISTNAME" "${DISTNAME}-old"
wenzelm@9797
   241
mkdir "$DISTNAME"
wenzelm@9782
   242
haftmann@16328
   243
mv "${DISTNAME}-old/README.html" "${DISTNAME}-old/INSTALL" "${DISTNAME}-old/NEWS" \
wenzelm@17554
   244
  "${DISTNAME}-old/ANNOUNCE" "${DISTNAME}-old/COPYRIGHT" "${DISTNAME}-old/CONTRIBUTORS" \
wenzelm@17554
   245
  "$DISTNAME"
wenzelm@9797
   246
mkdir "$DISTNAME/doc"
wenzelm@17655
   247
mv "${DISTNAME}-old/doc/"*.pdf "${DISTNAME}-old/doc/Contents" "$DISTNAME/doc"
wenzelm@9782
   248
wenzelm@9867
   249
chgrp -R isabelle "$DISTNAME"
wenzelm@9867
   250
wenzelm@9797
   251
rm -rf "${DISTNAME}-old"
wenzelm@9782
   252
wenzelm@9782
   253
wenzelm@2667
   254
# final note
wenzelm@2667
   255
wenzelm@9797
   256
echo "###"
wenzelm@10112
   257
echo "### Finished makedist."
wenzelm@9797
   258
echo "###"