diff --git a/build.sh b/build.sh index 27f1b08..0db3d50 100644 --- a/build.sh +++ b/build.sh @@ -3,6 +3,8 @@ VERSION="zombiereloaded-3.0-b2" REVISION=$(hg id -n) +SYNTAX="Usage: $0 [--patch ]" + # Source paths BUILDDIR=build PLUGINFILE=zombiereloaded.smx @@ -21,22 +23,19 @@ ZIPFILE=$VERSION-r$REVISION.zip MAKEPATCH=false - # Clean build and release directory. make clean rm -rf $RELEASEDIR echo "Cleaned build and release directory." - # Exit if cleaning only. -if [ "$1" = "clean" ] +if [ "$1" = "--clean" ] then exit 0 fi - # Check if patch mode is enabled. -if [ "$1" = "patch" ] +if [ "$1" = "--patch" ] then if [ "$2" ] then @@ -51,44 +50,27 @@ then ZIPFILE=$VERSION-patch-r$PATCHREV-r$REVISION.zip else - echo "Missing base revision number. Usage: build.sh patch " + echo "Missing base revision number. $SYNTAX" exit 1 fi fi - # Make release directory. mkdir -p $RELEASEDIR - # Compile plugin. make - # Check if the plugin is built. if [ ! -e $BUILDDIR/$PLUGINFILE ] then - echo "Cannot build release package, plugin build failed. Missing file '$BUILDDIR/$PLUGINFILE'." + echo "Cannot build release package, plugin build failed. Missing file $BUILDDIR/$PLUGINFILE." exit 1 fi # Rebuild hgversion.h.inc for unofficial builds. sh updateversion.sh --unofficial - -# Copy files. -echo "Copying documentation..." -mkdir -p $DOCS_DEST -cp -r $DOCS $DOCS_DEST - -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 - if [ $MAKEPATCH = "false" ] then # Copy all files. @@ -100,6 +82,9 @@ then cp $ZRTOOLS_SOURCE/zrtools.ext.so $EXTENSIONDIR cp $ZRTOOLS_SOURCE/zrtools.ext.dll $EXTENSIONDIR else + # Make diff file with changes since base revision. + sh changes.sh $PATCHREV "tip" + # Copy only changed files. CHANGEDFILES=$(hg status --rev $PATCHREV | grep "cstrike/" | cut -d ' ' -f2 | cut -d '/' -f2-) @@ -109,6 +94,18 @@ else cd .. fi +# 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 # Make release package. echo "Compressing files..." diff --git a/changes.sh b/changes.sh new file mode 100644 index 0000000..b7bb3c3 --- /dev/null +++ b/changes.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +SYNTAX="Usage: $0 " + +if [ "$1" ] +then + BASEREV="$1" + + if [ "$2" ] + then + TARGETREV="$2" + else + echo "Missing target revision. $SYNTAX" + exit 1 + fi +else + echo "$SYNTAX" + exit 1 +fi + +hg diff -r $BASEREV -r $TARGETREV cstrike/cfg/* cstrike/addons/sourcemod/* > docs/changes.diff