2009-08-29 00:18:43 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
RELEASEDIR=release
|
|
|
|
BUILDDIR=build
|
2009-11-19 06:36:55 +01:00
|
|
|
VERSION=$(hg id -b)
|
|
|
|
REVISION=$(hg id -n)
|
|
|
|
ZIPFILE=$VERSION-$REVISION.zip
|
2009-08-29 00:18:43 +02:00
|
|
|
|
2009-11-17 16:25:26 +01:00
|
|
|
PLUGINFILES="cstrike/*"
|
|
|
|
DOCS="docs/*"
|
2009-11-17 16:57:27 +01:00
|
|
|
DOCS_DEST=$RELEASEDIR/zrdocs
|
2009-08-29 00:18:43 +02:00
|
|
|
PLUGINFILE=zombiereloaded.smx
|
2009-11-17 16:57:27 +01:00
|
|
|
PLUGINDIR=$RELEASEDIR/addons/sourcemod/plugins
|
|
|
|
ZRTOOLS_SOURCE=/home/zrdev/archive/zrtools
|
|
|
|
EXTENSIONDIR=$RELEASEDIR/addons/sourcemod/extensions
|
2009-08-29 00:18:43 +02:00
|
|
|
|
2009-11-18 19:22:17 +01:00
|
|
|
MAKEPATCH=false
|
|
|
|
|
|
|
|
|
|
|
|
# Clean release directory.
|
|
|
|
rm -rf $RELEASEDIR
|
|
|
|
echo "Cleaned release directory."
|
|
|
|
|
|
|
|
|
|
|
|
# Exit if cleaning only.
|
2009-08-29 00:18:43 +02:00
|
|
|
if [ "$1" = "clean" ]
|
|
|
|
then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2009-11-18 19:22:17 +01:00
|
|
|
|
|
|
|
# Check if patch mode is enabled.
|
|
|
|
if [ "$1" = "patch" ]
|
|
|
|
then
|
|
|
|
if [ "$2" ]
|
|
|
|
then
|
|
|
|
MAKEPATCH=true
|
|
|
|
PATCHREV="$2"
|
2009-11-19 06:36:55 +01:00
|
|
|
|
|
|
|
if [ "$2" = $REVISION ]
|
|
|
|
then
|
|
|
|
echo "No changes since base revision."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2009-11-19 06:40:27 +01:00
|
|
|
ZIPFILE=$VERSION-patch-$PATCHREV-$REVISION.zip
|
2009-11-18 19:22:17 +01:00
|
|
|
else
|
|
|
|
echo "Missing base revision number. Usage: build.sh patch <base rev>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2009-11-17 16:57:27 +01:00
|
|
|
# Make release directory.
|
2009-08-29 00:18:43 +02:00
|
|
|
mkdir -p $RELEASEDIR
|
|
|
|
|
2009-11-18 19:22:17 +01:00
|
|
|
|
2009-11-19 06:49:19 +01:00
|
|
|
# Clean and compile plugin.
|
|
|
|
make clean
|
|
|
|
make
|
|
|
|
|
|
|
|
|
2009-08-29 00:18:43 +02:00
|
|
|
# Check if the plugin is built.
|
|
|
|
if [ ! -e $BUILDDIR/$PLUGINFILE ]
|
|
|
|
then
|
2009-11-19 06:49:19 +01:00
|
|
|
echo "Cannot build release package, plugin build failed. Missing file '$BUILDDIR/$PLUGINFILE'."
|
2009-08-29 00:18:43 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2009-11-18 19:22:17 +01:00
|
|
|
# Copy files.
|
2009-11-17 16:57:27 +01:00
|
|
|
echo "Copying documentation..."
|
|
|
|
mkdir -p $DOCS_DEST
|
|
|
|
cp -r $DOCS $DOCS_DEST
|
|
|
|
|
2009-11-18 19:22:17 +01:00
|
|
|
echo "Copying plugin binary..."
|
2009-11-17 16:57:27 +01:00
|
|
|
mkdir -p $PLUGINDIR
|
|
|
|
cp -r $BUILDDIR/$PLUGINFILE $PLUGINDIR/$PLUGINFILE
|
|
|
|
|
2009-11-18 19:22:17 +01:00
|
|
|
if [ $MAKEPATCH = "false" ]
|
|
|
|
then
|
2009-11-18 19:24:09 +01:00
|
|
|
# Copy all files.
|
2009-11-18 19:22:17 +01:00
|
|
|
echo "Copying plugin files..."
|
|
|
|
cp -r $PLUGINFILES $RELEASEDIR
|
|
|
|
|
|
|
|
echo "Copying extension binaries..."
|
|
|
|
mkdir -p $EXTENSIONDIR
|
|
|
|
cp $ZRTOOLS_SOURCE/zrtools.ext.so $EXTENSIONDIR
|
|
|
|
cp $ZRTOOLS_SOURCE/zrtools.ext.dll $EXTENSIONDIR
|
|
|
|
else
|
2009-11-18 19:24:09 +01:00
|
|
|
# Copy only changed files.
|
2009-11-18 19:22:17 +01:00
|
|
|
CHANGEDFILES=$(hg status --rev $PATCHREV | grep "cstrike/" | cut -d ' ' -f2 | cut -d '/' -f2-)
|
|
|
|
|
|
|
|
echo "Copying plugin files..."
|
|
|
|
cd cstrike
|
|
|
|
cp --parents $CHANGEDFILES "../$RELEASEDIR"
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
2009-08-29 00:18:43 +02:00
|
|
|
|
|
|
|
# Make release package.
|
|
|
|
echo "Compressing files..."
|
|
|
|
cd $RELEASEDIR
|
|
|
|
zip -r $ZIPFILE *
|
|
|
|
|
|
|
|
echo "Release package available at $RELEASEDIR/$ZIPFILE."
|