chiark / gitweb /
add a comment relating to debugging using Monkey
[jarrg-ian.git] / build-sh
1 #!/bin/bash
2 #
3 # We don't supply a Makefile.  Instead, we just supply this shell script.
4
5 set -e
6
7 case "$#.$1" in
8 0.)     ;;
9 *.-*)   echo >&2 'no options allowed'; exit 1;;
10 *)      echo >&2 'no arguments allowed'; exit 1;;
11 esac
12
13 : ${JAVA_HOME:=/usr/lib/jvm/java-6-sun}
14 export JAVA_HOME
15
16 revision=`git describe --always || echo '(unknown revision)'`
17 if [ x"`git diff 2>/dev/null || echo x`" != x ]; then
18         revision="$revision-local"
19 fi
20
21 cat >src/net/chiark/yarrg/Version.java <<END
22   package net.chiark.yarrg;
23   public class Version {
24       public final static String version = "$revision";
25   }
26 END
27 rm -f src/build/net/chiark/yarrg/Version.class
28 rm -f src/build/net/chiark/yarrg/ControlPanel.class
29 rm -f src/build/net/chiark/yarrg/MarketUploader.class
30 rm -f *.jar
31
32 cd src
33 ant -f Jarrg.xml
34 cd ..
35
36 echo "
37 Building tarballs
38 "
39
40 tarball () {
41         output=$1; shift
42         GZIP='-9v --rsyncable' tar --exclude=\*{~,.tar.gz,.exe} --exclude='#*#' \
43           --transform='s/^./jarrg/' --exclude={src/build,tmp} "$@" \
44           -zcf "$output" .
45 }
46
47 tarball jarrg-source.tar.gz
48
49 tarball jarrg-linux.tar.gz \
50   --exclude={.git*,src,accessibility.properties,build-sh} \
51
52 files='jarrg-source.tar.gz jarrg-linux.tar.gz jarrg-setup.exe'
53
54 echo "
55 Generated OK:
56 "
57 ls -al $files
58
59 pubbase="${JARRG_PUBLISH_BASE-login.chiark.greenend.org.uk}"
60 pubdir="${JARRG_PUBLISH_DIR-/home/yarrgweb/public-html/download/jarrg}"
61
62 echo "
63 Revision: $revision
64
65 Install with:
66  RSYNC_RSH=ssh rsync -vP $files $pubbase:$pubdir/test/
67 "