Admin/makedist
author wenzelm
Tue Sep 26 17:01:31 2000 +0200 (2000-09-26)
changeset 10077 0261aede52ca
parent 10068 46db6fde4ee3
child 10087 4dc7edfb0b5f
permissions -rwxr-xr-x
tuned;
wenzelm@3060
     1
#!/bin/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@7993
    10
LOGICS="CCL CTT Cube FOL FOLP HOL HOLCF LCF Provers Pure Sequents TFL ZF"
wenzelm@2667
    11
wenzelm@9797
    12
export CVSROOT=/usr/proj/isabelle-repository/archive
wenzelm@9052
    13
DISTPREFIX=~/tmp/isadist
wenzelm@2667
    14
wenzelm@9797
    15
umask 022
wenzelm@9797
    16
wenzelm@9920
    17
TAR=tar
wenzelm@9920
    18
type -path gtar >/dev/null && TAR=gtar
wenzelm@9920
    19
wenzelm@9920
    20
FIND=find
wenzelm@9920
    21
type -path gfind >/dev/null && FIND=gfind
wenzelm@9920
    22
wenzelm@2667
    23
wenzelm@2667
    24
## diagnostics
wenzelm@2667
    25
wenzelm@9797
    26
PRG=$(basename "$0")
wenzelm@9797
    27
THIS=$(cd $(dirname "$0"); echo "$PWD")
wenzelm@2667
    28
wenzelm@2667
    29
function usage()
wenzelm@2667
    30
{
wenzelm@9797
    31
  echo "###"
wenzelm@9797
    32
  echo "### Usage: $PRG VERSION"
wenzelm@9797
    33
  echo "###"
wenzelm@2667
    34
  cat <<EOF
wenzelm@2667
    35
  Make Isabelle distribution from the master sources at TUM.
wenzelm@2667
    36
wenzelm@9797
    37
  VERSION may be either a tag like "Isabelle99-XX" that specifies the
wenzelm@2667
    38
  release to be exported from the repository, or "-" to checkout the
wenzelm@9797
    39
  current sources as an unofficial release, or "--" to produce a
wenzelm@9797
    40
  tentative release from the present copy of the Isabelle repository.
wenzelm@2667
    41
wenzelm@2667
    42
  Checklist for official releases (before running this script):
wenzelm@2667
    43
wenzelm@5817
    44
    * Check release name and date in NEWS!
wenzelm@2668
    45
    * Check that README files are up to date (should have Id: lines).
wenzelm@5769
    46
    * Check Admin/index.html.
wenzelm@2667
    47
EOF
wenzelm@2667
    48
  #Wicked! We just won't tell other users ...
wenzelm@7859
    49
  if [ $LOGNAME = paulson -o $LOGNAME = nipkow -o $LOGNAME = wenzelm -o $LOGNAME = berghofe ]; then
wenzelm@2667
    50
    cat <<EOF
wenzelm@2667
    51
    * Tag the current repository version, e.g.:
wenzelm@9797
    52
        cvs -d $CVSROOT rtag Isabelle99-XX isabelle
wenzelm@2667
    53
      PLEASE DON'T DO THIS UNLESS YOU KNOW WHAT YOU'RE DOING!
wenzelm@2667
    54
EOF
wenzelm@2667
    55
  fi
wenzelm@2667
    56
  cat <<EOF
wenzelm@2667
    57
wenzelm@2667
    58
  After the distribution has been created succesfully, you might want
wenzelm@2667
    59
  to run some makeall tests using different ML systems.
wenzelm@5727
    60
wenzelm@2667
    61
EOF
wenzelm@2667
    62
  exit 1
wenzelm@2667
    63
}
wenzelm@2667
    64
wenzelm@2667
    65
function fail()
wenzelm@2667
    66
{
wenzelm@2667
    67
  echo "$1" >&2
wenzelm@2667
    68
  exit 2
wenzelm@2667
    69
}
wenzelm@2667
    70
wenzelm@2667
    71
wenzelm@2667
    72
## process command line
wenzelm@2667
    73
wenzelm@9797
    74
[ "$#" -ne 1 ] && usage
wenzelm@2667
    75
wenzelm@2667
    76
VERSION="$1"
wenzelm@2667
    77
shift
wenzelm@2667
    78
wenzelm@2667
    79
wenzelm@2667
    80
## main
wenzelm@2667
    81
wenzelm@2667
    82
# dist version
wenzelm@2667
    83
wenzelm@2667
    84
DATE=$(date "+%d-%b-%Y")
wenzelm@4979
    85
DISTDATE=$(date "+%B %Y")
wenzelm@2667
    86
wenzelm@9797
    87
if [ "$VERSION" = "--" ]; then
wenzelm@9925
    88
  DISTNAME="Isabelle_$DATE"
wenzelm@4982
    89
  DISTVERSION="$DISTNAME"
wenzelm@9797
    90
  EXPORT="$THIS/cvs-copy $THIS/.. $DISTNAME"
wenzelm@9925
    91
  UNOFFICIAL="unofficial test"
wenzelm@9797
    92
elif [ "$VERSION" = "-" ]; then
wenzelm@9797
    93
  DISTNAME="Isabelle_$DATE"
wenzelm@9797
    94
  DISTVERSION="$DISTNAME"
wenzelm@9797
    95
  EXPORT="cvs -f -q checkout -P -d $DISTNAME isabelle"
wenzelm@9925
    96
  UNOFFICIAL="unofficial"
wenzelm@2667
    97
else
wenzelm@2667
    98
  DISTNAME="$VERSION"
wenzelm@4982
    99
  DISTVERSION="$DISTNAME: $DISTDATE"
wenzelm@9797
   100
  EXPORT="cvs -f -q export -r $VERSION -d $DISTNAME isabelle"
wenzelm@2667
   101
  UNOFFICIAL=""
wenzelm@2667
   102
fi
wenzelm@2667
   103
wenzelm@9797
   104
DISTBASE="$DISTPREFIX/dist-$DISTNAME"
wenzelm@9797
   105
mkdir -p "$DISTBASE" || fail "Unable to create distribution base dir $DISTBASE!"
wenzelm@9797
   106
[ -e "$DISTBASE/$DISTNAME" ] && fail "$DISTBASE/$DISTNAME already exists!"
wenzelm@9797
   107
[ -e "$DISTBASE/pdf/$DISTNAME" ] && fail "$DISTBASE/pdf/$DISTNAME already exists!"
wenzelm@2667
   108
wenzelm@2667
   109
wenzelm@9797
   110
# export repository
wenzelm@2667
   111
wenzelm@9797
   112
echo "###"
wenzelm@9797
   113
echo "### Exporting $DISTNAME ..."
wenzelm@9797
   114
echo "###"
wenzelm@2667
   115
wenzelm@9797
   116
cd "$DISTBASE"
wenzelm@2667
   117
wenzelm@9797
   118
$EXPORT
wenzelm@9920
   119
$FIND . -name CVS -print | xargs rm -rf
wenzelm@9920
   120
$FIND . "(" -type d -a -empty ")" -print | xargs rm -rf
wenzelm@9920
   121
$FIND . "(" -type d -a -empty ")" -print | xargs rm -rf
wenzelm@9920
   122
$FIND . "(" -type d -a -empty ")" -print | xargs rm -rf
wenzelm@2667
   123
wenzelm@2667
   124
wenzelm@9797
   125
# build docs
wenzelm@2667
   126
wenzelm@9797
   127
echo "###"
wenzelm@9797
   128
echo "### Building docs ..."
wenzelm@9797
   129
echo "###"
wenzelm@9797
   130
wenzelm@9797
   131
cd "$DISTBASE/$DISTNAME/Doc"
wenzelm@6630
   132
PDFLATEX=$(type -path pdflatex)
wenzelm@3169
   133
wenzelm@3169
   134
for DOC in $(cat Contents)
wenzelm@2667
   135
do
wenzelm@9797
   136
  cd "$DOC"
wenzelm@9925
   137
  make dvi
wenzelm@9925
   138
  [ -n "$PDFLATEX" ] && make clean pdf
wenzelm@3169
   139
  cd ..
wenzelm@2667
   140
done
wenzelm@2667
   141
wenzelm@9052
   142
wenzelm@9920
   143
# prepare dist dir for release
kleing@8059
   144
wenzelm@9920
   145
echo "###"
wenzelm@9920
   146
echo "### Preparing distribution ..."
wenzelm@9920
   147
echo "###"
wenzelm@2667
   148
wenzelm@9797
   149
cd "$DISTBASE/$DISTNAME"
wenzelm@2667
   150
wenzelm@9925
   151
cp -R Admin/page ..
wenzelm@9925
   152
cp Distribution/doc/Contents ../page
wenzelm@9920
   153
cp Distribution/lib/logo/isabelle.gif ../page/main-content
wenzelm@9920
   154
cp Distribution/lib/logo/isabelle.gif ../page/dist-content
wenzelm@9920
   155
echo "$DISTNAME" > ../page/DISTNAME
wenzelm@9920
   156
wenzelm@9920
   157
MOVE=$($FIND Doc \( -type f -a \( -name \*.dvi -o -name \*.eps -o -name \*.ps -o -name \*.pdf \) -a -print \) | grep -v 'gfx/.*pdf')
wenzelm@6630
   158
mv -f $MOVE Distribution/doc
wenzelm@3305
   159
rm Distribution/doc/Isa-logics.eps
wenzelm@9052
   160
rm -rf Doc Tools
wenzelm@2667
   161
wenzelm@7115
   162
mkdir src contrib
wenzelm@2667
   163
mv $LOGICS src
wenzelm@2667
   164
wenzelm@2667
   165
mv Distribution/* .
wenzelm@2667
   166
rmdir Distribution
wenzelm@2667
   167
wenzelm@4180
   168
( cd lib/browser; make; )
berghofe@3638
   169
wenzelm@5385
   170
cp doc/isabelle*.eps lib/logo
wenzelm@5385
   171
berghofe@3638
   172
wenzelm@2667
   173
if [ -n "$UNOFFICIAL" ]; then
wenzelm@2667
   174
  {
wenzelm@2667
   175
    echo
wenzelm@2667
   176
    echo "IMPORTANT NOTE"
wenzelm@2667
   177
    echo "=============="
wenzelm@2667
   178
    echo
wenzelm@9925
   179
    echo "This is an $UNOFFICIAL release of Isabelle, created by $LOGNAME $DATE."
wenzelm@2667
   180
    echo
wenzelm@9925
   181
  } >ANNOUNCE
wenzelm@2667
   182
fi
wenzelm@2667
   183
wenzelm@8810
   184
perl -pi -e "s/{ISABELLE}/$DISTNAME/g;" lib/html/index.html
wenzelm@9959
   185
perl -pi -e "s/Isabelle repository version/$DISTVERSION/" src/Pure/ROOT.ML
wenzelm@4986
   186
perl -pi -e "s/the internal repository version of Isabelle/$DISTVERSION/" README.html
wenzelm@3257
   187
lynx -dump README.html >README
wenzelm@3257
   188
wenzelm@9052
   189
( cd src; ../Admin/maketags; )
wenzelm@10077
   190
wenzelm@10077
   191
( env BASH_PATH=/bin/bash PERL_PATH=/usr/bin/perl ./configure )
wenzelm@10077
   192
wenzelm@9052
   193
rm -rf Admin
wenzelm@9052
   194
wenzelm@2667
   195
wenzelm@2667
   196
# create archive
wenzelm@2667
   197
wenzelm@9797
   198
echo "###"
wenzelm@9797
   199
echo "### Creating archives ..."
wenzelm@9797
   200
echo "###"
wenzelm@2667
   201
wenzelm@9797
   202
cd "$DISTBASE"
wenzelm@9797
   203
wenzelm@10068
   204
rm -f Isabelle
wenzelm@10068
   205
ln -s "$DISTNAME" Isabelle
wenzelm@10068
   206
wenzelm@9797
   207
chown -R "$LOGNAME" "$DISTNAME"
wenzelm@9797
   208
chmod -R u+w "$DISTNAME"
wenzelm@9797
   209
chmod -R g=o "$DISTNAME"
wenzelm@10077
   210
chgrp -R isabelle "$DISTNAME" Isabelle
wenzelm@2667
   211
wenzelm@9797
   212
mkdir -p "pdf/$DISTNAME/doc"
wenzelm@9797
   213
mv "$DISTNAME/doc/"*.pdf "pdf/$DISTNAME/doc"
wenzelm@6748
   214
wenzelm@10077
   215
echo "$DISTNAME.tar"
wenzelm@10077
   216
"$TAR" cf "$DISTNAME.tar" Isabelle "$DISTNAME"
wenzelm@10077
   217
( cd pdf; echo "${DISTNAME}_pdf.tar"; "$TAR" cf "../${DISTNAME}_pdf.tar" "$DISTNAME"; )
wenzelm@6748
   218
wenzelm@9797
   219
mv "pdf/$DISTNAME/doc/"*.pdf "$DISTNAME/doc"
wenzelm@9797
   220
rmdir "pdf/$DISTNAME/doc" "pdf/$DISTNAME" pdf
wenzelm@6750
   221
wenzelm@10077
   222
echo "$DISTNAME.tar.gz" && gzip "$DISTNAME.tar"
wenzelm@10077
   223
echo "${DISTNAME}_pdf.tar.gz" && gzip "${DISTNAME}_pdf.tar"
wenzelm@4549
   224
wenzelm@6304
   225
wenzelm@9782
   226
# cleanup dist
wenzelm@9782
   227
wenzelm@9797
   228
mv "$DISTNAME" "${DISTNAME}-old"
wenzelm@9797
   229
mkdir "$DISTNAME"
wenzelm@9782
   230
wenzelm@10017
   231
mv "${DISTNAME}-old/README.html" "${DISTNAME}-old/INSTALL" "${DISTNAME}-old/NEWS" "${DISTNAME}-old/ANNOUNCE" "$DISTNAME"
wenzelm@9797
   232
mkdir "$DISTNAME/doc"
wenzelm@9925
   233
mv "${DISTNAME}-old/doc/"*.pdf "$DISTNAME/doc"
wenzelm@9782
   234
wenzelm@9867
   235
chgrp -R isabelle "$DISTNAME"
wenzelm@9867
   236
wenzelm@9797
   237
rm -rf "${DISTNAME}-old"
wenzelm@9782
   238
wenzelm@9782
   239
wenzelm@2667
   240
# final note
wenzelm@2667
   241
wenzelm@9797
   242
echo "###"
wenzelm@9920
   243
echo "### Finished."
wenzelm@9797
   244
echo "###"