1#!/bin/bash
2#
3# this script is used to build a source distribution package for the Android emulator
4# the package includes:
5#  - the sources of our patched SDL library
6#  - the sources of our patched QEMU emulator
7#  - appropriate scripts to rebuild the emulator binary
8#
9
10# get absolute path of source directory tree
11CURDIR=`dirname $0`
12TOPDIR=`cd $CURDIR/.. && pwd`
13
14# create temporary directory
15TMPROOT=/tmp/android-package
16DATE=$(date +%Y%m%d)
17PACKAGE=android-emulator-$DATE
18TMPDIR=$TMPROOT/$PACKAGE
19if ! ( rm -rf $TMPROOT && mkdir -p $TMPDIR ) then
20    echo "could not create temporary directory $TMPDIR"
21    exit 3
22fi
23
24# clone the current source tree to $TMPDIR/qemu
25QEMUDIR=$TMPDIR/qemu
26echo "Copying sources to $QEMUDIR"
27cd $TMPDIR && git clone file://$TOPDIR $QEMUDIR && rm -rf $QEMUDIR/.git
28if [ $? != 0 ] ; then
29    echo "Could not clone sources"
30fi
31
32echo "copying control scripts"
33mv $QEMUDIR/distrib/build-emulator.sh $TMPDIR/build-emulator.sh
34mv $QEMUDIR/distrib/README $TMPDIR/README
35
36echo "packaging release into a tarball"
37cd $TMPROOT
38tar cjf $PACKAGE.tar.bz2 $PACKAGE
39
40echo "cleaning up"
41rm -rf $TMPDIR
42
43echo "please grab $TMPROOT/$PACKAGE.tar.bz2"
44