2009-08-29 00:18:43 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2009-12-23 18:24:55 +01:00
|
|
|
VERSION="zombiereloaded-3.0-b2"
|
2009-11-19 06:36:55 +01:00
|
|
|
REVISION=$(hg id -n)
|
2009-12-26 22:00:30 +01:00
|
|
|
|
2009-12-28 04:47:01 +01:00
|
|
|
SYNTAX="Usage: $0 [--patch <base rev>]"
|
|
|
|
|
2009-12-26 22:00:30 +01:00
|
|
|
# Source paths
|
|
|
|
BUILDDIR=build
|
|
|
|
PLUGINFILE=zombiereloaded.smx
|
|
|
|
PLUGINFILES="cstrike/*"
|
|
|
|
ZRTOOLS_SOURCE=/home/zrdev/archive/zrtools
|
|
|
|
DOCS="docs/*"
|
|
|
|
SOURCEDIR="src/*"
|
|
|
|
|
|
|
|
# Destination paths
|
|
|
|
RELEASEDIR=release
|
|
|
|
SOURCE_DEST=$RELEASEDIR/addons/sourcemod/scripting
|
|
|
|
DOCS_DEST=$RELEASEDIR/zrdocs
|
|
|
|
PLUGINDIR=$RELEASEDIR/addons/sourcemod/plugins
|
2009-11-17 16:57:27 +01:00
|
|
|
EXTENSIONDIR=$RELEASEDIR/addons/sourcemod/extensions
|
2009-12-26 21:36:50 +01:00
|
|
|
ZIPFILE=$VERSION-r$REVISION.zip
|
2009-08-29 00:18:43 +02:00
|
|
|
|
2009-11-18 19:22:17 +01:00
|
|
|
MAKEPATCH=false
|
|
|
|
|
2009-12-23 18:54:59 +01:00
|
|
|
# Clean build and release directory.
|
|
|
|
make clean
|
2009-11-18 19:22:17 +01:00
|
|
|
rm -rf $RELEASEDIR
|
2009-12-23 18:54:59 +01:00
|
|
|
echo "Cleaned build and release directory."
|
2009-11-18 19:22:17 +01:00
|
|
|
|
|
|
|
# Exit if cleaning only.
|
2009-12-28 04:47:01 +01:00
|
|
|
if [ "$1" = "--clean" ]
|
2009-08-29 00:18:43 +02:00
|
|
|
then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2009-11-18 19:22:17 +01:00
|
|
|
# Check if patch mode is enabled.
|
2009-12-28 04:47:01 +01:00
|
|
|
if [ "$1" = "--patch" ]
|
2009-11-18 19:22:17 +01:00
|
|
|
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-12-23 18:22:16 +01:00
|
|
|
ZIPFILE=$VERSION-patch-r$PATCHREV-r$REVISION.zip
|
2009-11-18 19:22:17 +01:00
|
|
|
else
|
2009-12-28 04:47:01 +01:00
|
|
|
echo "Missing base revision number. $SYNTAX"
|
2009-11-18 19:22:17 +01:00
|
|
|
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-12-23 18:54:59 +01:00
|
|
|
# Compile plugin.
|
2009-11-19 06:49:19 +01:00
|
|
|
make
|
|
|
|
|
2009-08-29 00:18:43 +02:00
|
|
|
# Check if the plugin is built.
|
|
|
|
if [ ! -e $BUILDDIR/$PLUGINFILE ]
|
|
|
|
then
|
2009-12-28 04:47:01 +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-12-26 21:27:22 +01:00
|
|
|
# Rebuild hgversion.h.inc for unofficial builds.
|
|
|
|
sh updateversion.sh --unofficial
|
|
|
|
|
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-12-28 04:47:01 +01:00
|
|
|
# Make diff file with changes since base revision.
|
|
|
|
sh changes.sh $PATCHREV "tip"
|
|
|
|
|
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-12-28 04:47:01 +01:00
|
|
|
# Copy files.
|
|
|
|
echo "Copying plugin binary..."
|
|
|
|
mkdir -p $PLUGINDIR
|
|
|
|
cp -r $BUILDDIR/$PLUGINFILE $PLUGINDIR/$PLUGINFILE
|
|
|
|
|
|
|
|
echo "Copying plugin source code..."
|
|
|
|
mkdir -p $SOURCE_DEST
|
|
|
|
cp -r $SOURCEDIR $SOURCE_DEST
|
|
|
|
|
|
|
|
echo "Copying documentation..."
|
|
|
|
mkdir -p $DOCS_DEST
|
|
|
|
cp -r $DOCS $DOCS_DEST
|
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."
|