2007-05-19 16:36:50 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Make a new distribution archive. Command line specification of the tag
|
|
|
|
#
|
|
|
|
# For now, just windows. Others will follow.
|
|
|
|
#
|
2007-05-19 16:42:58 +01:00
|
|
|
# Usage will be:
|
|
|
|
#
|
|
|
|
# gitdist ARCH TAG
|
|
|
|
#
|
2007-05-20 12:15:27 +01:00
|
|
|
# ARCH is any of
|
|
|
|
#
|
|
|
|
# linux
|
|
|
|
# w32
|
|
|
|
# mac
|
|
|
|
#
|
|
|
|
# The tag is checked out of the current repository (so it should exist)
|
|
|
|
# and this is used to construct a archive with the binary of the
|
|
|
|
# selected architecture.
|
|
|
|
|
2007-05-20 13:13:38 +01:00
|
|
|
if [ "x$1" = "x" -o "x$2" = "x" ]
|
|
|
|
then
|
|
|
|
echo
|
|
|
|
echo "Scyther binary distribution generator."
|
|
|
|
echo
|
|
|
|
echo " Usage: $0 <arch> <tag>"
|
|
|
|
echo
|
|
|
|
echo "where <arch> is one of linux,w32,mac"
|
|
|
|
echo "and <tag> is any tag in the current git repository."
|
|
|
|
echo
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
ARCH=$1
|
|
|
|
if [ "x$ARCH" = "xlinux" -o "x$ARCH" = "xw32" -o "x$ARCH" = "xmac" ]
|
|
|
|
then
|
|
|
|
echo "Architecture $ARCH detected."
|
|
|
|
else
|
2007-05-20 15:00:41 +01:00
|
|
|
echo "Don't know architecture $ARCH."
|
|
|
|
echo "Please use one of linux,w32,mac"
|
2007-05-20 13:13:38 +01:00
|
|
|
exit
|
|
|
|
fi
|
2007-05-20 12:15:27 +01:00
|
|
|
|
2007-05-20 13:13:38 +01:00
|
|
|
TAG=$2
|
|
|
|
FOUND=`git-tag -l $TAG`
|
|
|
|
if [ "x$TAG" = "x$FOUND" ]
|
|
|
|
then
|
|
|
|
echo "Tag $TAG found."
|
|
|
|
else
|
2007-05-20 15:00:41 +01:00
|
|
|
echo "Don't know tag $TAG, please select one from below:"
|
|
|
|
git-tag -l
|
2007-05-20 13:13:38 +01:00
|
|
|
exit
|
|
|
|
fi
|
2007-05-19 16:36:50 +01:00
|
|
|
|
2007-05-20 12:43:11 +01:00
|
|
|
# Note without extension, this will added later
|
|
|
|
ARCHNAME=scyther-$ARCH-$TAG
|
2007-05-19 16:36:50 +01:00
|
|
|
|
2007-05-20 12:43:11 +01:00
|
|
|
# Directory locations
|
2007-05-20 13:13:38 +01:00
|
|
|
CURDIR=`pwd`
|
2007-05-20 12:43:11 +01:00
|
|
|
DESTDIR=$CURDIR
|
2007-05-19 16:36:50 +01:00
|
|
|
TMPDIR="/tmp"
|
2007-05-20 12:43:11 +01:00
|
|
|
SRCNAME=$ARCHNAME-src
|
2007-05-19 16:36:50 +01:00
|
|
|
|
2007-05-20 12:43:11 +01:00
|
|
|
# Hard coded connections, do not change this (hardcoded in git-archive
|
|
|
|
# usage and archive creation)
|
|
|
|
SRCDIR=$TMPDIR/$SRCNAME
|
|
|
|
BUILDDIR=$TMPDIR/$ARCHNAME
|
2007-05-20 12:15:27 +01:00
|
|
|
|
2007-05-20 12:43:11 +01:00
|
|
|
# Archive destination file without extension
|
2007-05-20 12:15:27 +01:00
|
|
|
DESTFILE=$DESTDIR/$ARCHNAME
|
2007-05-19 17:01:02 +01:00
|
|
|
|
2007-05-20 12:43:11 +01:00
|
|
|
# Internal locations
|
|
|
|
DOCDIR=$SRCDIR/doc/manual
|
|
|
|
MANUAL=scyther-manual.pdf
|
2007-05-19 17:01:02 +01:00
|
|
|
|
2007-05-20 12:43:11 +01:00
|
|
|
rm -rf $SRCDIR
|
|
|
|
rm -rf $BUILDDIR
|
2007-05-19 16:36:50 +01:00
|
|
|
|
2007-05-20 12:43:11 +01:00
|
|
|
# Change into the lower directory (main archive dir)
|
|
|
|
cd .. && git-archive --format=tar --prefix=$SRCNAME/ $TAG | (cd $TMPDIR && tar xf -)
|
2007-05-19 16:36:50 +01:00
|
|
|
|
2007-05-20 12:43:11 +01:00
|
|
|
# Base of the package is the gui directory
|
|
|
|
mv $SRCDIR/gui $BUILDDIR
|
2007-05-19 16:36:50 +01:00
|
|
|
|
2007-05-20 15:14:40 +01:00
|
|
|
# Prepare tag for gui version
|
|
|
|
echo "SCYTHER_GUI_VERSION = \"$TAG\"" >$BUILDDIR/Gui/Version.py
|
|
|
|
|
2007-05-19 16:36:50 +01:00
|
|
|
# Prepare version.h with the correct flag (tag)
|
2007-05-20 15:14:40 +01:00
|
|
|
echo "#define TAGVERSION \"$TAG\"" >$SRCDIR/src/version.h
|
2007-05-20 12:43:11 +01:00
|
|
|
echo "" >>$SRCDIR/src/version.h
|
2007-05-19 16:36:50 +01:00
|
|
|
|
|
|
|
# Manual
|
2007-05-20 12:43:11 +01:00
|
|
|
cp $DOCDIR/$MANUAL $BUILDDIR
|
|
|
|
|
|
|
|
# Change into sources directory
|
|
|
|
cd $SRCDIR/src
|
2007-05-19 16:36:50 +01:00
|
|
|
|
|
|
|
# Default flags
|
|
|
|
CMFLAGS="-D CMAKE_BUILD_TYPE:STRING=Release"
|
2007-05-20 12:15:27 +01:00
|
|
|
if [ $ARCH = "w32" ]
|
|
|
|
then
|
|
|
|
BIN="scyther-w32.exe"
|
|
|
|
cmake $CMFLAGS -D TARGETOS=Win32 . && make
|
|
|
|
|
|
|
|
elif [ $ARCH = "linux" ]
|
|
|
|
then
|
|
|
|
BIN="scyther-linux"
|
|
|
|
cmake $CMFLAGS . && make
|
|
|
|
|
|
|
|
elif [ $ARCH = "mac" ]
|
|
|
|
then
|
|
|
|
# Make for ppc and intel, and combine into universal binary
|
|
|
|
BIN="scyther-mac"
|
|
|
|
cmake $CMFLAGS -D TARGETOS=MacPPC . && make
|
|
|
|
cmake $CMFLAGS -D TARGETOS=MacIntel . && make
|
|
|
|
cmake $CMFLAGS . && make scyther-mac
|
|
|
|
fi
|
2007-05-19 16:36:50 +01:00
|
|
|
|
2007-05-20 12:43:11 +01:00
|
|
|
# Copy the resulting binary to the correct location
|
|
|
|
BINDIR=$BUILDDIR/Scyther/Bin
|
2007-05-19 17:01:02 +01:00
|
|
|
mkdir $BINDIR
|
2007-05-20 12:15:27 +01:00
|
|
|
cp $BIN $BINDIR
|
2007-05-19 16:36:50 +01:00
|
|
|
|
2007-05-20 12:43:11 +01:00
|
|
|
# Compress the whole thing into an archive
|
|
|
|
cd $TMPDIR
|
2007-05-20 12:15:27 +01:00
|
|
|
if [ $ARCH = "w32" ]
|
|
|
|
then
|
|
|
|
DESTARCH=$DESTFILE.zip
|
|
|
|
rm -f $DESTARCH
|
2007-05-20 12:43:11 +01:00
|
|
|
zip -r $DESTARCH $ARCHNAME
|
|
|
|
else
|
2007-05-20 12:15:27 +01:00
|
|
|
DESTARCH=$DESTFILE.tgz
|
|
|
|
rm -f $DESTARCH
|
2007-05-20 12:43:11 +01:00
|
|
|
tar zcvf $DESTARCH $ARCHNAME
|
2007-05-20 12:15:27 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove the temporary working directory
|
2007-05-20 12:43:11 +01:00
|
|
|
rm -rf $BUILDDIR
|
|
|
|
rm -rf $SRCDIR
|
2007-05-19 16:42:58 +01:00
|
|
|
|
2007-05-19 16:36:50 +01:00
|
|
|
|