author | wenzelm |
Wed, 07 Jun 2006 00:57:14 +0200 | |
changeset 19801 | b2af2549efd1 |
parent 18539 | 35b9ed76b59a |
child 20990 | 0c1296049b47 |
permissions | -rwxr-xr-x |
12721 | 1 |
#!/usr/bin/env bash |
2667 | 2 |
# |
3 |
# $Id$ |
|
4 |
# |
|
10077 | 5 |
# makedist -- make Isabelle source distribution. |
2667 | 6 |
|
7 |
||
8 |
## global settings |
|
9 |
||
17554 | 10 |
DISTPREFIX=${DISTPREFIX:-~/tmp/isadist} |
7993 | 11 |
LOGICS="CCL CTT Cube FOL FOLP HOL HOLCF LCF Provers Pure Sequents TFL ZF" |
2667 | 12 |
|
17554 | 13 |
export CVSROOT=/usr/proj/isabelle-repository/archive |
18539 | 14 |
[ ! -d "$CVSROOT" ] && CVSROOT="${ISABELLE_USER:-$USER}@sunbroy2.informatik.tu-muenchen.de:$CVSROOT" |
2667 | 15 |
|
9797 | 16 |
umask 022 |
17 |
||
9920
9734f2717203
improved WWW page generation (still somewhat experimental);
wenzelm
parents:
9880
diff
changeset
|
18 |
TAR=tar |
9734f2717203
improved WWW page generation (still somewhat experimental);
wenzelm
parents:
9880
diff
changeset
|
19 |
type -path gtar >/dev/null && TAR=gtar |
9734f2717203
improved WWW page generation (still somewhat experimental);
wenzelm
parents:
9880
diff
changeset
|
20 |
|
9734f2717203
improved WWW page generation (still somewhat experimental);
wenzelm
parents:
9880
diff
changeset
|
21 |
FIND=find |
9734f2717203
improved WWW page generation (still somewhat experimental);
wenzelm
parents:
9880
diff
changeset
|
22 |
type -path gfind >/dev/null && FIND=gfind |
9734f2717203
improved WWW page generation (still somewhat experimental);
wenzelm
parents:
9880
diff
changeset
|
23 |
|
2667 | 24 |
|
25 |
## diagnostics |
|
26 |
||
9797 | 27 |
PRG=$(basename "$0") |
28 |
THIS=$(cd $(dirname "$0"); echo "$PWD") |
|
2667 | 29 |
|
30 |
function usage() |
|
31 |
{ |
|
32 |
cat <<EOF |
|
11062 | 33 |
|
17554 | 34 |
Usage: $PRG VERSION [NAME] |
11062 | 35 |
|
2667 | 36 |
Make Isabelle distribution from the master sources at TUM. |
37 |
||
17693 | 38 |
VERSION may be either a tag like "IsabelleXXXX" that specifies the |
2667 | 39 |
release to be exported from the repository, or "-" to checkout the |
17554 | 40 |
current sources as an unofficial release. |
41 |
||
42 |
NAME specifies an explicit distribution name, by default it is |
|
43 |
derived from VERSION. |
|
2667 | 44 |
|
45 |
Checklist for official releases (before running this script): |
|
46 |
||
17554 | 47 |
* Check Admin/website contents. |
48 |
* Check ANNOUNCE, README.html, INSTALL, NEWS, COPYRIGHT, CONTRIBUTORS. |
|
11062 | 49 |
* Try "isatool makeall all" with Poly/ML, SML/NJ, etc. |
2667 | 50 |
* Tag the current repository version, e.g.: |
17693 | 51 |
cvs -d /usr/proj/isabelle-repository/archive rtag IsabelleXXXX isabelle |
11062 | 52 |
PLEASE DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING! |
5727 | 53 |
|
2667 | 54 |
EOF |
55 |
exit 1 |
|
56 |
} |
|
57 |
||
58 |
function fail() |
|
59 |
{ |
|
60 |
echo "$1" >&2 |
|
61 |
exit 2 |
|
62 |
} |
|
63 |
||
64 |
||
65 |
## process command line |
|
66 |
||
17554 | 67 |
[ "$#" -ne 1 -a "$#" -ne 2 ] && usage |
68 |
||
69 |
VERSION="$1"; shift |
|
2667 | 70 |
|
17554 | 71 |
if [ "$#" -eq 0 ]; then |
72 |
DISTNAME="" |
|
73 |
else |
|
74 |
DISTNAME="$1"; shift |
|
75 |
fi |
|
2667 | 76 |
|
77 |
||
78 |
## main |
|
79 |
||
80 |
# dist version |
|
81 |
||
82 |
DATE=$(date "+%d-%b-%Y") |
|
4979 | 83 |
DISTDATE=$(date "+%B %Y") |
2667 | 84 |
|
17554 | 85 |
if [ "$VERSION" = "-" ]; then |
86 |
DISTIDENT="Isabelle_$DATE" |
|
87 |
[ -z "$DISTNAME" ] && DISTNAME="$DISTIDENT" |
|
9797 | 88 |
DISTVERSION="$DISTNAME" |
89 |
EXPORT="cvs -f -q checkout -P -d $DISTNAME isabelle" |
|
17558 | 90 |
UNOFFICIAL=true |
2667 | 91 |
else |
17554 | 92 |
DISTIDENT="$VERSION" |
93 |
[ -z "$DISTNAME" ] && DISTNAME="$DISTIDENT" |
|
4982 | 94 |
DISTVERSION="$DISTNAME: $DISTDATE" |
17561 | 95 |
EXPORT="cvs -f -q export -r $VERSION -d $DISTNAME isabelle" |
2667 | 96 |
UNOFFICIAL="" |
97 |
fi |
|
98 |
||
9797 | 99 |
DISTBASE="$DISTPREFIX/dist-$DISTNAME" |
100 |
mkdir -p "$DISTBASE" || fail "Unable to create distribution base dir $DISTBASE!" |
|
101 |
[ -e "$DISTBASE/$DISTNAME" ] && fail "$DISTBASE/$DISTNAME already exists!" |
|
102 |
[ -e "$DISTBASE/pdf/$DISTNAME" ] && fail "$DISTBASE/pdf/$DISTNAME already exists!" |
|
2667 | 103 |
|
104 |
||
9797 | 105 |
# export repository |
2667 | 106 |
|
9797 | 107 |
echo "###" |
17554 | 108 |
echo "### Exporting $DISTIDENT ..." |
9797 | 109 |
echo "###" |
2667 | 110 |
|
9797 | 111 |
cd "$DISTBASE" |
2667 | 112 |
|
13230
c5fad3c40d45
fail more gracefully, return proper exit codes, allow preset DISTPREFIX
kleing
parents:
13100
diff
changeset
|
113 |
$EXPORT || fail "Export failed!" |
15438 | 114 |
|
115 |
if [ -n "$CVS2CL" ]; then |
|
116 |
cd $DISTNAME |
|
117 |
$CVS2CL |
|
118 |
gzip ChangeLog |
|
119 |
mv ChangeLog.gz .. |
|
120 |
cd .. |
|
121 |
fi |
|
122 |
||
9920
9734f2717203
improved WWW page generation (still somewhat experimental);
wenzelm
parents:
9880
diff
changeset
|
123 |
$FIND . -name CVS -print | xargs rm -rf |
12986 | 124 |
$FIND . -name .cvsignore -print | xargs rm -rf |
17554 | 125 |
$FIND . "(" -name \*.thy -o -name \*.ML ")" -perm +111 -print | xargs chmod -x |
2667 | 126 |
|
127 |
||
9797 | 128 |
# build docs |
2667 | 129 |
|
9797 | 130 |
echo "###" |
131 |
echo "### Building docs ..." |
|
132 |
echo "###" |
|
133 |
||
134 |
cd "$DISTBASE/$DISTNAME/Doc" |
|
6630 | 135 |
PDFLATEX=$(type -path pdflatex) |
3169 | 136 |
|
137 |
for DOC in $(cat Contents) |
|
2667 | 138 |
do |
9797 | 139 |
cd "$DOC" |
13230
c5fad3c40d45
fail more gracefully, return proper exit codes, allow preset DISTPREFIX
kleing
parents:
13100
diff
changeset
|
140 |
make dvi || fail "DVI document for $DOC failed!" |
17554 | 141 |
{ [ -n "$PDFLATEX" ] && make clean pdf; } || fail "PDF document for $DOC failed!" |
3169 | 142 |
cd .. |
2667 | 143 |
done |
144 |
||
9052 | 145 |
|
9920
9734f2717203
improved WWW page generation (still somewhat experimental);
wenzelm
parents:
9880
diff
changeset
|
146 |
# prepare dist dir for release |
8059 | 147 |
|
9920
9734f2717203
improved WWW page generation (still somewhat experimental);
wenzelm
parents:
9880
diff
changeset
|
148 |
echo "###" |
9734f2717203
improved WWW page generation (still somewhat experimental);
wenzelm
parents:
9880
diff
changeset
|
149 |
echo "### Preparing distribution ..." |
9734f2717203
improved WWW page generation (still somewhat experimental);
wenzelm
parents:
9880
diff
changeset
|
150 |
echo "###" |
2667 | 151 |
|
17554 | 152 |
cd "$DISTBASE/$DISTNAME" || fail "No dist directory: $DISTBASE/$DISTNAME" |
2667 | 153 |
|
16301 | 154 |
cp -R Admin/website .. |
155 |
mkdir -p ../website/conf |
|
17942
68988fd2fd27
towards an improved website/makedist integration
haftmann
parents:
17910
diff
changeset
|
156 |
cat > ../website/conf/distinfo.mak <<EOF |
68988fd2fd27
towards an improved website/makedist integration
haftmann
parents:
17910
diff
changeset
|
157 |
# this is a generated file - do not edit unless you know what you are doing! |
16301 | 158 |
|
159 |
DISTNAME=$DISTNAME |
|
17554 | 160 |
DISTIDENT=$DISTIDENT |
17910 | 161 |
DISTBASE=$DISTBASE |
16301 | 162 |
EOF |
9920
9734f2717203
improved WWW page generation (still somewhat experimental);
wenzelm
parents:
9880
diff
changeset
|
163 |
|
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') |
6630 | 165 |
mv -f $MOVE Distribution/doc |
3305 | 166 |
rm Distribution/doc/Isa-logics.eps |
9052 | 167 |
rm -rf Doc Tools |
2667 | 168 |
|
7115 | 169 |
mkdir src contrib |
2667 | 170 |
mv $LOGICS src |
171 |
||
172 |
mv Distribution/* . |
|
173 |
rmdir Distribution |
|
174 |
||
13230
c5fad3c40d45
fail more gracefully, return proper exit codes, allow preset DISTPREFIX
kleing
parents:
13100
diff
changeset
|
175 |
( cd lib/browser; make; ) || fail "Graph browser build failed!" |
3638 | 176 |
|
5385 | 177 |
cp doc/isabelle*.eps lib/logo |
178 |
||
3638 | 179 |
|
2667 | 180 |
if [ -n "$UNOFFICIAL" ]; then |
181 |
{ |
|
182 |
echo |
|
183 |
echo "IMPORTANT NOTE" |
|
184 |
echo "==============" |
|
185 |
echo |
|
17554 | 186 |
echo "This is an unofficial release of Isabelle, created by $LOGNAME $DATE." |
2667 | 187 |
echo |
9925 | 188 |
} >ANNOUNCE |
2667 | 189 |
fi |
190 |
||
8810 | 191 |
perl -pi -e "s/{ISABELLE}/$DISTNAME/g;" lib/html/index.html |
17554 | 192 |
perl -pi -e "s/Isabelle repository version/$DISTVERSION/" src/Pure/ROOT.ML lib/Tools/version |
4986 | 193 |
perl -pi -e "s/the internal repository version of Isabelle/$DISTVERSION/" README.html |
3257 | 194 |
lynx -dump README.html >README |
195 |
||
9052 | 196 |
( cd src; ../Admin/maketags; ) |
10077 | 197 |
|
9052 | 198 |
rm -rf Admin |
16286 | 199 |
rm -f TODO |
9052 | 200 |
|
2667 | 201 |
|
202 |
# create archive |
|
203 |
||
9797 | 204 |
echo "###" |
205 |
echo "### Creating archives ..." |
|
206 |
echo "###" |
|
2667 | 207 |
|
9797 | 208 |
cd "$DISTBASE" |
209 |
||
10087 | 210 |
echo "$DISTBASE/$DISTNAME.tar.gz" > ../ISABELLE_DIST |
211 |
||
10068 | 212 |
rm -f Isabelle |
213 |
ln -s "$DISTNAME" Isabelle |
|
214 |
||
9797 | 215 |
chown -R "$LOGNAME" "$DISTNAME" |
216 |
chmod -R u+w "$DISTNAME" |
|
217 |
chmod -R g=o "$DISTNAME" |
|
10077 | 218 |
chgrp -R isabelle "$DISTNAME" Isabelle |
2667 | 219 |
|
9797 | 220 |
mkdir -p "pdf/$DISTNAME/doc" |
17655 | 221 |
mv "$DISTNAME/doc/"*.pdf "pdf/$DISTNAME/doc" |
222 |
||
223 |
sync; sleep 3 |
|
6748 | 224 |
|
10096 | 225 |
echo "$DISTNAME.tar.gz" |
10077 | 226 |
"$TAR" cf "$DISTNAME.tar" Isabelle "$DISTNAME" |
10096 | 227 |
gzip "$DISTNAME.tar" |
228 |
||
229 |
echo "${DISTNAME}_pdf.tar.gz" |
|
10112 | 230 |
( cd pdf; "$TAR" cf "../${DISTNAME}_pdf.tar" "$DISTNAME"; ) |
10096 | 231 |
gzip "${DISTNAME}_pdf.tar" |
6748 | 232 |
|
17655 | 233 |
mv "pdf/$DISTNAME/doc/"*.pdf "$DISTNAME/doc" |
9797 | 234 |
rmdir "pdf/$DISTNAME/doc" "pdf/$DISTNAME" pdf |
6750 | 235 |
|
6304 | 236 |
|
9782 | 237 |
# cleanup dist |
238 |
||
9797 | 239 |
mv "$DISTNAME" "${DISTNAME}-old" |
240 |
mkdir "$DISTNAME" |
|
9782 | 241 |
|
16328 | 242 |
mv "${DISTNAME}-old/README.html" "${DISTNAME}-old/INSTALL" "${DISTNAME}-old/NEWS" \ |
17554 | 243 |
"${DISTNAME}-old/ANNOUNCE" "${DISTNAME}-old/COPYRIGHT" "${DISTNAME}-old/CONTRIBUTORS" \ |
244 |
"$DISTNAME" |
|
9797 | 245 |
mkdir "$DISTNAME/doc" |
17655 | 246 |
mv "${DISTNAME}-old/doc/"*.pdf "${DISTNAME}-old/doc/Contents" "$DISTNAME/doc" |
9782 | 247 |
|
9867 | 248 |
chgrp -R isabelle "$DISTNAME" |
249 |
||
9797 | 250 |
rm -rf "${DISTNAME}-old" |
9782 | 251 |
|
252 |
||
2667 | 253 |
# final note |
254 |
||
9797 | 255 |
echo "###" |
10112 | 256 |
echo "### Finished makedist." |
9797 | 257 |
echo "###" |