2299e1bb |
1 | #!/bin/bash |
8b4e077f |
2 | |
3 | # Build a Unix source distribution from the PuTTY CVS area. |
4 | # |
5 | # Pass an argument of the form `2004-02-08' to have the archive |
6 | # tagged as a development snapshot; of the form `0.54' to have it |
6cac7502 |
7 | # tagged as a release; of the form `r1234' to have it tagged as a |
8 | # custom build. Otherwise it'll be tagged as unidentified. |
8b4e077f |
9 | |
10 | case "$1" in |
11 | ????-??-??) |
12 | case "$1" in *[!-0-9]*) echo "Malformed snapshot ID '$1'" >&2;exit 1;;esac |
44747c53 |
13 | autoconfver="`cat LATEST.VER`-$1" |
14 | arcsuffix="-$autoconfver" |
8b4e077f |
15 | ver="-DSNAPSHOT=$1" |
6cac7502 |
16 | docver= |
17 | ;; |
18 | r*) |
44747c53 |
19 | autoconfver="$1" |
20 | arcsuffix="-$autoconfver" |
2299e1bb |
21 | ver="-DSVN_REV=${1#r}" |
3b62690e |
22 | docver= |
8b4e077f |
23 | ;; |
24 | '') |
44747c53 |
25 | autoconfver="X.XX" # got to put something in here! |
8b4e077f |
26 | arcsuffix= |
27 | ver= |
3b62690e |
28 | docver= |
8b4e077f |
29 | ;; |
479fb463 |
30 | *pre) |
31 | set -- "${1%pre}" "$2" |
32 | case "$1" in *[!.0-9a-z~]*) echo "Malformed prerelease ID '$1'">&2;exit 1;;esac |
33 | case "$2" in *[!.0-9a-z~]*) echo "Malformed prerelease revision '$1'">&2;exit 1;;esac |
34 | autoconfver="$1~pre$2" |
35 | arcsuffix="-$autoconfver" |
36 | ver="-DPRERELEASE=$1 -DSVN_REV=$2" |
37 | docver="VERSION=\"PuTTY prerelease $1:r$2\"" |
38 | ;; |
8b4e077f |
39 | *) |
479fb463 |
40 | case "$1" in *[!.0-9a-z~]*) echo "Malformed release ID '$1'">&2;exit 1;;esac |
44747c53 |
41 | autoconfver="$1" |
42 | arcsuffix="-$autoconfver" |
8b4e077f |
43 | ver="-DRELEASE=$1" |
3b62690e |
44 | docver="VERSION=\"PuTTY release $1\"" |
8b4e077f |
45 | ;; |
46 | esac |
47 | |
48 | perl mkfiles.pl |
3b62690e |
49 | (cd doc && make -s ${docver:+"$docver"}) |
8b4e077f |
50 | |
51 | relver=`cat LATEST.VER` |
52 | arcname="putty$arcsuffix" |
53 | mkdir uxarc |
54 | mkdir uxarc/$arcname |
2ce79856 |
55 | find . -name uxarc -prune -o \ |
56 | -name CVS -prune -o \ |
57 | -name .svn -prune -o \ |
58 | -name . -o \ |
8b4e077f |
59 | -type d -exec mkdir uxarc/$arcname/{} \; |
60 | find . -name uxarc -prune -o \ |
61 | -name CVS -prune -o \ |
62 | -name .cvsignore -prune -o \ |
4494be0a |
63 | -name .svn -prune -o \ |
44747c53 |
64 | -name configure.ac -prune -o \ |
8b4e077f |
65 | -name '*.zip' -prune -o \ |
66 | -name '*.tar.gz' -prune -o \ |
67 | -type f -exec ln -s $PWD/{} uxarc/$arcname/{} \; |
68 | if test "x$ver" != "x"; then |
69 | (cd uxarc/$arcname; |
70 | md5sum `find . -name '*.[ch]' -print` > manifest; |
71 | echo "$ver" > version.def) |
72 | fi |
44747c53 |
73 | sed "s/^AC_INIT(putty,.*/AC_INIT(putty, $autoconfver)/" unix/configure.ac > uxarc/$arcname/unix/configure.ac |
74 | (cd uxarc/$arcname && sh mkauto.sh) 2>errors || { cat errors >&2; exit 1; } |
75 | |
a8a420c5 |
76 | tar -C uxarc -chzof $arcname.tar.gz $arcname |
8b4e077f |
77 | rm -rf uxarc |