From 4ed105a27de29cbe93d57935f06943f0827abef1 Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Wed, 2 Apr 2014 22:43:32 +0200 Subject: [PATCH] Add ghostpp (GHost++) --- .SRCINFO | 36 ++++++++++++++++ Blizzard.j.patch | 18 ++++++++ PKGBUILD | 110 +++++++++++++++++++++++++++++++++++++++++++++++ common.j.patch | 18 ++++++++ config.patch | 62 ++++++++++++++++++++++++++ ghostpp.install | 23 ++++++++++ ghostpp.service | 12 ++++++ libboost.patch | 13 ++++++ 8 files changed, 292 insertions(+) create mode 100644 .SRCINFO create mode 100644 Blizzard.j.patch create mode 100644 PKGBUILD create mode 100644 common.j.patch create mode 100644 config.patch create mode 100644 ghostpp.install create mode 100644 ghostpp.service create mode 100644 libboost.patch diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..b99f114a8782 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,36 @@ +pkgbase = ghostpp + pkgdesc = GHost++ is a Warcraft III hosting bot + pkgver = 17.1_r602 + pkgrel = 1 + url = https://www.ghostpp.com/ + install = ghostpp.install + arch = i686 + arch = x86_64 + license = Apache + makedepends = boost + depends = boost-libs + depends = gmp + depends = libmysqlclient + source = svn+http://ghostplusplus.googlecode.com/svn/trunk@602 + source = ghostpp.install + source = ghostpp.service + source = http://bhfiles.com/files/Battle.net/Bots/Hashes/WAR3.zip + source = common.j.orig::http://wiki.thehelper.net/w/index.php?title=Template:import/wc3/jass/common.j&action=raw + source = Blizzard.j.orig::http://wiki.thehelper.net/w/index.php?title=Template:import/wc3/jass/Blizzard.j&action=raw + source = config.patch + source = libboost.patch + source = common.j.patch + source = Blizzard.j.patch + sha256sums = SKIP + sha256sums = 5d933d698513800f19dcefe47e3640cb37df7d5330908e7424cb891381c6d812 + sha256sums = 2f67fbb67bf19621c112bc41503627aadc995a9414312274956dadbacb520826 + sha256sums = 94d0cf497aacd413f31ac512e8ebb3a71ace6c5646d55a1c77f78d56a11719a9 + sha256sums = e580248f186886a2633d96b2c538e036ff2021a21b97d775d1da5095852f8476 + sha256sums = 066b48dc4966b9a367ebb76efb969248ad49dca8b188d5c79c1465a4d3605891 + sha256sums = 67a388943cd00158e669a982caa5f5d4b2768b91341a3ed916700c10983ab59d + sha256sums = 69b4b5bbfc49bbf6863ab8ab0c5e253b33953ea61e8c45472159493270d3391f + sha256sums = 0e9f8c76879f5cee9a1edca1907bda190da124ccdee924de6cc0a965dbec0e76 + sha256sums = 8e6dca297cf261ae33ad8428b233e2619a6ffdd3dc32b65743d74789c9802d16 + +pkgname = ghostpp + diff --git a/Blizzard.j.patch b/Blizzard.j.patch new file mode 100644 index 000000000000..39f1c6b7a860 --- /dev/null +++ b/Blizzard.j.patch @@ -0,0 +1,18 @@ +--- Blizzard.j.orig 2014-03-31 13:52:49.020265979 +0200 ++++ Blizzard.j 2014-03-31 13:53:21.276455809 +0200 +@@ -1,8 +1,4 @@ +-Imported data for [[Blizzard.j]] +-{{DISPLAYTITLE:Blizzard.j}} +-{{JassSysSnip +-| system=Blizzard.j +-| code=//=========================================================================== ++//=========================================================================== + // Blizzard.j ( define Jass2 functions that need to be in every map script ) + //=========================================================================== + +@@ -10233,4 +10229,3 @@ + endfunction + + }} +- +\ No newline at end of file diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..b97a68933934 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,110 @@ +# Maintainer: heinrich5991 +pkgname=ghostpp +pkgver=17.1_r602 +pkgrel=1 +pkgdesc="GHost++ is a Warcraft III hosting bot" +url="https://www.ghostpp.com/" +arch=('i686' 'x86_64') +license=('Apache') +depends=('boost-libs' + 'gmp' + 'libmysqlclient') +#optdepends=() +makedepends=('boost') +install=ghostpp.install +source=("svn+http://ghostplusplus.googlecode.com/svn/trunk@602" + "ghostpp.install" + "ghostpp.service" + "http://bhfiles.com/files/Battle.net/Bots/Hashes/WAR3.zip" + "common.j.orig::http://wiki.thehelper.net/w/index.php?title=Template:import/wc3/jass/common.j&action=raw" + "Blizzard.j.orig::http://wiki.thehelper.net/w/index.php?title=Template:import/wc3/jass/Blizzard.j&action=raw" + "config.patch" + "libboost.patch" + "common.j.patch" + "Blizzard.j.patch") +sha256sums=('SKIP' + '5d933d698513800f19dcefe47e3640cb37df7d5330908e7424cb891381c6d812' + '2f67fbb67bf19621c112bc41503627aadc995a9414312274956dadbacb520826' + '94d0cf497aacd413f31ac512e8ebb3a71ace6c5646d55a1c77f78d56a11719a9' + 'e580248f186886a2633d96b2c538e036ff2021a21b97d775d1da5095852f8476' + '066b48dc4966b9a367ebb76efb969248ad49dca8b188d5c79c1465a4d3605891' + '67a388943cd00158e669a982caa5f5d4b2768b91341a3ed916700c10983ab59d' + '69b4b5bbfc49bbf6863ab8ab0c5e253b33953ea61e8c45472159493270d3391f' + '0e9f8c76879f5cee9a1edca1907bda190da124ccdee924de6cc0a965dbec0e76' + '8e6dca297cf261ae33ad8428b233e2619a6ffdd3dc32b65743d74789c9802d16') + +GHOSTDIR="trunk@602" + +patch_once() { + PATCHFILE="$(mktemp)" + cat > "$PATCHFILE" + + if ! patch --silent --force --reverse --dry-run $@ < "$PATCHFILE"; then + patch --silent --force --forward $@ < "$PATCHFILE" + return + fi +} + +prepare() { + cd "$srcdir"/ + cp common.j.orig common.j + cp Blizzard.j.orig Blizzard.j + + patch -p0 --force --forward common.j common.j.patch + patch -p0 --force --forward Blizzard.j Blizzard.j.patch + + cd "$srcdir"/"$GHOSTDIR"/ + patch_once -p0 < "$srcdir"/libboost.patch + patch_once -p0 < "$srcdir"/config.patch +} + +build() { + cd "$srcdir"/"$GHOSTDIR"/ + + (cd bncsutil/src/bncsutil/; make) # bncsutil + (cd StormLib/stormlib/; make) # stormlib + (cd ghost/; make) # ghost++ itself +} + +package() { + cd "$srcdir"/"$GHOSTDIR"/ + + install -d "$pkgdir"/etc/ghostpp/ + install -d "$pkgdir"/etc/ghostpp/languages/ + install -d "$pkgdir"/usr/bin/ + install -d "$pkgdir"/usr/lib/ + install -d "$pkgdir"/usr/lib/systemd/system/ + install -d "$pkgdir"/usr/share/doc/ghostpp/ + install -d "$pkgdir"/usr/share/ghostpp/ + install -d "$pkgdir"/var/lib/ghostpp/maps/ + install -d "$pkgdir"/var/lib/ghostpp/mapcfgs/ + install -d "$pkgdir"/var/lib/ghostpp/replays/ + install -d "$pkgdir"/var/lib/ghostpp/savegames/ + + install -m755 ghost/ghost++ "$pkgdir"/usr/bin/ + install -m644 ../ghostpp.service "$pkgdir"/usr/lib/systemd/system/ + + install -m644 bncsutil/src/bncsutil/libbncsutil.so StormLib/stormlib/libStorm.so "$pkgdir"/usr/lib/ + install -m644 readme.txt "$pkgdir"/usr/share/doc/ghostpp/ + install -m644 ../game.dll ../Storm.dll ../war3.exe "$pkgdir"/usr/share/ghostpp/ + install -m644 ../common.j ../Blizzard.j "$pkgdir"/var/lib/ghostpp/mapcfgs/ + install -m644 mapcfgs/wormwar.cfg "$pkgdir"/var/lib/ghostpp/mapcfgs/ + install -m644 ip-to-country.csv "$pkgdir"/var/lib/ghostpp/ + + # configs + install -m644 default.cfg "$pkgdir"/etc/ghostpp/ghost.cfg + install -m644 ipblacklist.txt "$pkgdir"/etc/ghostpp/ipblacklist + install -m644 gameloaded.txt "$pkgdir"/etc/ghostpp/gameloaded + install -m644 gameover.txt "$pkgdir"/etc/ghostpp/gameover + touch "$pkgdir"/etc/ghostpp/motd + + # languages + install -m644 language.cfg "$pkgdir"/etc/ghostpp/languages/english.cfg + install -m644 language_german.cfg "$pkgdir"/etc/ghostpp/languages/german.cfg + install -m644 language_russian.cfg "$pkgdir"/etc/ghostpp/languages/russian.cfg + install -m644 language_spanish.cfg "$pkgdir"/etc/ghostpp/languages/spanish.cfg + install -m644 language_turkish.cfg "$pkgdir"/etc/ghostpp/languages/turkish.cfg + ln --relative --symbolic "$pkgdir"/etc/ghostpp/languages/english.cfg "$pkgdir"/etc/ghostpp/language.cfg +} + +# vim:set ts=2 sw=2 et: diff --git a/common.j.patch b/common.j.patch new file mode 100644 index 000000000000..a9ce188ca17b --- /dev/null +++ b/common.j.patch @@ -0,0 +1,18 @@ +--- common.j.orig 2014-03-31 13:52:43.483681151 +0200 ++++ common.j 2014-03-31 13:53:35.369580784 +0200 +@@ -1,8 +1,4 @@ +-Imported data for [[common.j]]{{common.j article series}} +-{{DISPLAYTITLE:common.j}} +-{{JassSysSnip +-| system=common.j +-| code=//============================================================================ ++//============================================================================ + // Native types. All native functions take extended handle types when + // possible to help prevent passing bad values to native functions + // +@@ -2420,4 +2416,3 @@ + native PreloadGenEnd takes string filename returns nothing + native Preloader takes string filename returns nothing + }} +- +\ No newline at end of file diff --git a/config.patch b/config.patch new file mode 100644 index 000000000000..979f73a7dfa2 --- /dev/null +++ b/config.patch @@ -0,0 +1,62 @@ +Index: default.cfg +=================================================================== +--- default.cfg (revision 602) ++++ default.cfg (working copy) +@@ -4,7 +4,7 @@ + + ### the log file + +-bot_log = ghost.log ++bot_log = /dev/null + + ### the log method + ### set this to 1 to leave the log unlocked while GHost++ is running (may be slower, particularly on Windows) +@@ -15,7 +15,7 @@ + + ### the language file + +-bot_language = language.cfg ++bot_language = /etc/ghostpp/language.cfg + + ### the path to your local Warcraft III directory + ### this path must contain war3.exe, storm.dll, and game.dll +@@ -22,7 +22,7 @@ + ### if this path contains War3Patch.mpq the bot will attempt to extract "Scripts\common.j" and "Scripts\blizzard.j" on startup and write them to bot_mapcfgpath (which is defined later in this file) + ### common.j and blizzard.j are only required for automatically calculating map_crc, you do not need them if your map config files already contain map_crc + +-bot_war3path = C:\Program Files\Warcraft III ++bot_war3path = /usr/share/ghostpp + + ### whether to act as Warcraft III: The Frozen Throne or not + ### set this to 0 to act as Warcraft III: Reign of Chaos (you WILL NOT need to enter a TFT cd key to login to battle.net) +@@ -189,7 +189,7 @@ + + ### the IP blacklist file + +-bot_ipblacklistfile = ipblacklist.txt ++bot_ipblacklistfile = /etc/ghostpp/ipblacklist + + ### automatically close the game lobby if a reserved player (or admin) doesn't join it for this many minutes + ### games which are set to automatically start when enough players join are exempt from this limit (e.g. autohosted games) +@@ -231,18 +231,18 @@ + ### the first 8 lines of this file will be displayed when a player joins the game + ### if this file doesn't exist a default MOTD will be used + +-bot_motdfile = motd.txt ++bot_motdfile = /etc/ghostpp/motd + + ### the gameloaded file + ### the first 8 lines of this file will be displayed when the game finished loading (after the player loading times are displayed) + +-bot_gameloadedfile = gameloaded.txt ++bot_gameloadedfile = /etc/ghostpp/gameloaded + + ### the gameover file + ### the first 8 lines of this file will be displayed when the game is over + ### this only works when using a stats class - note: at the time of this writing the only stats class is for DotA maps + +-bot_gameoverfile = gameover.txt ++bot_gameoverfile = /etc/ghostpp/gameover + + ### whether to send "local admin messages" or not + ### these messages are battle.net chat messages, whispers, and emotes which the bot receives and passes on to the "local admin" diff --git a/ghostpp.install b/ghostpp.install new file mode 100644 index 000000000000..06b044319e17 --- /dev/null +++ b/ghostpp.install @@ -0,0 +1,23 @@ +#/bin/sh + +# arg 1: the new package version +post_install() { + getent group ghostpp >/dev/null || groupadd ghostpp + getent passwd ghostpp >/dev/null || useradd --system --home /var/lib/ghostpp --gid ghostpp ghostpp + chown --recursive ghostpp:ghostpp /var/lib/ghostpp + echo "==> You need to edit the config in /etc/ghostpp/ghost.cfg before using the bot" +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + : +} + +# arg 1: the old package version +post_remove() { + userdel -f ghostpp >/dev/null 2>&1 + groupdel ghostpp >/dev/null 2>&1 +} + +# vim:set ts=2 sw=2 ft=sh et: diff --git a/ghostpp.service b/ghostpp.service new file mode 100644 index 000000000000..b11a54e5b271 --- /dev/null +++ b/ghostpp.service @@ -0,0 +1,12 @@ +[Unit] +Description=GHost++, a Warcraft III hosting bot +After=network.target + +[Service] +ExecStart=/usr/bin/ghost++ /etc/ghostpp/ghost.cfg +KillSignal=SIGINT +User=ghostpp +WorkingDirectory=/var/lib/ghostpp + +[Install] +WantedBy=multi-user.target diff --git a/libboost.patch b/libboost.patch new file mode 100644 index 000000000000..9a88113345c8 --- /dev/null +++ b/libboost.patch @@ -0,0 +1,13 @@ +Index: ghost/Makefile +=================================================================== +--- ghost/Makefile (revision 602) ++++ ghost/Makefile (working copy) +@@ -4,7 +4,7 @@ + CC = gcc + DFLAGS = -DGHOST_MYSQL + OFLAGS = -O3 +-LFLAGS = -L. -L../bncsutil/src/bncsutil/ -L../StormLib/stormlib/ -lbncsutil -lpthread -ldl -lz -lStorm -lmysqlclient_r -lboost_date_time-mt -lboost_thread-mt -lboost_system-mt -lboost_filesystem-mt ++LFLAGS = -L. -L../bncsutil/src/bncsutil/ -L../StormLib/stormlib/ -lbncsutil -lpthread -ldl -lz -lStorm -lmysqlclient_r -lboost_date_time -lboost_thread -lboost_system -lboost_filesystem + CFLAGS = + + ifeq ($(SYSTEM),Darwin)