Admin/makedist
author wenzelm
Fri Feb 03 23:12:28 2006 +0100 (2006-02-03 ago)
changeset 18921 f47c46d7d654
parent 18539 35b9ed76b59a
child 20990 0c1296049b47
permissions -rwxr-xr-x
canonical member/insert/merge;
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
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@17693
    51
        cvs -d /usr/proj/isabelle-repository/archive rtag IsabelleXXXX 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@17561
    95
  EXPORT="cvs -f -q export -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@17942
   156
cat > ../website/conf/distinfo.mak <<EOF
haftmann@17942
   157
# this is a generated file - do not edit unless you know what you are doing!
haftmann@16301
   158
haftmann@16301
   159
DISTNAME=$DISTNAME
wenzelm@17554
   160
DISTIDENT=$DISTIDENT
haftmann@17910
   161
DISTBASE=$DISTBASE
haftmann@16301
   162
EOF
wenzelm@9920
   163
wenzelm@16481
   164
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
   165
mv -f $MOVE Distribution/doc
wenzelm@3305
   166
rm Distribution/doc/Isa-logics.eps
wenzelm@9052
   167
rm -rf Doc Tools
wenzelm@2667
   168
wenzelm@7115
   169
mkdir src contrib
wenzelm@2667
   170
mv $LOGICS src
wenzelm@2667
   171
wenzelm@2667
   172
mv Distribution/* .
wenzelm@2667
   173
rmdir Distribution
wenzelm@2667
   174
kleing@13230
   175
( cd lib/browser; make; ) || fail "Graph browser build failed!"
berghofe@3638
   176
wenzelm@5385
   177
cp doc/isabelle*.eps lib/logo
wenzelm@5385
   178
berghofe@3638
   179
wenzelm@2667
   180
if [ -n "$UNOFFICIAL" ]; then
wenzelm@2667
   181
  {
wenzelm@2667
   182
    echo
wenzelm@2667
   183
    echo "IMPORTANT NOTE"
wenzelm@2667
   184
    echo "=============="
wenzelm@2667
   185
    echo
wenzelm@17554
   186
    echo "This is an unofficial release of Isabelle, created by $LOGNAME $DATE."
wenzelm@2667
   187
    echo
wenzelm@9925
   188
  } >ANNOUNCE
wenzelm@2667
   189
fi
wenzelm@2667
   190
wenzelm@8810
   191
perl -pi -e "s/{ISABELLE}/$DISTNAME/g;" lib/html/index.html
wenzelm@17554
   192
perl -pi -e "s/Isabelle repository version/$DISTVERSION/" src/Pure/ROOT.ML lib/Tools/version
wenzelm@4986
   193
perl -pi -e "s/the internal repository version of Isabelle/$DISTVERSION/" README.html
wenzelm@3257
   194
lynx -dump README.html >README
wenzelm@3257
   195
wenzelm@9052
   196
( cd src; ../Admin/maketags; )
wenzelm@10077
   197
wenzelm@9052
   198
rm -rf Admin
wenzelm@16286
   199
rm -f TODO
wenzelm@9052
   200
wenzelm@2667
   201
wenzelm@2667
   202
# create archive
wenzelm@2667
   203
wenzelm@9797
   204
echo "###"
wenzelm@9797
   205
echo "### Creating archives ..."
wenzelm@9797
   206
echo "###"
wenzelm@2667
   207
wenzelm@9797
   208
cd "$DISTBASE"
wenzelm@9797
   209
wenzelm@10087
   210
echo "$DISTBASE/$DISTNAME.tar.gz" > ../ISABELLE_DIST
wenzelm@10087
   211
wenzelm@10068
   212
rm -f Isabelle
wenzelm@10068
   213
ln -s "$DISTNAME" Isabelle
wenzelm@10068
   214
wenzelm@9797
   215
chown -R "$LOGNAME" "$DISTNAME"
wenzelm@9797
   216
chmod -R u+w "$DISTNAME"
wenzelm@9797
   217
chmod -R g=o "$DISTNAME"
wenzelm@10077
   218
chgrp -R isabelle "$DISTNAME" Isabelle
wenzelm@2667
   219
wenzelm@9797
   220
mkdir -p "pdf/$DISTNAME/doc"
wenzelm@17655
   221
mv "$DISTNAME/doc/"*.pdf "pdf/$DISTNAME/doc"
wenzelm@17655
   222
wenzelm@17655
   223
sync; sleep 3
wenzelm@6748
   224
wenzelm@10096
   225
echo "$DISTNAME.tar.gz"
wenzelm@10077
   226
"$TAR" cf "$DISTNAME.tar" Isabelle "$DISTNAME"
wenzelm@10096
   227
gzip "$DISTNAME.tar"
wenzelm@10096
   228
wenzelm@10096
   229
echo "${DISTNAME}_pdf.tar.gz"
wenzelm@10112
   230
( cd pdf; "$TAR" cf "../${DISTNAME}_pdf.tar" "$DISTNAME"; )
wenzelm@10096
   231
gzip "${DISTNAME}_pdf.tar"
wenzelm@6748
   232
wenzelm@17655
   233
mv "pdf/$DISTNAME/doc/"*.pdf "$DISTNAME/doc"
wenzelm@9797
   234
rmdir "pdf/$DISTNAME/doc" "pdf/$DISTNAME" pdf
wenzelm@6750
   235
wenzelm@6304
   236
wenzelm@9782
   237
# cleanup dist
wenzelm@9782
   238
wenzelm@9797
   239
mv "$DISTNAME" "${DISTNAME}-old"
wenzelm@9797
   240
mkdir "$DISTNAME"
wenzelm@9782
   241
haftmann@16328
   242
mv "${DISTNAME}-old/README.html" "${DISTNAME}-old/INSTALL" "${DISTNAME}-old/NEWS" \
wenzelm@17554
   243
  "${DISTNAME}-old/ANNOUNCE" "${DISTNAME}-old/COPYRIGHT" "${DISTNAME}-old/CONTRIBUTORS" \
wenzelm@17554
   244
  "$DISTNAME"
wenzelm@9797
   245
mkdir "$DISTNAME/doc"
wenzelm@17655
   246
mv "${DISTNAME}-old/doc/"*.pdf "${DISTNAME}-old/doc/Contents" "$DISTNAME/doc"
wenzelm@9782
   247
wenzelm@9867
   248
chgrp -R isabelle "$DISTNAME"
wenzelm@9867
   249
wenzelm@9797
   250
rm -rf "${DISTNAME}-old"
wenzelm@9782
   251
wenzelm@9782
   252
wenzelm@2667
   253
# final note
wenzelm@2667
   254
wenzelm@9797
   255
echo "###"
wenzelm@10112
   256
echo "### Finished makedist."
wenzelm@9797
   257
echo "###"