Added automatic determination of the SVN revision number if a build
[sgt/puzzles] / mkunxarc.sh
CommitLineData
118fcd8b 1#!/bin/sh
2
3# Build a Unix source distribution from the Puzzles SVN area.
4#
5# Pass a numeric argument to have the archive tagged as that SVN
6# revision. Otherwise, the script will work it out itself by
7# calling `svnversion', or failing that it will not version-tag the
8# archive at all.
9
10case "$#" in
11 0)
12 # Ignore errors; if we can't get a version, we'll have a blank
13 # string.
14 rev=`svnversion . 2>/dev/null`
15 ;;
16 *)
17 case "$1" in *[!0-9]*) echo "Malformed revision number '$1'">&2;exit 1;;esac
18 rev="$1"
19 ;;
20esac
21
22if test "x$rev" != "x"; then
23 arcsuffix="-r$rev"
24 ver="-DREVISION=$rev"
25else
26 arcsuffix=
27 ver=
28fi
29
30perl mkfiles.pl
31make -s -f Makefile.doc
32
33arcname="puzzles$arcsuffix"
34mkdir uxarc
35mkdir uxarc/$arcname
36find . -name uxarc -prune -o \
37 -name CVS -prune -o \
38 -name '*.app' -prune -o \
39 -name '.[^.]*' -prune -o \
40 -name . -o \
41 -type d -exec mkdir uxarc/$arcname/{} \;
42find . -name uxarc -prune -o \
43 -name CVS -prune -o \
44 -name '.[^.]*' -prune -o \
45 -name '*.app' -prune -o \
46 -name '*.zip' -prune -o \
47 -name '*.tar.gz' -prune -o \
48 -type f -exec ln -s $PWD/{} uxarc/$arcname/{} \;
49if test "x$ver" != "x"; then
50 (cd uxarc/$arcname;
51 md5sum `find . -name '*.[ch]' -print` > manifest;
52 echo "$ver" > version.def)
53fi
54tar -C uxarc -chzof $arcname.tar.gz $arcname
55rm -rf uxarc