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