2012-04-14 05:03:29 +02:00
|
|
|
#!/bin/bash
|
2012-04-14 11:53:32 +02:00
|
|
|
# generates otclient zip package for win32
|
2012-04-14 05:03:29 +02:00
|
|
|
# by edubart :)
|
|
|
|
|
2012-04-14 11:53:32 +02:00
|
|
|
# TODO: the following options
|
|
|
|
# --gitroot <giturl> - clone a different url, the default is git://github.com/edubart/otclient.git
|
|
|
|
# --platform <platform> - compile for i486-mingw32, i586-msvc-mingw32 or linux
|
|
|
|
# --branch <branch> - use sources from a specific branch, the default is master
|
|
|
|
# --name <name> - change .exe and folder name, the default is otclient
|
|
|
|
# --protocol <proto> - game protocol, the default is 860
|
|
|
|
# --suffix <suffix> - override suffix, the default is the date
|
|
|
|
# --copy-tibiafiles <folder> - copy Tibia.spr and Tibia.dat from folder
|
|
|
|
# --github-upload <url> - upload the zip to github
|
|
|
|
# --scp-upload <url> - upload the zip to a shell via scp
|
|
|
|
|
2012-04-14 05:03:29 +02:00
|
|
|
gitroot="git://github.com/edubart/otclient.git"
|
2012-04-14 11:53:32 +02:00
|
|
|
name="otclient"
|
|
|
|
protocol=860
|
|
|
|
platform="i486-mingw32"
|
|
|
|
tibiafiles_folder="$HOME/projects/otclient/modules/game_tibiafiles"
|
2012-04-14 05:03:29 +02:00
|
|
|
upload_to="root@myserver.com:/var/www/downloads/"
|
|
|
|
pkg_suffix="-snapshot-`date +%Y%m%d`-protocol${protocol}-win32"
|
|
|
|
use_spr=false
|
|
|
|
upload=false
|
|
|
|
make_jobs=8
|
|
|
|
|
|
|
|
srcdir=`pwd`
|
2012-04-14 11:53:32 +02:00
|
|
|
if [ -d $name ]; then
|
|
|
|
cd $name
|
2012-04-14 05:03:29 +02:00
|
|
|
git pull || exit
|
|
|
|
else
|
2012-04-14 11:53:32 +02:00
|
|
|
git clone $gitroot $name || exit
|
|
|
|
cd $name
|
2012-04-14 05:03:29 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
gitdir=`pwd`
|
|
|
|
revision=`git describe --dirty --always`
|
|
|
|
|
|
|
|
#rm -rf build
|
|
|
|
if [ -d build ]; then
|
|
|
|
cd build
|
|
|
|
else
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
|
|
|
|
2012-04-14 11:53:32 +02:00
|
|
|
cmake -DCMAKE_TOOLCHAIN_FILE=$gitdir/src/framework/cmake/${platform}_toolchain.cmake \
|
2012-04-14 05:03:29 +02:00
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DBUILD_REVISION=$revision \
|
2012-04-27 22:21:11 +02:00
|
|
|
-DBOT_PROTECTION=OFF \
|
2012-04-14 05:03:29 +02:00
|
|
|
-DPROTOCOL=$protocol \
|
|
|
|
.. || exit
|
|
|
|
fi
|
|
|
|
|
2012-04-14 11:53:32 +02:00
|
|
|
make "-j${make_jobs}" || exit
|
2012-04-14 05:03:29 +02:00
|
|
|
|
|
|
|
|
2012-04-14 11:53:32 +02:00
|
|
|
pkgdir="$name$pkg_suffix"
|
2012-04-14 05:03:29 +02:00
|
|
|
pkgzip="$pkgdir.zip"
|
|
|
|
|
|
|
|
cd $srcdir
|
|
|
|
rm -rf $pkgdir
|
|
|
|
mkdir $pkgdir
|
|
|
|
cd $pkgdir
|
|
|
|
|
|
|
|
cp -R $gitdir/modules .
|
2012-04-14 11:53:32 +02:00
|
|
|
cp $gitdir/build/*.exe .
|
|
|
|
cp $gitdir/build/*.map .
|
2012-04-14 05:03:29 +02:00
|
|
|
cp $gitdir/LICENSE .
|
|
|
|
cp $gitdir/README.rdoc .
|
|
|
|
|
|
|
|
if $use_spr; then
|
|
|
|
cp $dat_folder/*.spr modules/game_tibiafiles/
|
|
|
|
cp $dat_folder/*.dat modules/game_tibiafiles/
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $srcdir
|
|
|
|
rm -f $pkgzip
|
|
|
|
zip -9 -qr $pkgzip $pkgdir
|
|
|
|
|
|
|
|
echo "Package generated to $pkgzip"
|
|
|
|
|
|
|
|
if $upload; then
|
|
|
|
scp $srcdir/$pkgzip $upload_to
|
|
|
|
fi
|
|
|
|
|
|
|
|
|