Admin/makedist
author wenzelm
Thu Jan 18 20:35:39 2001 +0100 (2001-01-18)
changeset 10928 e040e8627bbb
parent 10533 909c473542f9
child 11062 e86340dc1d28
permissions -rwxr-xr-x
generate index.html for pdf docs;
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@10533
    12
case $(hostname) in
wenzelm@10532
    13
  *broy*)
wenzelm@10532
    14
    export CVSROOT=/usr/proj/isabelle-repository/archive
wenzelm@10532
    15
    ;;
wenzelm@10532
    16
  *.cl.cam.ac.uk)
wenzelm@10532
    17
    export CVSROOT=sunbroy1.informatik.tu-muenchen.de:/usr/proj/isabelle-repository/archive
wenzelm@10532
    18
    ;;
wenzelm@10532
    19
esac
wenzelm@10532
    20
wenzelm@9052
    21
DISTPREFIX=~/tmp/isadist
wenzelm@2667
    22
wenzelm@9797
    23
umask 022
wenzelm@9797
    24
wenzelm@9920
    25
TAR=tar
wenzelm@9920
    26
type -path gtar >/dev/null && TAR=gtar
wenzelm@9920
    27
wenzelm@9920
    28
FIND=find
wenzelm@9920
    29
type -path gfind >/dev/null && FIND=gfind
wenzelm@9920
    30
wenzelm@2667
    31
wenzelm@2667
    32
## diagnostics
wenzelm@2667
    33
wenzelm@9797
    34
PRG=$(basename "$0")
wenzelm@9797
    35
THIS=$(cd $(dirname "$0"); echo "$PWD")
wenzelm@2667
    36
wenzelm@2667
    37
function usage()
wenzelm@2667
    38
{
wenzelm@9797
    39
  echo "###"
wenzelm@9797
    40
  echo "### Usage: $PRG VERSION"
wenzelm@9797
    41
  echo "###"
wenzelm@2667
    42
  cat <<EOF
wenzelm@2667
    43
  Make Isabelle distribution from the master sources at TUM.
wenzelm@2667
    44
wenzelm@9797
    45
  VERSION may be either a tag like "Isabelle99-XX" that specifies the
wenzelm@2667
    46
  release to be exported from the repository, or "-" to checkout the
wenzelm@9797
    47
  current sources as an unofficial release, or "--" to produce a
wenzelm@9797
    48
  tentative release from the present copy of the Isabelle repository.
wenzelm@2667
    49
wenzelm@2667
    50
  Checklist for official releases (before running this script):
wenzelm@2667
    51
wenzelm@5817
    52
    * Check release name and date in NEWS!
wenzelm@2668
    53
    * Check that README files are up to date (should have Id: lines).
wenzelm@5769
    54
    * Check Admin/index.html.
wenzelm@2667
    55
EOF
wenzelm@2667
    56
  #Wicked! We just won't tell other users ...
wenzelm@7859
    57
  if [ $LOGNAME = paulson -o $LOGNAME = nipkow -o $LOGNAME = wenzelm -o $LOGNAME = berghofe ]; then
wenzelm@2667
    58
    cat <<EOF
wenzelm@2667
    59
    * Tag the current repository version, e.g.:
wenzelm@10169
    60
        cvs -d /usr/proj/isabelle-repository/archive rtag Isabelle99-X isabelle
wenzelm@2667
    61
      PLEASE DON'T DO THIS UNLESS YOU KNOW WHAT YOU'RE DOING!
wenzelm@2667
    62
EOF
wenzelm@2667
    63
  fi
wenzelm@2667
    64
  cat <<EOF
wenzelm@2667
    65
wenzelm@2667
    66
  After the distribution has been created succesfully, you might want
wenzelm@2667
    67
  to run some makeall tests using different ML systems.
wenzelm@5727
    68
wenzelm@2667
    69
EOF
wenzelm@2667
    70
  exit 1
wenzelm@2667
    71
}
wenzelm@2667
    72
wenzelm@2667
    73
function fail()
wenzelm@2667
    74
{
wenzelm@2667
    75
  echo "$1" >&2
wenzelm@2667
    76
  exit 2
wenzelm@2667
    77
}
wenzelm@2667
    78
wenzelm@2667
    79
wenzelm@2667
    80
## process command line
wenzelm@2667
    81
wenzelm@9797
    82
[ "$#" -ne 1 ] && usage
wenzelm@2667
    83
wenzelm@2667
    84
VERSION="$1"
wenzelm@2667
    85
shift
wenzelm@2667
    86
wenzelm@2667
    87
wenzelm@2667
    88
## main
wenzelm@2667
    89
wenzelm@2667
    90
# dist version
wenzelm@2667
    91
wenzelm@2667
    92
DATE=$(date "+%d-%b-%Y")
wenzelm@4979
    93
DISTDATE=$(date "+%B %Y")
wenzelm@2667
    94
wenzelm@9797
    95
if [ "$VERSION" = "--" ]; then
wenzelm@9925
    96
  DISTNAME="Isabelle_$DATE"
wenzelm@4982
    97
  DISTVERSION="$DISTNAME"
wenzelm@9797
    98
  EXPORT="$THIS/cvs-copy $THIS/.. $DISTNAME"
wenzelm@9925
    99
  UNOFFICIAL="unofficial test"
wenzelm@9797
   100
elif [ "$VERSION" = "-" ]; then
wenzelm@9797
   101
  DISTNAME="Isabelle_$DATE"
wenzelm@9797
   102
  DISTVERSION="$DISTNAME"
wenzelm@9797
   103
  EXPORT="cvs -f -q checkout -P -d $DISTNAME isabelle"
wenzelm@9925
   104
  UNOFFICIAL="unofficial"
wenzelm@2667
   105
else
wenzelm@2667
   106
  DISTNAME="$VERSION"
wenzelm@4982
   107
  DISTVERSION="$DISTNAME: $DISTDATE"
wenzelm@9797
   108
  EXPORT="cvs -f -q export -r $VERSION -d $DISTNAME isabelle"
wenzelm@2667
   109
  UNOFFICIAL=""
wenzelm@2667
   110
fi
wenzelm@2667
   111
wenzelm@9797
   112
DISTBASE="$DISTPREFIX/dist-$DISTNAME"
wenzelm@9797
   113
mkdir -p "$DISTBASE" || fail "Unable to create distribution base dir $DISTBASE!"
wenzelm@9797
   114
[ -e "$DISTBASE/$DISTNAME" ] && fail "$DISTBASE/$DISTNAME already exists!"
wenzelm@9797
   115
[ -e "$DISTBASE/pdf/$DISTNAME" ] && fail "$DISTBASE/pdf/$DISTNAME already exists!"
wenzelm@2667
   116
wenzelm@2667
   117
wenzelm@9797
   118
# export repository
wenzelm@2667
   119
wenzelm@9797
   120
echo "###"
wenzelm@9797
   121
echo "### Exporting $DISTNAME ..."
wenzelm@9797
   122
echo "###"
wenzelm@2667
   123
wenzelm@9797
   124
cd "$DISTBASE"
wenzelm@2667
   125
wenzelm@9797
   126
$EXPORT
wenzelm@9920
   127
$FIND . -name CVS -print | xargs rm -rf
wenzelm@9920
   128
$FIND . "(" -type d -a -empty ")" -print | xargs rm -rf
wenzelm@9920
   129
$FIND . "(" -type d -a -empty ")" -print | xargs rm -rf
wenzelm@9920
   130
$FIND . "(" -type d -a -empty ")" -print | xargs rm -rf
wenzelm@2667
   131
wenzelm@2667
   132
wenzelm@9797
   133
# build docs
wenzelm@2667
   134
wenzelm@9797
   135
echo "###"
wenzelm@9797
   136
echo "### Building docs ..."
wenzelm@9797
   137
echo "###"
wenzelm@9797
   138
wenzelm@9797
   139
cd "$DISTBASE/$DISTNAME/Doc"
wenzelm@6630
   140
PDFLATEX=$(type -path pdflatex)
wenzelm@3169
   141
wenzelm@3169
   142
for DOC in $(cat Contents)
wenzelm@2667
   143
do
wenzelm@9797
   144
  cd "$DOC"
wenzelm@9925
   145
  make dvi
wenzelm@9925
   146
  [ -n "$PDFLATEX" ] && make clean pdf
wenzelm@3169
   147
  cd ..
wenzelm@2667
   148
done
wenzelm@2667
   149
wenzelm@9052
   150
wenzelm@9920
   151
# prepare dist dir for release
kleing@8059
   152
wenzelm@9920
   153
echo "###"
wenzelm@9920
   154
echo "### Preparing distribution ..."
wenzelm@9920
   155
echo "###"
wenzelm@2667
   156
wenzelm@9797
   157
cd "$DISTBASE/$DISTNAME"
wenzelm@2667
   158
wenzelm@9925
   159
cp -R Admin/page ..
wenzelm@9925
   160
cp Distribution/doc/Contents ../page
wenzelm@9920
   161
cp Distribution/lib/logo/isabelle.gif ../page/main-content
wenzelm@9920
   162
cp Distribution/lib/logo/isabelle.gif ../page/dist-content
wenzelm@9920
   163
echo "$DISTNAME" > ../page/DISTNAME
wenzelm@9920
   164
wenzelm@9920
   165
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
   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
wenzelm@4180
   176
( cd lib/browser; make; )
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@9925
   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@9959
   193
perl -pi -e "s/Isabelle repository version/$DISTVERSION/" src/Pure/ROOT.ML
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@10077
   199
( env BASH_PATH=/bin/bash PERL_PATH=/usr/bin/perl ./configure )
wenzelm@10077
   200
wenzelm@9052
   201
rm -rf Admin
wenzelm@9052
   202
wenzelm@2667
   203
wenzelm@2667
   204
# create archive
wenzelm@2667
   205
wenzelm@9797
   206
echo "###"
wenzelm@9797
   207
echo "### Creating archives ..."
wenzelm@9797
   208
echo "###"
wenzelm@2667
   209
wenzelm@9797
   210
cd "$DISTBASE"
wenzelm@9797
   211
wenzelm@10087
   212
echo "$DISTBASE/$DISTNAME.tar.gz" > ../ISABELLE_DIST
wenzelm@10087
   213
wenzelm@10068
   214
rm -f Isabelle
wenzelm@10068
   215
ln -s "$DISTNAME" Isabelle
wenzelm@10068
   216
wenzelm@9797
   217
chown -R "$LOGNAME" "$DISTNAME"
wenzelm@9797
   218
chmod -R u+w "$DISTNAME"
wenzelm@9797
   219
chmod -R g=o "$DISTNAME"
wenzelm@10077
   220
chgrp -R isabelle "$DISTNAME" Isabelle
wenzelm@2667
   221
wenzelm@9797
   222
mkdir -p "pdf/$DISTNAME/doc"
wenzelm@9797
   223
mv "$DISTNAME/doc/"*.pdf "pdf/$DISTNAME/doc"
wenzelm@6748
   224
wenzelm@10928
   225
page/bin/mkcontents "$DISTNAME/doc/Contents" "pdf/$DISTNAME/doc/index"
wenzelm@10928
   226
cat > "pdf/$DISTNAME/doc/index.html" <<EOF
wenzelm@10928
   227
<html>
wenzelm@10928
   228
<head>
wenzelm@10928
   229
<title>$DISTNAME Documentation</title>
wenzelm@10928
   230
</head>
wenzelm@10928
   231
<body>
wenzelm@10928
   232
<h1>$DISTNAME Documentation</h1>
wenzelm@10928
   233
$(cat "pdf/$DISTNAME/doc/index")
wenzelm@10928
   234
</body>
wenzelm@10928
   235
</html>
wenzelm@10928
   236
EOF
wenzelm@10928
   237
rm "pdf/$DISTNAME/doc/index"
wenzelm@10928
   238
wenzelm@10096
   239
echo "$DISTNAME.tar.gz"
wenzelm@10077
   240
"$TAR" cf "$DISTNAME.tar" Isabelle "$DISTNAME"
wenzelm@10096
   241
gzip "$DISTNAME.tar"
wenzelm@10096
   242
wenzelm@10096
   243
echo "${DISTNAME}_pdf.tar.gz"
wenzelm@10112
   244
( cd pdf; "$TAR" cf "../${DISTNAME}_pdf.tar" "$DISTNAME"; )
wenzelm@10096
   245
gzip "${DISTNAME}_pdf.tar"
wenzelm@6748
   246
wenzelm@10928
   247
mv "pdf/$DISTNAME/doc/"*.pdf "pdf/$DISTNAME/doc/index.html" "$DISTNAME/doc"
wenzelm@9797
   248
rmdir "pdf/$DISTNAME/doc" "pdf/$DISTNAME" pdf
wenzelm@6750
   249
wenzelm@6304
   250
wenzelm@9782
   251
# cleanup dist
wenzelm@9782
   252
wenzelm@9797
   253
mv "$DISTNAME" "${DISTNAME}-old"
wenzelm@9797
   254
mkdir "$DISTNAME"
wenzelm@9782
   255
wenzelm@10017
   256
mv "${DISTNAME}-old/README.html" "${DISTNAME}-old/INSTALL" "${DISTNAME}-old/NEWS" "${DISTNAME}-old/ANNOUNCE" "$DISTNAME"
wenzelm@9797
   257
mkdir "$DISTNAME/doc"
wenzelm@10928
   258
mv "${DISTNAME}-old/doc/"*.pdf "${DISTNAME}-old/doc/index.html" "$DISTNAME/doc"
wenzelm@9782
   259
wenzelm@9867
   260
chgrp -R isabelle "$DISTNAME"
wenzelm@9867
   261
wenzelm@9797
   262
rm -rf "${DISTNAME}-old"
wenzelm@9782
   263
wenzelm@9782
   264
wenzelm@2667
   265
# final note
wenzelm@2667
   266
wenzelm@9797
   267
echo "###"
wenzelm@10112
   268
echo "### Finished makedist."
wenzelm@9797
   269
echo "###"