Admin/makedist
author haftmann
Wed Jan 30 10:57:47 2008 +0100 (2008-01-30)
changeset 26015 ad2756de580e
parent 25949 850b4c2d0f17
child 26108 46f4e4cd3b69
permissions -rwxr-xr-x
idempotent semigroups
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@23149
    11
SRCS="CCL CTT Cube FOL FOLP HOL HOLCF LCF Provers Pure Sequents Tools 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@25214
    47
    * Check ANNOUNCE, README, INSTALL, NEWS, COPYRIGHT, CONTRIBUTORS.
wenzelm@11062
    48
    * Try "isatool makeall all" with Poly/ML, SML/NJ, etc.
wenzelm@2667
    49
    * Tag the current repository version, e.g.:
wenzelm@17693
    50
        cvs -d /usr/proj/isabelle-repository/archive rtag IsabelleXXXX isabelle
wenzelm@11062
    51
      PLEASE DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING!
wenzelm@5727
    52
haftmann@25237
    53
   After running this script:
haftmann@25237
    54
haftmann@25237
    55
    * Symlink generated files in website/ directory to their appropriate
haftmann@25237
    56
      places in the isabelle website sources.
haftmann@25237
    57
wenzelm@2667
    58
EOF
wenzelm@2667
    59
  exit 1
wenzelm@2667
    60
}
wenzelm@2667
    61
wenzelm@2667
    62
function fail()
wenzelm@2667
    63
{
wenzelm@2667
    64
  echo "$1" >&2
wenzelm@2667
    65
  exit 2
wenzelm@2667
    66
}
wenzelm@2667
    67
wenzelm@2667
    68
wenzelm@2667
    69
## process command line
wenzelm@2667
    70
wenzelm@17554
    71
[ "$#" -ne 1 -a "$#" -ne 2 ] && usage
wenzelm@17554
    72
wenzelm@17554
    73
VERSION="$1"; shift
wenzelm@2667
    74
wenzelm@17554
    75
if [ "$#" -eq 0 ]; then
wenzelm@17554
    76
  DISTNAME=""
wenzelm@17554
    77
else
wenzelm@17554
    78
  DISTNAME="$1"; shift
wenzelm@17554
    79
fi
wenzelm@2667
    80
wenzelm@2667
    81
wenzelm@2667
    82
## main
wenzelm@2667
    83
wenzelm@2667
    84
# dist version
wenzelm@2667
    85
wenzelm@21712
    86
DATE=$(env LC_ALL=C date "+%d-%b-%Y")
wenzelm@21712
    87
DISTDATE=$(env LC_ALL=C date "+%B %Y")
wenzelm@2667
    88
wenzelm@17554
    89
if [ "$VERSION" = "-" ]; then
wenzelm@17554
    90
  DISTIDENT="Isabelle_$DATE"
wenzelm@17554
    91
  [ -z "$DISTNAME" ] && DISTNAME="$DISTIDENT"
wenzelm@9797
    92
  DISTVERSION="$DISTNAME"
wenzelm@9797
    93
  EXPORT="cvs -f -q checkout -P -d $DISTNAME isabelle"
wenzelm@17558
    94
  UNOFFICIAL=true
wenzelm@2667
    95
else
wenzelm@17554
    96
  DISTIDENT="$VERSION"
wenzelm@17554
    97
  [ -z "$DISTNAME" ] && DISTNAME="$DISTIDENT"
wenzelm@4982
    98
  DISTVERSION="$DISTNAME: $DISTDATE"
wenzelm@17561
    99
  EXPORT="cvs -f -q export -r $VERSION -d $DISTNAME isabelle"
wenzelm@2667
   100
  UNOFFICIAL=""
wenzelm@2667
   101
fi
wenzelm@2667
   102
wenzelm@9797
   103
DISTBASE="$DISTPREFIX/dist-$DISTNAME"
wenzelm@9797
   104
mkdir -p "$DISTBASE" || fail "Unable to create distribution base dir $DISTBASE!"
wenzelm@9797
   105
[ -e "$DISTBASE/$DISTNAME" ] && fail "$DISTBASE/$DISTNAME already exists!"
wenzelm@9797
   106
[ -e "$DISTBASE/pdf/$DISTNAME" ] && fail "$DISTBASE/pdf/$DISTNAME already exists!"
wenzelm@2667
   107
wenzelm@2667
   108
wenzelm@9797
   109
# export repository
wenzelm@2667
   110
wenzelm@9797
   111
echo "###"
wenzelm@17554
   112
echo "### Exporting $DISTIDENT ..."
wenzelm@9797
   113
echo "###"
wenzelm@2667
   114
wenzelm@9797
   115
cd "$DISTBASE"
wenzelm@2667
   116
kleing@13230
   117
$EXPORT || fail "Export failed!"
berghofe@15438
   118
berghofe@15438
   119
if [ -n "$CVS2CL" ]; then
berghofe@15438
   120
  cd $DISTNAME
berghofe@15438
   121
  $CVS2CL
berghofe@15438
   122
  gzip ChangeLog
berghofe@15438
   123
  mv ChangeLog.gz ..
berghofe@15438
   124
  cd ..
berghofe@15438
   125
fi
berghofe@15438
   126
wenzelm@9920
   127
$FIND . -name CVS -print | xargs rm -rf
wenzelm@12986
   128
$FIND . -name .cvsignore -print | xargs rm -rf
wenzelm@17554
   129
$FIND . "(" -name \*.thy -o -name \*.ML ")" -perm +111 -print | xargs chmod -x
wenzelm@23895
   130
$FIND . -print | xargs chmod u+rw
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
haftmann@20990
   144
  pushd "$DOC" > /dev/null
kleing@13230
   145
  make dvi || fail "DVI document for $DOC failed!"
wenzelm@17554
   146
  { [ -n "$PDFLATEX" ] && make clean pdf; } || fail "PDF document for $DOC failed!"
haftmann@20990
   147
  popd
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@17554
   157
cd "$DISTBASE/$DISTNAME" || fail "No dist directory: $DISTBASE/$DISTNAME"
wenzelm@2667
   158
haftmann@25237
   159
mkdir -p ../website
haftmann@25237
   160
cat > ../website/distinfo.mak <<EOF
haftmann@17942
   161
# this is a generated file - do not edit unless you know what you are doing!
haftmann@16301
   162
haftmann@16301
   163
DISTNAME=$DISTNAME
wenzelm@17554
   164
DISTIDENT=$DISTIDENT
haftmann@17910
   165
DISTBASE=$DISTBASE
haftmann@16301
   166
EOF
wenzelm@9920
   167
haftmann@25237
   168
cp Distribution/lib/html/library_index_content.template ../website/
haftmann@25237
   169
wenzelm@23160
   170
MOVE=$($FIND Doc \( -type f -a -not -type l -a -not -name isabelle_isar.pdf -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
   171
mv -f $MOVE Distribution/doc
wenzelm@3305
   172
rm Distribution/doc/Isa-logics.eps
wenzelm@23201
   173
rm -rf Doc
wenzelm@2667
   174
wenzelm@7115
   175
mkdir src contrib
wenzelm@23149
   176
mv $SRCS src
wenzelm@2667
   177
wenzelm@2667
   178
mv Distribution/* .
wenzelm@2667
   179
rmdir Distribution
wenzelm@2667
   180
wenzelm@25949
   181
wenzelm@25949
   182
#paranoia setting for sunbroy
wenzelm@25949
   183
PATH=/usr/local/dist/DIR/j2sdk1.5.0/bin:$PATH
wenzelm@25949
   184
wenzelm@25856
   185
( cd lib/browser; make; ) || fail "Failed to build graph browser!"
wenzelm@25856
   186
wenzelm@25949
   187
( cd lib/classes; ./mk; )
wenzelm@25949
   188
[ -f lib/classes/isabelle.jar ] || fail "Failed to build Isabelle process wrapper!"
wenzelm@25949
   189
wenzelm@25949
   190
if type -p scalac >/dev/null
wenzelm@25949
   191
then
wenzelm@25949
   192
  ( cd lib/jedit/plugin; ./mk; )
wenzelm@25949
   193
  [ -f lib/jedit/isabelle.jar ] || fail "Failed to build jEdit plugin!"
wenzelm@25949
   194
else
wenzelm@25949
   195
  echo "Warning: Scala unavailable -- skipping jEdit plugin"
wenzelm@25949
   196
fi
wenzelm@25949
   197
berghofe@3638
   198
wenzelm@5385
   199
cp doc/isabelle*.eps lib/logo
wenzelm@5385
   200
berghofe@3638
   201
wenzelm@2667
   202
if [ -n "$UNOFFICIAL" ]; then
wenzelm@2667
   203
  {
wenzelm@2667
   204
    echo
wenzelm@2667
   205
    echo "IMPORTANT NOTE"
wenzelm@2667
   206
    echo "=============="
wenzelm@2667
   207
    echo
wenzelm@17554
   208
    echo "This is an unofficial release of Isabelle, created by $LOGNAME $DATE."
wenzelm@2667
   209
    echo
wenzelm@9925
   210
  } >ANNOUNCE
wenzelm@2667
   211
fi
wenzelm@2667
   212
wenzelm@25433
   213
perl -pi -e "s/ISABELLE_IDENTIFIER=\"\"/ISABELLE_IDENTIFIER=\"$DISTNAME\"/g;" lib/scripts/getsettings
haftmann@25237
   214
perl -pi -e "s/{ISABELLE}/$DISTNAME/g;" lib/html/library_index_header.template
wenzelm@17554
   215
perl -pi -e "s/Isabelle repository version/$DISTVERSION/" src/Pure/ROOT.ML lib/Tools/version
haftmann@25214
   216
perl -pi -e "s/the internal repository version of Isabelle/$DISTVERSION/" README
wenzelm@3257
   217
wenzelm@9052
   218
( cd src; ../Admin/maketags; )
wenzelm@10077
   219
wenzelm@9052
   220
rm -rf Admin
wenzelm@16286
   221
rm -f TODO
wenzelm@9052
   222
wenzelm@2667
   223
wenzelm@2667
   224
# create archive
wenzelm@2667
   225
wenzelm@9797
   226
echo "###"
wenzelm@9797
   227
echo "### Creating archives ..."
wenzelm@9797
   228
echo "###"
wenzelm@2667
   229
wenzelm@9797
   230
cd "$DISTBASE"
wenzelm@9797
   231
wenzelm@10087
   232
echo "$DISTBASE/$DISTNAME.tar.gz" > ../ISABELLE_DIST
wenzelm@10087
   233
wenzelm@10068
   234
rm -f Isabelle
wenzelm@10068
   235
ln -s "$DISTNAME" Isabelle
wenzelm@10068
   236
wenzelm@9797
   237
chown -R "$LOGNAME" "$DISTNAME"
wenzelm@9797
   238
chmod -R u+w "$DISTNAME"
wenzelm@9797
   239
chmod -R g=o "$DISTNAME"
wenzelm@10077
   240
chgrp -R isabelle "$DISTNAME" Isabelle
wenzelm@2667
   241
wenzelm@9797
   242
mkdir -p "pdf/$DISTNAME/doc"
wenzelm@17655
   243
mv "$DISTNAME/doc/"*.pdf "pdf/$DISTNAME/doc"
wenzelm@17655
   244
wenzelm@17655
   245
sync; sleep 3
wenzelm@6748
   246
wenzelm@10096
   247
echo "$DISTNAME.tar.gz"
wenzelm@10077
   248
"$TAR" cf "$DISTNAME.tar" Isabelle "$DISTNAME"
wenzelm@10096
   249
gzip "$DISTNAME.tar"
wenzelm@10096
   250
wenzelm@10096
   251
echo "${DISTNAME}_pdf.tar.gz"
wenzelm@10112
   252
( cd pdf; "$TAR" cf "../${DISTNAME}_pdf.tar" "$DISTNAME"; )
wenzelm@10096
   253
gzip "${DISTNAME}_pdf.tar"
wenzelm@6748
   254
wenzelm@17655
   255
mv "pdf/$DISTNAME/doc/"*.pdf "$DISTNAME/doc"
wenzelm@9797
   256
rmdir "pdf/$DISTNAME/doc" "pdf/$DISTNAME" pdf
wenzelm@6750
   257
wenzelm@6304
   258
wenzelm@9782
   259
# cleanup dist
wenzelm@9782
   260
wenzelm@9797
   261
mv "$DISTNAME" "${DISTNAME}-old"
wenzelm@9797
   262
mkdir "$DISTNAME"
wenzelm@9782
   263
haftmann@25214
   264
mv "${DISTNAME}-old/README" "${DISTNAME}-old/INSTALL" "${DISTNAME}-old/NEWS" \
wenzelm@17554
   265
  "${DISTNAME}-old/ANNOUNCE" "${DISTNAME}-old/COPYRIGHT" "${DISTNAME}-old/CONTRIBUTORS" \
wenzelm@17554
   266
  "$DISTNAME"
wenzelm@9797
   267
mkdir "$DISTNAME/doc"
wenzelm@17655
   268
mv "${DISTNAME}-old/doc/"*.pdf "${DISTNAME}-old/doc/Contents" "$DISTNAME/doc"
wenzelm@9782
   269
wenzelm@9867
   270
chgrp -R isabelle "$DISTNAME"
wenzelm@9867
   271
wenzelm@9797
   272
rm -rf "${DISTNAME}-old"
wenzelm@9782
   273
wenzelm@9782
   274
wenzelm@2667
   275
# final note
wenzelm@2667
   276
wenzelm@9797
   277
echo "###"
wenzelm@10112
   278
echo "### Finished makedist."
wenzelm@9797
   279
echo "###"