summaryrefslogtreecommitdiff
path: root/games-strategy
diff options
context:
space:
mode:
Diffstat (limited to 'games-strategy')
-rw-r--r--games-strategy/0ad/0ad-11339.ebuild150
-rw-r--r--games-strategy/0ad/0ad-11863.ebuild145
-rw-r--r--games-strategy/0ad/0ad-99999.ebuild115
-rw-r--r--games-strategy/0ad/Manifest11
-rw-r--r--games-strategy/0ad/files/11339_alpha_disable_nvtt.patch0
-rw-r--r--games-strategy/0ad/files/premake-archless.patch36
-rw-r--r--games-strategy/0ad/files/premake-script-archless.patch31
-rw-r--r--games-strategy/0ad/files/r11339_noCUDAdep.diff366
-rw-r--r--games-strategy/dunelegacy/Manifest2
-rw-r--r--games-strategy/dunelegacy/dunelegacy-0.96.2.ebuild61
-rw-r--r--games-strategy/stargus/Manifest2
-rw-r--r--games-strategy/stargus/stargus-2.2.7.ebuild70
-rw-r--r--games-strategy/unknown-horizons/Manifest4
-rw-r--r--games-strategy/unknown-horizons/unknown-horizons-2011.2.ebuild38
-rw-r--r--games-strategy/unknown-horizons/unknown-horizons-2012.1.ebuild37
-rw-r--r--games-strategy/zod-engine/Manifest3
-rw-r--r--games-strategy/zod-engine/files/zod-engine-20110906-proper-linux-support.patch1419
-rw-r--r--games-strategy/zod-engine/zod-engine-20110906.ebuild71
18 files changed, 2561 insertions, 0 deletions
diff --git a/games-strategy/0ad/0ad-11339.ebuild b/games-strategy/0ad/0ad-11339.ebuild
new file mode 100644
index 00000000..8ca568da
--- /dev/null
+++ b/games-strategy/0ad/0ad-11339.ebuild
@@ -0,0 +1,150 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+
+inherit eutils wxwidgets games
+
+MY_P="0ad-r${PV}-alpha"
+S="${WORKDIR}/${MY_P}"
+
+DESCRIPTION="0 A.D. is a free, real-time strategy game currently under development by Wildfire Games."
+HOMEPAGE="http://wildfiregames.com/0ad/"
+SRC_URI="mirror://sourceforge/zero-ad/${MY_P}-unix-build.tar.xz
+ mirror://sourceforge/zero-ad/${MY_P}-unix-data.tar.xz"
+
+LICENSE="GPL-2 CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug editor nvtt pch test fam"
+
+RDEPEND=">=dev-lang/spidermonkey-1.8.5
+ dev-libs/boost
+ dev-libs/libxml2
+ media-libs/devil
+ media-libs/openal
+ media-libs/libogg
+ media-libs/libpng
+ media-libs/libsdl[X,joystick]
+ media-libs/libvorbis
+ net-libs/enet:1.3
+ net-misc/curl
+ sys-libs/zlib
+ virtual/jpeg
+ virtual/opengl
+ fam? ( virtual/fam )
+ editor? ( x11-libs/wxGTK:2.8 )
+ nvtt? ( dev-util/nvidia-texture-tools )"
+
+DEPEND="${RDEPEND}
+ app-arch/zip
+ dev-lang/nasm
+ dev-util/cmake"
+
+RESTRICT="strip mirror"
+
+dir=${GAMES_PREFIX_OPT}/${PN}
+
+pkg_setup() {
+ games_pkg_setup
+ if use editor ; then
+ WX_GTK_VER=2.8 need-wxwidgets unicode
+ fi
+}
+
+src_prepare() {
+ cd "${S}" || die
+ epatch "${FILESDIR}"/r11339_noCUDAdep.diff
+}
+
+src_compile() {
+ UPDATE_ARGS="--with-system-enet --with-system-mozjs185"
+
+ if ! use pch ; then
+ UPDATE_ARGS="${UPDATE_ARGS} --without-pch"
+ fi
+
+ if ! use fam ; then
+ UPDATE_ARGS="${UPDATE_ARGS} --without-fam"
+ fi
+
+ if ! use editor ; then
+ UPDATE_ARGS="${UPDATE_ARGS} --disable-atlas"
+ fi
+
+ if use nvtt ; then
+ UPDATE_ARGS="${UPDATE_ARGS} --with-system-nvtt"
+ else
+ UPDATE_ARGS="${UPDATE_ARGS} --without-nvtt"
+ fi
+
+ cd "${S}/build/workspaces"
+ einfo "Running update-workspaces.sh with ${UPDATE_ARGS}"
+ ./update-workspaces.sh ${UPDATE_ARGS} || die "update-workspaces.sh failed"
+ cd gcc
+
+ TARGETS="pyrogenesis Collada"
+ if use test ; then
+ TARGETS="${TARGETS} test"
+ fi
+ if use editor ; then
+ TARGETS="${TARGETS} AtlasUI"
+ fi
+ if use debug ; then
+ CONFIG=Debug
+ else
+ CONFIG=Release
+ fi
+ CONFIG=${CONFIG} emake ${TARGETS} || die "Can't build"
+}
+
+src_test() {
+ cd "${S}/binaries/system"
+ if use debug ; then
+ ./test_dbg || die "Tests failed"
+ else
+ ./test || die "Tests failed"
+ fi
+}
+
+src_install() {
+ cd "${S}"/binaries
+ insinto "${dir}"
+ doins -r data || die "doins -r failed"
+
+ insinto "${dir}"/system
+
+ #we install build-in nvtt
+ if use !nvtt ; then
+ doins "${S}"/binaries/system/libnvcore.so || die "doins failed"
+ doins "${S}"/binaries/system/libnvimage.so || die "doins failed"
+ doins "${S}"/binaries/system/libnvmath.so || die "doins failed"
+ doins "${S}"/binaries/system/libnvtt.so || die "doins failed"
+ fi
+
+ if use debug ; then
+# doins "${S}"/binaries/system/libmozjs185-ps-debug.so.1.0 || die "doins failed"
+ doins "${S}"/binaries/system/libCollada_dbg.so || die "doins failed"
+ if use editor ; then
+ doins "${S}"/binaries/system/libAtlasUI_dbg.so || die "doins failed"
+ fi
+ EXE_NAME=pyrogenesis_dbg
+ else
+# doins "${S}"/binaries/system/libmozjs185-ps-release.so.1.0 || die "doins failed"
+ doins "${S}"/binaries/system/libCollada.so || die "doins failed"
+ if use editor ; then
+ doins "${S}"/binaries/system/libAtlasUI.so || die "doins failed"
+ fi
+ EXE_NAME=pyrogenesis
+ fi
+
+ exeinto "${dir}"/system
+ doexe "${S}"/binaries/system/${EXE_NAME} || die "doexe failed"
+
+ games_make_wrapper ${PN} ./system/${EXE_NAME} ${dir}
+ doicon "${S}"/build/resources/0ad.png
+ make_desktop_entry "${dir}"/system/${EXE_NAME} "0 A.D."
+
+ prepgamesdirs
+}
diff --git a/games-strategy/0ad/0ad-11863.ebuild b/games-strategy/0ad/0ad-11863.ebuild
new file mode 100644
index 00000000..a0f567c1
--- /dev/null
+++ b/games-strategy/0ad/0ad-11863.ebuild
@@ -0,0 +1,145 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+
+inherit eutils wxwidgets games
+
+MY_P="0ad-r${PV}-alpha"
+S="${WORKDIR}/${MY_P}"
+
+DESCRIPTION="0 A.D. is a free, real-time strategy game currently under development by Wildfire Games."
+HOMEPAGE="http://wildfiregames.com/0ad/"
+SRC_URI="mirror://sourceforge/zero-ad/${MY_P}-unix-build.tar.xz
+ mirror://sourceforge/zero-ad/${MY_P}-unix-data.tar.xz"
+
+LICENSE="GPL-2 CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug editor nvtt pch test fam"
+
+RDEPEND=">=dev-lang/spidermonkey-1.8.5
+ dev-libs/boost
+ dev-libs/libxml2
+ media-libs/devil
+ media-libs/openal
+ media-libs/libogg
+ media-libs/libpng
+ media-libs/libsdl[X,joystick]
+ media-libs/libvorbis
+ net-libs/enet:1.3
+ net-misc/curl
+ sys-libs/zlib
+ virtual/jpeg
+ virtual/opengl
+ fam? ( virtual/fam )
+ editor? ( x11-libs/wxGTK:2.8 )
+ nvtt? ( dev-util/nvidia-texture-tools )"
+
+DEPEND="${RDEPEND}
+ app-arch/zip
+ dev-lang/nasm
+ dev-util/cmake"
+
+RESTRICT="strip mirror"
+
+dir=${GAMES_PREFIX_OPT}/${PN}
+
+pkg_setup() {
+ games_pkg_setup
+ if use editor ; then
+ WX_GTK_VER=2.8 need-wxwidgets unicode
+ fi
+}
+
+src_compile() {
+ UPDATE_ARGS="--with-system-enet --with-system-mozjs185"
+
+ if ! use pch ; then
+ UPDATE_ARGS="${UPDATE_ARGS} --without-pch"
+ fi
+
+ if ! use fam ; then
+ UPDATE_ARGS="${UPDATE_ARGS} --without-fam"
+ fi
+
+ if ! use editor ; then
+ UPDATE_ARGS="${UPDATE_ARGS} --disable-atlas"
+ fi
+
+ if use nvtt ; then
+ UPDATE_ARGS="${UPDATE_ARGS} --with-system-nvtt"
+ else
+ UPDATE_ARGS="${UPDATE_ARGS} --without-nvtt"
+ fi
+
+ insinto "${S}/build/workspaces"
+ einfo "Running update-workspaces.sh with ${UPDATE_ARGS}"
+ ./update-workspaces.sh ${UPDATE_ARGS} || die "update-workspaces.sh failed"
+ insinto gcc
+
+ TARGETS="pyrogenesis Collada"
+ if use test ; then
+ TARGETS="${TARGETS} test"
+ fi
+ if use editor ; then
+ TARGETS="${TARGETS} AtlasUI"
+ fi
+ if use debug ; then
+ CONFIG=Debug
+ else
+ CONFIG=Release
+ fi
+ CONFIG=${CONFIG} emake ${TARGETS} || die "Can't build"
+}
+
+src_test() {
+ insinto "${S}/binaries/system"
+ if use debug ; then
+ ./test_dbg || die "Tests failed"
+ else
+ ./test || die "Tests failed"
+ fi
+}
+
+src_install() {
+ insinto "${S}"/binaries
+ insinto "${dir}"
+ doins -r data || die "doins -r failed"
+
+ insinto "${dir}"/system
+
+ #we install build-in nvtt
+ if use !nvtt ; then
+ doins "${S}"/binaries/system/libnvcore.so || die "doins failed"
+ doins "${S}"/binaries/system/libnvimage.so || die "doins failed"
+ doins "${S}"/binaries/system/libnvmath.so || die "doins failed"
+ doins "${S}"/binaries/system/libnvtt.so || die "doins failed"
+ fi
+
+ if use debug ; then
+# doins "${S}"/binaries/system/libmozjs185-ps-debug.so.1.0 || die "doins failed"
+ doins "${S}"/binaries/system/libCollada_dbg.so || die "doins failed"
+ if use editor ; then
+ doins "${S}"/binaries/system/libAtlasUI_dbg.so || die "doins failed"
+ fi
+ EXE_NAME=pyrogenesis_dbg
+ else
+# doins "${S}"/binaries/system/libmozjs185-ps-release.so.1.0 || die "doins failed"
+ doins "${S}"/binaries/system/libCollada.so || die "doins failed"
+ if use editor ; then
+ doins "${S}"/binaries/system/libAtlasUI.so || die "doins failed"
+ fi
+ EXE_NAME=pyrogenesis
+ fi
+
+ exeinto "${dir}"/system
+ doexe "${S}"/binaries/system/${EXE_NAME} || die "doexe failed"
+
+ games_make_wrapper ${PN} ./system/${EXE_NAME} ${dir}
+ doicon "${S}"/build/resources/0ad.png
+ make_desktop_entry "${dir}"/system/${EXE_NAME} "0 A.D."
+
+ prepgamesdirs
+}
diff --git a/games-strategy/0ad/0ad-99999.ebuild b/games-strategy/0ad/0ad-99999.ebuild
new file mode 100644
index 00000000..aaa10c2e
--- /dev/null
+++ b/games-strategy/0ad/0ad-99999.ebuild
@@ -0,0 +1,115 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+WX_GTK_VER="2.8"
+
+inherit eutils subversion wxwidgets games
+
+MY_PV="r${PV%_*}-alpha"
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="A free, real-time strategy game"
+HOMEPAGE="http://wildfiregames.com/0ad/"
+ESVN_REPO_URI="http://svn.wildfiregames.com/public/ps/trunk"
+
+LICENSE="GPL-2 LGPL-2.1 MIT CCPL-Attribution-ShareAlike-3.0 as-is"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+audio +editor fam +pch test"
+
+RDEPEND="
+ ~dev-lang/spidermonkey-1.8.5
+ dev-libs/boost
+ dev-libs/libxml2
+ media-gfx/nvidia-texture-tools
+ !games-strategy/0ad-data
+ media-libs/libpng:0
+ media-libs/libsdl[X,opengl,video]
+ net-libs/enet:1.3
+ net-misc/curl
+ sys-libs/zlib
+ virtual/jpeg
+ virtual/opengl
+ audio? ( media-libs/libogg
+ media-libs/libvorbis
+ media-libs/openal )
+ editor? ( x11-libs/wxGTK:$WX_GTK_VER[X,opengl] )
+ fam? ( virtual/fam )
+ "
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ test? ( dev-lang/perl )"
+
+S=${WORKDIR}/trunk
+
+pkg_setup() {
+ games_pkg_setup
+
+ if ! use pch ; then
+ eerror "pch useflag is potentially broken"
+ eerror "see http://trac.wildfiregames.com/ticket/1313"
+ fi
+}
+
+src_unpack() {
+ subversion_src_unpack
+}
+
+src_configure() {
+ cd build/workspaces || die
+
+ # custom configure script
+ local myconf
+ use fam || myconf="--without-fam"
+ use pch || myconf="${myconf} --without-pch"
+ use test || myconf="${myconf} --without-tests"
+ use audio || myconf="${myconf} --without-audio"
+
+ # don't use bundled sources
+ ./update-workspaces.sh \
+ --with-system-nvtt \
+ --with-system-enet \
+ --with-system-mozjs185 \
+ $(use_enable editor atlas) \
+ --bindir="${GAMES_BINDIR}" \
+ --libdir="$(games_get_libdir)"/${PN} \
+ --datadir="${GAMES_DATADIR}"/${PN} \
+ ${myconf} || die
+}
+
+src_compile() {
+ emake -C build/workspaces/gcc verbose=1 || die
+}
+
+src_test() {
+ cd binaries/system || die
+ ./test || die "test phase failed"
+}
+
+src_install() {
+ # data
+ insinto "${GAMES_DATADIR}"/${PN}
+ doins -r binaries/data/* || die
+
+ # bin
+ dogamesbin binaries/system/pyrogenesis || die
+
+ # libs
+ exeinto "$(games_get_libdir)"/${PN}
+ doexe binaries/system/libCollada.so || die
+ if use editor ; then
+ doexe binaries/system/libAtlasUI.so || die
+ fi
+
+ # other
+ dodoc binaries/system/readme.txt || die
+ doicon build/resources/${PN}.png || die
+ games_make_wrapper ${PN} "${GAMES_BINDIR}/pyrogenesis"
+ make_desktop_entry ${PN} ${PN} ${PN}
+
+ # permissions
+ prepgamesdirs
+}
diff --git a/games-strategy/0ad/Manifest b/games-strategy/0ad/Manifest
new file mode 100644
index 00000000..3e05d3e8
--- /dev/null
+++ b/games-strategy/0ad/Manifest
@@ -0,0 +1,11 @@
+AUX 11339_alpha_disable_nvtt.patch 0 SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 SHA512 cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e WHIRLPOOL 19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3
+AUX premake-archless.patch 1560 SHA256 85fc1ad2ef098d181f26fd78038ad90f7e1e2e948fe903664747494d129a3083 SHA512 df4cedfa2709b248a257d0634ba2e1013cf517fb5e46cb6472a3e87782686a1d8aeb066b23eb3008434fd2108865a5c6dd15fb3964af9074a611ca7202e8d5b1 WHIRLPOOL 78e2b482769ac07c219eec0fe99210cb723b16ae2d414dd5dfe6dde6d874013e8f707c2d16404a0517517ca1754fc1f203e7d2b8d152b25fd5366dc82c959f75
+AUX premake-script-archless.patch 1582 SHA256 0904c211595919bab0367b5e86c218a01b42c96df4b49c47a03c125ed3a2aada SHA512 987c3ee5387e040dc3b1c492e4191fce1532f6b2eae288a15246fdaee8e17d81dbd7cdc524bdcc0036a32bfce11f4d6eae014d05d5dbba148eafbea0627498c8 WHIRLPOOL 0f906f81a139da1aedcf325cfa60c5de00bd76c40bf95b9206350721341fb93a3deb0e681e4900a0c343cc9ebf7ae5e21522b247e0c202bbbd86830467bf4b34
+AUX r11339_noCUDAdep.diff 11782 SHA256 b334acff6a9d122fbaec92bf9146c7fd9c54d0f0babcf36554e6114ec67ac9aa SHA512 bc1cfb546e7bd04a4e8c22dce23a9fba00339eb4e7cdfb16bb9ec304fed5c6347cd79f751d7381a150c778408808b0492ce51130c4fa1ce2231f1d44fa89d524 WHIRLPOOL ef329815d3fd8155c9d26a96d7c05e873737c10b1492cd1d817db4c23dee7118525744f1c3194902054f776a7fac5992d35a2aca22966252f1cf4fe646bf3c4d
+DIST 0ad-r11339-alpha-unix-build.tar.xz 8593664 SHA256 1e69bc02c1af1bfbe30244467761d13e1aaff164fe583d962cc8e13faf4a56cb
+DIST 0ad-r11339-alpha-unix-data.tar.xz 294663484 SHA256 ac4cb17478eed633e1b0c975b052706797628fac399147d6301c4001100170b4
+DIST 0ad-r11863-alpha-unix-build.tar.xz 8657204 SHA256 46c08d380ce098d3d8f577d04d602bb245dfbb7f7da7b1ad009e7a0d4751435f
+DIST 0ad-r11863-alpha-unix-data.tar.xz 310994700 SHA256 76702023402361d27b61eea37034b08e9e19b282e4cdd69954495d2dd087b90a
+EBUILD 0ad-11339.ebuild 3547 SHA256 30a65b31a9e1353c30b3a642f4437f0e4be440de15fd6eb1d2a79959ef279d66 SHA512 cab0a342c5d3c65aaebf282d990e65c6255ed5748ec54e51f87bf05d8cdd73b42e0126021d190e1abb3dece877124dc239dcf17043f34d9969847e247a17b177 WHIRLPOOL da04b4bb99647a8047ca44a901a95e67c940e3cf0979f0937d9acec92ab28b320081158e36356ef4f82383fac92063608a53e3c03059cf99c2b38d733ff80bb4
+EBUILD 0ad-11863.ebuild 3486 SHA256 f4351f00f0b233f368b8792c362156a54ef480ab41ed0772d051a8b49de8e5a7 SHA512 95e82f67d8e51f54cbd7646f74e94076df4860724fa8352ef788d05ad760c13b6755a846355281d2e543a06ee9258bf6c5605df59a76f4941632fd7be6371680 WHIRLPOOL be7ccc427e39bf7a99cbd9fd824b9ed2e534dc364ef935e2d76feea3db34eca3a93dedcbc71120e73df9452cfccdd36ce71d200fd0d0ab45a1b6954e73ac13c4
+EBUILD 0ad-99999.ebuild 2452 SHA256 0162fc58b4c74ec12012ab80289cdd0241238f26384a64b9c7432b443c6dd3b7 SHA512 1033f33deb6783baac775169f76b12a53617ac31454e86e3c4eb7642612f2c0bbe2a92544bba4a016fe6f77d856ecd091f48134387c1286e97f309e708b5584d WHIRLPOOL 46fac08559d6be536455f485916b8864c3150c1387712289ef0f2acdcb2527cee00d27f437c2d58b8a6c1414181d094a3312afd29098398daae68ec44d5f355e
diff --git a/games-strategy/0ad/files/11339_alpha_disable_nvtt.patch b/games-strategy/0ad/files/11339_alpha_disable_nvtt.patch
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/games-strategy/0ad/files/11339_alpha_disable_nvtt.patch
diff --git a/games-strategy/0ad/files/premake-archless.patch b/games-strategy/0ad/files/premake-archless.patch
new file mode 100644
index 00000000..2b87d048
--- /dev/null
+++ b/games-strategy/0ad/files/premake-archless.patch
@@ -0,0 +1,36 @@
+diff -Naur build/premake/premake4.orig/build/gmake.unix/Premake4.make build/premake/premake4/build/gmake.unix/Premake4.make
+--- build/premake/premake4.orig/build/gmake.unix/Premake4.make 2010-11-16 06:29:14.000000000 -0500
++++ build/premake/premake4/build/gmake.unix/Premake4.make 2011-04-18 07:24:59.374986001 -0400
+@@ -26,13 +26,12 @@
+ DEFINES += -DNDEBUG -DLUA_USE_POSIX -DLUA_USE_DLOPEN
+ INCLUDES += -I../../src/host/lua-5.1.4/src
+ CPPFLAGS += -MMD -MP $(DEFINES) $(INCLUDES)
+- CFLAGS += $(CPPFLAGS) $(ARCH) -Wall -Os
+- CXXFLAGS += $(CFLAGS)
+- LDFLAGS += -s -rdynamic
++ CFLAGS += $(CPPFLAGS) -Wall
++ LDFLAGS += -rdynamic
+ LIBS += -lm -ldl
+ RESFLAGS += $(DEFINES) $(INCLUDES)
+ LDDEPS +=
+- LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
++ LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(LIBS)
+ define PREBUILDCMDS
+ endef
+ define PRELINKCMDS
+@@ -48,13 +47,12 @@
+ DEFINES += -D_DEBUG -DLUA_USE_POSIX -DLUA_USE_DLOPEN
+ INCLUDES += -I../../src/host/lua-5.1.4/src
+ CPPFLAGS += -MMD -MP $(DEFINES) $(INCLUDES)
+- CFLAGS += $(CPPFLAGS) $(ARCH) -Wall -g
+- CXXFLAGS += $(CFLAGS)
++ CFLAGS += $(CPPFLAGS) -Wall -g
+ LDFLAGS += -rdynamic
+ LIBS += -lm -ldl
+ RESFLAGS += $(DEFINES) $(INCLUDES)
+ LDDEPS +=
+- LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
++ LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(LIBS)
+ define PREBUILDCMDS
+ endef
+ define PRELINKCMDS
diff --git a/games-strategy/0ad/files/premake-script-archless.patch b/games-strategy/0ad/files/premake-script-archless.patch
new file mode 100644
index 00000000..7195feb9
--- /dev/null
+++ b/games-strategy/0ad/files/premake-script-archless.patch
@@ -0,0 +1,31 @@
+--- build/premake/premake4/src/actions/make/make_cpp.lua.orig 2011-12-17 20:59:29.000000000 +0800
++++ build/premake/premake4/src/actions/make/make_cpp.lua 2011-12-25 07:27:40.268759001 +0800
+@@ -248,7 +248,7 @@
+ -- set up precompiled headers
+ _.pchconfig(cfg)
+
+- _p(' CFLAGS += $(CPPFLAGS) $(ARCH) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), " "))
++ _p(' CFLAGS += $(CPPFLAGS) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), " "))
+ _p(' CXXFLAGS += $(CFLAGS) %s', table.concat(cc.getcxxflags(cfg), " "))
+ _p(' LDFLAGS += %s', table.concat(table.join(cc.getldflags(cfg), cfg.linkoptions, cc.getlibdirflags(cfg)), " "))
+ _p(' LIBS += %s %s', table.concat(cc.getlinkflags(cfg), " "), table.concat(cfg.gnuexternals, " "))
+@@ -272,7 +272,7 @@
+ else
+ lddeps = '-Xlinker --start-group $(LDDEPS) -Xlinker --end-group'
+ end
+- _p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) %s $(LIBS)',
++ _p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) %s $(LIBS)',
+ iif(cfg.language == "C", "CC", "CXX"), lddeps)
+ end
+
+--- build/workspaces/update-workspaces.sh.orig 2011-11-15 00:10:41.000000000 +0800
++++ build/workspaces/update-workspaces.sh 2011-12-25 07:30:39.729759000 +0800
+@@ -62,6 +62,8 @@
+ # Now build premake and run it to create the makefiles
+ cd ../premake/premake4
+ make -C build/gmake.unix ${JOBS} || die "Premake build failed"
++./bin/release/premake4 embed
++make -C build/gmake.unix ${JOBS} || die "Premake build failed"
+
+ echo
+
diff --git a/games-strategy/0ad/files/r11339_noCUDAdep.diff b/games-strategy/0ad/files/r11339_noCUDAdep.diff
new file mode 100644
index 00000000..f002c823
--- /dev/null
+++ b/games-strategy/0ad/files/r11339_noCUDAdep.diff
@@ -0,0 +1,366 @@
+Index: /ps/trunk/libraries/nvtt/src/src/nvimage/CMakeLists.txt
+===================================================================
+--- /ps/trunk/libraries/nvtt/src/src/nvimage/CMakeLists.txt (revision 11501)
++++ /ps/trunk/libraries/nvtt/src/src/nvimage/CMakeLists.txt (revision 11502)
+@@ -63,6 +63,6 @@
+
+ INSTALL(TARGETS nvimage
+- RUNTIME DESTINATION bin
+- LIBRARY DESTINATION lib
+- ARCHIVE DESTINATION lib/static)
++ RUNTIME DESTINATION ${BINDIR}
++ LIBRARY DESTINATION ${LIBDIR}
++ ARCHIVE DESTINATION ${LIBDIR})
+
+Index: /ps/trunk/libraries/nvtt/src/src/nvtt/CMakeLists.txt
+===================================================================
+--- /ps/trunk/libraries/nvtt/src/src/nvtt/CMakeLists.txt (revision 11501)
++++ /ps/trunk/libraries/nvtt/src/src/nvtt/CMakeLists.txt (revision 11502)
+@@ -58,7 +58,7 @@
+
+ INSTALL(TARGETS nvtt
+- RUNTIME DESTINATION bin
+- LIBRARY DESTINATION lib
+- ARCHIVE DESTINATION lib/static)
++ RUNTIME DESTINATION ${BINDIR}
++ LIBRARY DESTINATION ${LIBDIR}
++ ARCHIVE DESTINATION ${LIBDIR})
+
+ INSTALL(FILES nvtt.h DESTINATION include/nvtt)
+Index: /ps/trunk/libraries/nvtt/src/src/nvcore/CMakeLists.txt
+===================================================================
+--- /ps/trunk/libraries/nvtt/src/src/nvcore/CMakeLists.txt (revision 11501)
++++ /ps/trunk/libraries/nvtt/src/src/nvcore/CMakeLists.txt (revision 11502)
+@@ -43,5 +43,5 @@
+
+ INSTALL(TARGETS nvcore
+- RUNTIME DESTINATION bin
+- LIBRARY DESTINATION lib
+- ARCHIVE DESTINATION lib/static)
++ RUNTIME DESTINATION ${BINDIR}
++ LIBRARY DESTINATION ${LIBDIR}
++ ARCHIVE DESTINATION ${LIBDIR})
+Index: /ps/trunk/libraries/nvtt/src/src/CMakeLists.txt
+===================================================================
+--- /ps/trunk/libraries/nvtt/src/src/CMakeLists.txt (revision 11501)
++++ /ps/trunk/libraries/nvtt/src/src/CMakeLists.txt (revision 11502)
+@@ -6,4 +6,11 @@
+
+ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
++
++# initial variables
++SET(GLUT TRUE CACHE BOOL "")
++SET(GLEW TRUE CACHE BOOL "")
++SET(CG TRUE CACHE BOOL "")
++SET(CUDA TRUE CACHE BOOL "")
++SET(OPENEXR TRUE CACHE BOOL "")
+
+ # OpenGL
+@@ -16,11 +23,13 @@
+
+ # GLUT
+-INCLUDE(${NV_CMAKE_DIR}/FindGLUT.cmake)
+-#INCLUDE(FindGLUT)
+-IF(GLUT_FOUND)
+- MESSAGE(STATUS "Looking for GLUT - found")
+-ELSE(GLUT_FOUND)
+- MESSAGE(STATUS "Looking for GLUT - not found")
+-ENDIF(GLUT_FOUND)
++IF(GLUT)
++ INCLUDE(${NV_CMAKE_DIR}/FindGLUT.cmake)
++ #INCLUDE(FindGLUT)
++ IF(GLUT_FOUND)
++ MESSAGE(STATUS "Looking for GLUT - found")
++ ELSE(GLUT_FOUND)
++ MESSAGE(STATUS "Looking for GLUT - not found")
++ ENDIF(GLUT_FOUND)
++ENDIF(GLUT)
+
+ # DirectX
+@@ -33,27 +42,33 @@
+
+ # GLEW
+-INCLUDE(${NV_CMAKE_DIR}/FindGLEW.cmake)
+-IF(GLEW_FOUND)
+- MESSAGE(STATUS "Looking for GLEW - found")
+-ELSE(GLEW_FOUND)
+- MESSAGE(STATUS "Looking for GLEW - not found")
+-ENDIF(GLEW_FOUND)
++IF(GLEW)
++ INCLUDE(${NV_CMAKE_DIR}/FindGLEW.cmake)
++ IF(GLEW_FOUND)
++ MESSAGE(STATUS "Looking for GLEW - found")
++ ELSE(GLEW_FOUND)
++ MESSAGE(STATUS "Looking for GLEW - not found")
++ ENDIF(GLEW_FOUND)
++ENDIF(GLEW)
+
+ # Cg
+-INCLUDE(${NV_CMAKE_DIR}/FindCg.cmake)
+-IF(CG_FOUND)
+- MESSAGE(STATUS "Looking for Cg - found")
+-ELSE(CG_FOUND)
+- MESSAGE(STATUS "Looking for Cg - not found")
+-ENDIF(CG_FOUND)
++IF(CG)
++ INCLUDE(${NV_CMAKE_DIR}/FindCg.cmake)
++ IF(CG_FOUND)
++ MESSAGE(STATUS "Looking for Cg - found")
++ ELSE(CG_FOUND)
++ MESSAGE(STATUS "Looking for Cg - not found")
++ ENDIF(CG_FOUND)
++ENDIF(CG)
+
+ # CUDA
+-INCLUDE(${NV_CMAKE_DIR}/FindCUDA.cmake)
+-IF(CUDA_FOUND)
+- SET(HAVE_CUDA ${CUDA_FOUND} CACHE BOOL "Set to TRUE if CUDA is found, FALSE otherwise")
+- MESSAGE(STATUS "Looking for CUDA - found")
+-ELSE(CUDA_FOUND)
+- MESSAGE(STATUS "Looking for CUDA - not found")
+-ENDIF(CUDA_FOUND)
++IF(CUDA)
++ INCLUDE(${NV_CMAKE_DIR}/FindCUDA.cmake)
++ IF(CUDA_FOUND)
++ SET(HAVE_CUDA ${CUDA_FOUND} CACHE BOOL "Set to TRUE if CUDA is found, FALSE otherwise")
++ MESSAGE(STATUS "Looking for CUDA - found")
++ ELSE(CUDA_FOUND)
++ MESSAGE(STATUS "Looking for CUDA - not found")
++ ENDIF(CUDA_FOUND)
++ENDIF(CUDA)
+
+ # Maya
+@@ -94,11 +109,13 @@
+
+ # OpenEXR
+-INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
+-IF(OPENEXR_FOUND)
+- SET(HAVE_OPENEXR ${OPENEXR_FOUND} CACHE BOOL "Set to TRUE if OpenEXR is found, FALSE otherwise")
+- MESSAGE(STATUS "Looking for OpenEXR - found")
+-ELSE(OPENEXR_FOUND)
+- MESSAGE(STATUS "Looking for OpenEXR - not found")
+-ENDIF(OPENEXR_FOUND)
++IF(OPENEXR)
++ INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
++ IF(OPENEXR_FOUND)
++ SET(HAVE_OPENEXR ${OPENEXR_FOUND} CACHE BOOL "Set to TRUE if OpenEXR is found, FALSE otherwise")
++ MESSAGE(STATUS "Looking for OpenEXR - found")
++ ELSE(OPENEXR_FOUND)
++ MESSAGE(STATUS "Looking for OpenEXR - not found")
++ ENDIF(OPENEXR_FOUND)
++ENDIF(OPENEXR)
+
+ # Qt
+Index: /ps/trunk/libraries/nvtt/src/src/nvmath/CMakeLists.txt
+===================================================================
+--- /ps/trunk/libraries/nvtt/src/src/nvmath/CMakeLists.txt (revision 11501)
++++ /ps/trunk/libraries/nvtt/src/src/nvmath/CMakeLists.txt (revision 11502)
+@@ -29,5 +29,5 @@
+
+ INSTALL(TARGETS nvmath
+- RUNTIME DESTINATION bin
+- LIBRARY DESTINATION lib
+- ARCHIVE DESTINATION lib/static)
++ RUNTIME DESTINATION ${BINDIR}
++ LIBRARY DESTINATION ${LIBDIR}
++ ARCHIVE DESTINATION ${LIBDIR})
+Index: /ps/trunk/libraries/nvtt/cmake-devflags.patch
+===================================================================
+--- /ps/trunk/libraries/nvtt/cmake-devflags.patch (revision 11502)
++++ /ps/trunk/libraries/nvtt/cmake-devflags.patch (revision 11502)
+@@ -0,0 +1,176 @@
++From: hasufell <julian.ospald@googlemail.com>
++Date: Wed Apr 11 21:49:58 UTC 2012
++Subject: various cmake fixes
++
++fix hardcoded install paths for BINDIR and LIBDIR
++make cg, cuda, glew, glut and openexr controllable and not automagic
++
++--- src/nvcore/CMakeLists.txt
+++++ src/nvcore/CMakeLists.txt
++@@ -42,6 +42,6 @@
++ TARGET_LINK_LIBRARIES(nvcore ${LIBS})
++
++ INSTALL(TARGETS nvcore
++- RUNTIME DESTINATION bin
++- LIBRARY DESTINATION lib
++- ARCHIVE DESTINATION lib/static)
+++ RUNTIME DESTINATION ${BINDIR}
+++ LIBRARY DESTINATION ${LIBDIR}
+++ ARCHIVE DESTINATION ${LIBDIR})
++--- src/nvimage/CMakeLists.txt
+++++ src/nvimage/CMakeLists.txt
++@@ -62,7 +62,7 @@
++ TARGET_LINK_LIBRARIES(nvimage ${LIBS} nvcore nvmath posh)
++
++ INSTALL(TARGETS nvimage
++- RUNTIME DESTINATION bin
++- LIBRARY DESTINATION lib
++- ARCHIVE DESTINATION lib/static)
+++ RUNTIME DESTINATION ${BINDIR}
+++ LIBRARY DESTINATION ${LIBDIR}
+++ ARCHIVE DESTINATION ${LIBDIR})
++
++--- src/nvmath/CMakeLists.txt
+++++ src/nvmath/CMakeLists.txt
++@@ -28,6 +28,6 @@
++ TARGET_LINK_LIBRARIES(nvmath ${LIBS} nvcore)
++
++ INSTALL(TARGETS nvmath
++- RUNTIME DESTINATION bin
++- LIBRARY DESTINATION lib
++- ARCHIVE DESTINATION lib/static)
+++ RUNTIME DESTINATION ${BINDIR}
+++ LIBRARY DESTINATION ${LIBDIR}
+++ ARCHIVE DESTINATION ${LIBDIR})
++--- src/nvtt/CMakeLists.txt
+++++ src/nvtt/CMakeLists.txt
++@@ -53,9 +53,9 @@
++ TARGET_LINK_LIBRARIES(nvtt ${LIBS} nvcore nvmath nvimage squish)
++
++ INSTALL(TARGETS nvtt
++- RUNTIME DESTINATION bin
++- LIBRARY DESTINATION lib
++- ARCHIVE DESTINATION lib/static)
+++ RUNTIME DESTINATION ${BINDIR}
+++ LIBRARY DESTINATION ${LIBDIR}
+++ ARCHIVE DESTINATION ${LIBDIR})
++
++ INSTALL(FILES nvtt.h DESTINATION include/nvtt)
++
++--- src/CMakeLists.txt
+++++ src/CMakeLists.txt
++@@ -5,6 +5,13 @@
++ SUBDIRS(nvtt)
++
++ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+++
+++# initial variables
+++SET(GLUT TRUE CACHE BOOL "")
+++SET(GLEW TRUE CACHE BOOL "")
+++SET(CG TRUE CACHE BOOL "")
+++SET(CUDA TRUE CACHE BOOL "")
+++SET(OPENEXR TRUE CACHE BOOL "")
++
++ # OpenGL
++ INCLUDE(FindOpenGL)
++@@ -15,13 +22,15 @@
++ ENDIF(OPENGL_FOUND)
++
++ # GLUT
++-INCLUDE(${NV_CMAKE_DIR}/FindGLUT.cmake)
++-#INCLUDE(FindGLUT)
++-IF(GLUT_FOUND)
++- MESSAGE(STATUS "Looking for GLUT - found")
++-ELSE(GLUT_FOUND)
++- MESSAGE(STATUS "Looking for GLUT - not found")
++-ENDIF(GLUT_FOUND)
+++IF(GLUT)
+++ INCLUDE(${NV_CMAKE_DIR}/FindGLUT.cmake)
+++ #INCLUDE(FindGLUT)
+++ IF(GLUT_FOUND)
+++ MESSAGE(STATUS "Looking for GLUT - found")
+++ ELSE(GLUT_FOUND)
+++ MESSAGE(STATUS "Looking for GLUT - not found")
+++ ENDIF(GLUT_FOUND)
+++ENDIF(GLUT)
++
++ # DirectX
++ INCLUDE(${NV_CMAKE_DIR}/FindDirectX.cmake)
++@@ -32,29 +41,35 @@
++ ENDIF(DX10_FOUND)
++
++ # GLEW
++-INCLUDE(${NV_CMAKE_DIR}/FindGLEW.cmake)
++-IF(GLEW_FOUND)
++- MESSAGE(STATUS "Looking for GLEW - found")
++-ELSE(GLEW_FOUND)
++- MESSAGE(STATUS "Looking for GLEW - not found")
++-ENDIF(GLEW_FOUND)
+++IF(GLEW)
+++ INCLUDE(${NV_CMAKE_DIR}/FindGLEW.cmake)
+++ IF(GLEW_FOUND)
+++ MESSAGE(STATUS "Looking for GLEW - found")
+++ ELSE(GLEW_FOUND)
+++ MESSAGE(STATUS "Looking for GLEW - not found")
+++ ENDIF(GLEW_FOUND)
+++ENDIF(GLEW)
++
++ # Cg
++-INCLUDE(${NV_CMAKE_DIR}/FindCg.cmake)
++-IF(CG_FOUND)
++- MESSAGE(STATUS "Looking for Cg - found")
++-ELSE(CG_FOUND)
++- MESSAGE(STATUS "Looking for Cg - not found")
++-ENDIF(CG_FOUND)
+++IF(CG)
+++ INCLUDE(${NV_CMAKE_DIR}/FindCg.cmake)
+++ IF(CG_FOUND)
+++ MESSAGE(STATUS "Looking for Cg - found")
+++ ELSE(CG_FOUND)
+++ MESSAGE(STATUS "Looking for Cg - not found")
+++ ENDIF(CG_FOUND)
+++ENDIF(CG)
++
++ # CUDA
++-INCLUDE(${NV_CMAKE_DIR}/FindCUDA.cmake)
++-IF(CUDA_FOUND)
++- SET(HAVE_CUDA ${CUDA_FOUND} CACHE BOOL "Set to TRUE if CUDA is found, FALSE otherwise")
++- MESSAGE(STATUS "Looking for CUDA - found")
++-ELSE(CUDA_FOUND)
++- MESSAGE(STATUS "Looking for CUDA - not found")
++-ENDIF(CUDA_FOUND)
+++IF(CUDA)
+++ INCLUDE(${NV_CMAKE_DIR}/FindCUDA.cmake)
+++ IF(CUDA_FOUND)
+++ SET(HAVE_CUDA ${CUDA_FOUND} CACHE BOOL "Set to TRUE if CUDA is found, FALSE otherwise")
+++ MESSAGE(STATUS "Looking for CUDA - found")
+++ ELSE(CUDA_FOUND)
+++ MESSAGE(STATUS "Looking for CUDA - not found")
+++ ENDIF(CUDA_FOUND)
+++ENDIF(CUDA)
++
++ # Maya
++ INCLUDE(${NV_CMAKE_DIR}/FindMaya.cmake)
++@@ -93,13 +108,15 @@
++ ENDIF(TIFF_FOUND)
++
++ # OpenEXR
++-INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
++-IF(OPENEXR_FOUND)
++- SET(HAVE_OPENEXR ${OPENEXR_FOUND} CACHE BOOL "Set to TRUE if OpenEXR is found, FALSE otherwise")
++- MESSAGE(STATUS "Looking for OpenEXR - found")
++-ELSE(OPENEXR_FOUND)
++- MESSAGE(STATUS "Looking for OpenEXR - not found")
++-ENDIF(OPENEXR_FOUND)
+++IF(OPENEXR)
+++ INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
+++ IF(OPENEXR_FOUND)
+++ SET(HAVE_OPENEXR ${OPENEXR_FOUND} CACHE BOOL "Set to TRUE if OpenEXR is found, FALSE otherwise")
+++ MESSAGE(STATUS "Looking for OpenEXR - found")
+++ ELSE(OPENEXR_FOUND)
+++ MESSAGE(STATUS "Looking for OpenEXR - not found")
+++ ENDIF(OPENEXR_FOUND)
+++ENDIF(OPENEXR)
++
++ # Qt
++ FIND_PACKAGE(Qt4)
+Index: /ps/trunk/libraries/nvtt/build.sh
+===================================================================
+--- /ps/trunk/libraries/nvtt/build.sh (revision 11501)
++++ /ps/trunk/libraries/nvtt/build.sh (revision 11502)
+@@ -12,5 +12,5 @@
+ cd src/build/
+
+-cmake .. -DNVTT_SHARED=1 -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles"
++cmake .. -DNVTT_SHARED=1 -DCMAKE_BUILD_TYPE=Release -DBINDIR=bin -DLIBDIR=lib -DGLUT=0 -DGLEW=0 -DCG=0 -DCUDA=0 -DOPENEXR=0 -G "Unix Makefiles"
+
+ ${MAKE} nvtt ${JOBS}
+Index: /ps/trunk/libraries/nvtt/README.txt
+===================================================================
+--- /ps/trunk/libraries/nvtt/README.txt (revision 11501)
++++ /ps/trunk/libraries/nvtt/README.txt (revision 11502)
+@@ -10,2 +10,3 @@
+ cmake-freebsd.patch (fixes build on FreeBSD)
+ gcc47-unistd.patch (fixes build on GCC 4.7)
++ cmake-depflags.patch (from https://407191.bugs.gentoo.org/attachment.cgi?id=308589 - allows disabling various dependencies)
diff --git a/games-strategy/dunelegacy/Manifest b/games-strategy/dunelegacy/Manifest
new file mode 100644
index 00000000..f6b153fe
--- /dev/null
+++ b/games-strategy/dunelegacy/Manifest
@@ -0,0 +1,2 @@
+DIST dunelegacy-0.96.2-src.tar.bz2 1437524 SHA256 bdf27bdaa001f37db52ab4747bd563b48334db5df6e6e8314de85a0340649173
+EBUILD dunelegacy-0.96.2.ebuild 1365 SHA256 22416df3f7f40141321acbc65550d4d8c4c933e1d7ae62b963376b8e9015b176 SHA512 39bdecc9782fa4649e7f0df596d6064e9a928b86ac69736884fa9414ce1b61e567081e3b2c7d6c12433049c073f8c0a4f79db7bd5948fab7d769f073470d0c8e WHIRLPOOL f8d13d9166e904be1a6c90da4b6674c2212ece201ca64248555beb7df08ce126b29b8a87c5b05057b2f1bc0acfb70296ab329ac19576e3e655a41a59e6717829
diff --git a/games-strategy/dunelegacy/dunelegacy-0.96.2.ebuild b/games-strategy/dunelegacy/dunelegacy-0.96.2.ebuild
new file mode 100644
index 00000000..f0c96b09
--- /dev/null
+++ b/games-strategy/dunelegacy/dunelegacy-0.96.2.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils games
+
+
+DESCRIPTION="Dune Legacy is an open source clone of Dune 2."
+HOMEPAGE="http://dunelegacy.sourceforge.net"
+SRC_URI="http://www.myway.de/richieland/${PN}-0.96.2-src.tar.bz2"
+
+LICENSE="GPL-2 or later"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+RDEPEND="media-libs/libsdl
+ media-libs/sdl-mixer"
+
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${PN}-0.96.2
+
+src_install() {
+ cd "${S}/src"
+
+ dogamesbin ${PN} || die "dogamesbin failed"
+
+ cd "${S}"
+
+ insinto "${GAMES_DATADIR}"/${PN}
+ doins -r data/* || die "doins failed"
+
+ doicon dunelegacy.png
+ make_desktop_entry ${PN} "Dune Legacy" dunelegacy.png "Game;StrategyGame;"
+
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ elog "You will need to copy all Dune 2 PAK files to ${GAMES_DATADIR}/${PN} !"
+ elog ""
+ elog "At least the following files are needed:"
+ elog " - ATRE.PAK"
+ elog " - DUNE.PAK"
+ elog " - ENGLISH.PAK"
+ elog " - FINALE.PAK"
+ elog " - HARK.PAK"
+ elog " - INTRO.PAK"
+ elog " - INTROVOC.PAK"
+ elog " - MENTAT.PAK"
+ elog " - MERC.PAK"
+ elog " - ORDOS.PAK"
+ elog " - SCENARIO.PAK"
+ elog " - SOUND.PAK"
+ elog " - VOC.PAK"
+ elog ""
+ elog "For playing in german or french you need additionally GERMAN.PAK"
+ elog "or FRENCH.PAK."
+}
+
diff --git a/games-strategy/stargus/Manifest b/games-strategy/stargus/Manifest
new file mode 100644
index 00000000..ffd3c925
--- /dev/null
+++ b/games-strategy/stargus/Manifest
@@ -0,0 +1,2 @@
+DIST stargus_2.2.7.orig.tar.gz 297224 SHA256 7cbc9b4393e3d2a4d04e194518becb915204fea7f56e8f65aba361c8182f3c93 SHA512 73c4e74e22658cbcbe1a55e4ff38ed5e4a1a5531c815834385eee337f34a0070ce699db7a7456709525f75f6a25c53e5f723fb6fceaa59d4f3146a30edc18e05 WHIRLPOOL 009224eebe558c87513cbad14c2a9741413f16bebef2178c51e45f2c1975350177050d123f0f80f7f7fb650215fe92d2678ad3af3da11e680e20735a84953837
+EBUILD stargus-2.2.7.ebuild 1646 SHA256 829b2fa7f07cb175867b3b9b93ee90873d57cc4a505b86532eb5599e47c55d27 SHA512 186cb743b3efb6cc5fe1708c4f0fc4dabdb02563ea3f348712c44ddd672cbfbe800bad24df29a303175a093a397f797b33c4784dbe52bda62d972d3cd049830b WHIRLPOOL ea73b27e88c1995e1497fa322295440c731d5d69b8e6bbd7c7fc2d1adf56f76f36b754d3e687a0ff0dcb54cb0a596e09bb1925431cd8728cba541b1ffa1748e9
diff --git a/games-strategy/stargus/stargus-2.2.7.ebuild b/games-strategy/stargus/stargus-2.2.7.ebuild
new file mode 100644
index 00000000..68f4c540
--- /dev/null
+++ b/games-strategy/stargus/stargus-2.2.7.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/games-engines/stratagus/stratagus-2.2.6-r1.ebuild,v 1.2 2012/06/02 19:53:52 hasufell Exp $
+
+EAPI=4
+
+inherit cmake-utils eutils games
+
+DESCRIPTION="A realtime strategy game engine"
+HOMEPAGE="http://stratagus.sourceforge.net/"
+SRC_URI="https://launchpad.net/stargus/trunk/${PV}/+download/${PN}_${PV}.orig.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="bzip2 debug doc mikmod mng theora vorbis"
+
+RDEPEND="dev-db/sqlite:3
+ >=dev-lang/lua-5
+ dev-lua/toluapp
+ media-libs/libpng:0
+ virtual/opengl
+ x11-libs/libX11
+ media-libs/libsdl[audio,opengl,video]
+ bzip2? ( app-arch/bzip2 )
+ mikmod? ( media-libs/libmikmod )
+ mng? ( media-libs/libmng )
+ vorbis? ( media-libs/libvorbis
+ theora? ( media-libs/libtheora )
+ )"
+DEPEND="${RDEPEND}
+ doc? ( app-doc/doxygen )
+ virtual/pkgconfig"
+
+REQUIRED_USE="theora? ( vorbis )"
+
+S=${WORKDIR}/${PN}_${PV}.orig
+
+#src_prepare() {
+ #epatch "${FILESDIR}"/${P}-build.patch \
+ #"${FILESDIR}"/${P}-debug.patch
+#}
+
+src_configure() {
+ # there are in-source switches
+ use debug && CMAKE_BUILD_TYPE=Debug
+
+ local mycmakeargs=(
+ -DBINDIR="${GAMES_BINDIR}"
+ -DSBINDIR="${GAMES_BINDIR}"
+ $(cmake-utils_use_with bzip2 BZIP2)
+ $(cmake-utils_use_enable doc DOC)
+ $(cmake-utils_use_with mikmod MIKMOD)
+ $(cmake-utils_use_with mng MNG)
+ $(cmake-utils_use_with vorbis OGGVORBIS)
+ $(cmake-utils_use_with theora THEORA)
+ -DENABLE_DEV=ON
+ )
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+}
+
+src_install() {
+ cmake-utils_src_install
+ prepgamesdirs
+}
diff --git a/games-strategy/unknown-horizons/Manifest b/games-strategy/unknown-horizons/Manifest
new file mode 100644
index 00000000..259d226a
--- /dev/null
+++ b/games-strategy/unknown-horizons/Manifest
@@ -0,0 +1,4 @@
+DIST unknown-horizons-2011.2.tar.xz 71843004 SHA256 f64bc787c6094f420a4d7a5f3181fd24d395034a8b2ccbea6799e7cb1ab06092
+DIST unknown-horizons-2012.1.tar.xz 96318876 SHA256 109fd61026491c7c259cc552dd2c1ac90214bde42eab7cbc736009396abb870a
+EBUILD unknown-horizons-2011.2.ebuild 744 SHA256 2ce71ea238d11c95cd626ba7c2a98d346282b38d294da49d9695344ae742f5df SHA512 e794dd406c34d6318e70b8128fc5e2b40eb63fc2885fa8bc187acf9968543dba25e0ad8f14a78ad4dc1853922c621c5335b502b985a87ab3e062b8c487c66e3a WHIRLPOOL 8fa07f61eb9e114635ccbe682ae7564deee2c0dbe2548f00d23dd04edc427d4006c3800b222b794104139e32947f7f261b5fccd326f4b66c592b08543f03ea50
+EBUILD unknown-horizons-2012.1.ebuild 717 SHA256 606022db3fcdd20555c6ab4226c74c75452a05279b7795ff91bf9bfae79e1274 SHA512 7a8c69d52d61f49e8899c4ceea20d9c1406484ba38da737e7b1417b175c02d135166e95fd4ef9c0c3e7a3080d0ff3a006686e85584b8ddff55fd1e50eaa5efbe WHIRLPOOL ff074d465d58823291bdfcc987a091d465b7ba6432713d314bb5f5a61f073ea9013442a4046ff1083ae9f933ca9ddc1cd6beb71c4bc471493d6d8a60fe5f616d
diff --git a/games-strategy/unknown-horizons/unknown-horizons-2011.2.ebuild b/games-strategy/unknown-horizons/unknown-horizons-2011.2.ebuild
new file mode 100644
index 00000000..3bb60a37
--- /dev/null
+++ b/games-strategy/unknown-horizons/unknown-horizons-2011.2.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+
+PYTHON_DEPEND="2:2.7"
+PYTHON_USE_WITH="sqlite"
+
+inherit distutils games
+DESCRIPTION="Anno-like real time strategy game"
+HOMEPAGE="http://www.unknown-horizons.org/"
+
+SRC_URI="mirror://sourceforge/unknownhorizons/${P}.tar.xz"
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+IUSE=""
+
+DEPEND="dev-python/pyyaml
+ =games-engines/fife-0.3.2.2
+ dev-python/python-distutils-extra"
+
+RDEPEND="$DEPEND"
+
+S="${WORKDIR}"/${PN}
+
+src_compile() {
+ distutils_src_compile build_i18n
+}
+
+src_install() {
+ # FIXME: exe and data-files goes into wrong place, games.gentoo.org policy
+ # violation
+ distutils_src_install
+ prepgamesdirs
+}
diff --git a/games-strategy/unknown-horizons/unknown-horizons-2012.1.ebuild b/games-strategy/unknown-horizons/unknown-horizons-2012.1.ebuild
new file mode 100644
index 00000000..5d3102b3
--- /dev/null
+++ b/games-strategy/unknown-horizons/unknown-horizons-2012.1.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+
+PYTHON_DEPEND="2:2.7"
+PYTHON_USE_WITH="sqlite berkdb"
+
+inherit distutils games
+DESCRIPTION="Anno-like real time strategy game"
+HOMEPAGE="http://www.unknown-horizons.org/"
+
+SRC_URI="mirror://sourceforge/unknownhorizons/${P}.tar.xz"
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+IUSE=""
+
+DEPEND="dev-python/pyyaml
+ =games-engines/fife-0.3.3-r3"
+
+RDEPEND="$DEPEND"
+
+S="${WORKDIR}"/${PN}
+
+src_compile() {
+ distutils_src_compile build_i18n
+}
+
+src_install() {
+ # FIXME: exe and data-files goes into wrong place, games.gentoo.org policy
+ # violation
+ distutils_src_install
+ prepgamesdirs
+}
diff --git a/games-strategy/zod-engine/Manifest b/games-strategy/zod-engine/Manifest
new file mode 100644
index 00000000..397f0d33
--- /dev/null
+++ b/games-strategy/zod-engine/Manifest
@@ -0,0 +1,3 @@
+AUX zod-engine-20110906-proper-linux-support.patch 41849 SHA256 98a7cef026ffd24132512095c314ea57ae1668b74b228c97262dea035ae15195 SHA512 8c5a28b7abdf59f15d60f08deac4fb8c63a72fd0eac92467d2fa35293272ab5bc3a29c08f9ffc84fcd99363660941028de9133ce0d0e64281efc97828075db8a WHIRLPOOL 557f9cc6b1cc476712feeb9bd61aab6520723a60504e9a986bfeb925c5557a4e640a1f6a6224b050b9c136f75ebb4e3b99483a8691a26425f9d4eaf10c0f8fbc
+DIST zod_linux-2011-09-06.tar.gz 40237117 SHA256 02d8cfbc0da8901a36ea14cdffb72fb7780ea718073d4b6c9e0409cdacca356c
+EBUILD zod-engine-20110906.ebuild 1948 SHA256 4f31aba6e68bb95aa1d5119ed2eea02eda3983c9d15721c946fee2a9c945f490 SHA512 84acd41f2c84817f20a526af61ad5107892608ef033f3063f4038dd22e1ace5ec72f0f7f7ce66ae73feedcb12384908d940ed7cf323649a92c0c2174c896efc2 WHIRLPOOL 03cb6e5467cfb5c1a235be63525c185f41df9ed7f097dad7308fe0c209f156a904aec39862b5364937b2ff588ce455a361448f7983bf33d3dee87e0bbb18188f
diff --git a/games-strategy/zod-engine/files/zod-engine-20110906-proper-linux-support.patch b/games-strategy/zod-engine/files/zod-engine-20110906-proper-linux-support.patch
new file mode 100644
index 00000000..d81e6049
--- /dev/null
+++ b/games-strategy/zod-engine/files/zod-engine-20110906-proper-linux-support.patch
@@ -0,0 +1,1419 @@
+diff -burN zod_engine/zod_launcher_src/common.cpp zod_engine.new/zod_launcher_src/common.cpp
+--- zod_engine/zod_launcher_src/common.cpp 2011-03-22 12:05:11.000000000 +0100
++++ zod_engine.new/zod_launcher_src/common.cpp 2012-05-05 22:50:56.000000000 +0200
+@@ -9,24 +9,216 @@
+ #include <windows.h>
+ #include <time.h>
+ #include <direct.h>
++
++#define OSPATH_SEP '\\'
++
+ #else
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <sys/time.h>
++
++#define OSPATH_SEP '/'
++
+ #endif
+
+ namespace COMMON
+ {
+
+-void create_folder(char *foldername)
++//base data path for the engine
++static char base_path[FILENAME_MAX];
++//home (user specific) data path for the engine
++static char home_path[FILENAME_MAX];
++
++static bool path_concat(const char *base, const char *file, char *dest)
++{
++ size_t i;
++ size_t len;
++ char c;
++ bool was_sep;
++
++ // base path is an OS specific path
++ len = 0;
++ for (i = 0; len < (FILENAME_MAX - 1) && base[i] != '\0'; i++)
++ dest[len++] = base[i];
++
++ // this also catches base[i] != '\0'
++ if (len == (FILENAME_MAX - 1))
++ return false;
++
++
++ // ensure base is terminated by OSPATH_SEP
++ if (len == 0 || dest[len - 1] != OSPATH_SEP)
++ dest[len++] = OSPATH_SEP;
++
++ was_sep = true;
++
++ // file name could have both '/' or '\\' for path separation
++ for (i = 0; len < (FILENAME_MAX - 1) && file[i] != '\0'; i++) {
++ char c = file[i];
++ if (c == '/' || c == '\\') {
++ // ignore double separators
++ if (was_sep)
++ continue;
++
++ c = OSPATH_SEP;
++ was_sep = true;
++ } else {
++ was_sep = false;
++ }
++
++ dest[len++] = c;
++ }
++
++ if (file[i] != '\0')
++ return false;
++
++ dest[len] = '\0';
++ return true;
++}
++
++static bool file_exists(const char*filename)
++{
++#ifdef _WIN32
++ DWORD attrs = GetFileAttributes(filename);
++ return (attrs != INVALID_FILE_ATTRIBUTES);
++
++#else
++
++ return (access(filename, R_OK) == 0);
++
++#endif
++
++}
++
++void init_file_paths(const char *bin_path)
+ {
+-#ifdef WIN32 //if windows
++ base_path[0] = '\0';
++
++#ifdef DATA_PATH
++ //compilation defined base path, ignore if too long
++ if (strlen(DATA_PATH) < FILENAME_MAX)
++ strcpy(base_path, DATA_PATH);
++#endif
++
++ if (base_path[0] == '\0' && bin_path && bin_path[0] != '\0') {
++ //default to binary path dirname
++ char dirname[FILENAME_MAX];
++ size_t len;
++
++ len = strlen(bin_path);
++ if (len < FILENAME_MAX) {
++ strcpy(base_path, bin_path);
++ //find the last separator
++ do len--; while (len > 0 && base_path[len] != OSPATH_SEP);
++
++ base_path[len] = '\0';
++ }
++ }
++
++ // if no explicit directory is specified
++ // default to current working directory
++ if (base_path[0] == '\0')
++ strcpy(base_path, ".");
++
++ // get home path
++ home_path[0] = '\0';
++
++#ifdef _WIN32
++ // on Windows home path is equivalent to base path
++ strcpy(home_path, base_path);
++
++#else
++ // on Unix platforms use a specific directory in home
++ const char *home = getenv("HOME");
++ if (home && home[0] != '\0') {
++ if (path_concat(home, ".zod-engine", home_path))
++ create_folder(home_path);
++ else
++ home_path[0] = '\0';
++ }
++
++#endif
++
++}
++
++void create_folder(const char *foldername)
++{
++#ifdef _WIN32 //if windows
+ mkdir(foldername);
+ #else
+ mkdir(foldername,-1);
+ #endif
+ }
+
++FILE *open_file_read(const char *filename, bool binary)
++{
++ char path[FILENAME_MAX];
++ const char *mode;
++ FILE *fp;
++
++ fp = NULL;
++ mode = (binary)? "rb" : "r";
++ if (home_path[0] != '\0') {
++ // if home directory is available, pick the file from there,
++ // as there is where we can find user specific overrides
++ // of our files
++ if (path_concat(home_path, filename, path))
++ fp = fopen(path, mode);
++ }
++
++ if (!fp) {
++ // retrieve the file from the data directory
++ if (path_concat(base_path, filename, path))
++ fp = fopen(path, mode);
++ }
++
++ return fp;
++}
++
++FILE *open_file_write(const char *filename, bool binary, bool append)
++{
++ FILE *fp = NULL;
++ if (home_path[0] != '\0') {
++ //files can only be created in home path
++ char path[FILENAME_MAX];
++
++ if (path_concat(home_path, filename, path)) {
++ // determine open mode
++ char mode[3];
++
++ mode[0] = (append)? 'a' : 'w';
++ mode[1] = (binary)? 'b' : '\0';
++ mode[2] = '\0';
++ fp = fopen(path, mode);
++ }
++ }
++
++ return fp;
++}
++
++bool get_os_path(const char *filename, bool read_only, char *dest)
++{
++
++ if (read_only)
++ {
++ if (home_path[0])
++ {
++ if (path_concat(home_path, filename, dest) && file_exists(dest))
++ return true;
++ }
++
++ return path_concat(base_path, filename, dest) && file_exists(dest);
++
++ }
++ else
++ {
++ if (home_path[0] != '\0')
++ return path_concat(home_path, filename, dest);
++ else
++ return false;
++ }
++}
++
+ double current_time()
+ {
+ #ifdef WIN32
+diff -burN zod_engine/zod_launcher_src/common.h zod_engine.new/zod_launcher_src/common.h
+--- zod_engine/zod_launcher_src/common.h 2011-03-22 12:05:11.000000000 +0100
++++ zod_engine.new/zod_launcher_src/common.h 2012-05-05 22:51:24.000000000 +0200
+@@ -3,11 +3,16 @@
+
+ namespace COMMON
+ {
++
++ extern void init_file_paths(const char *bin_path);
++ extern bool get_os_path(const char *filename, bool read_only, char *dest);
++ extern void create_folder(const char *foldername);
++ extern FILE *open_file_read(const char *filename, bool binary);
++ extern FILE *open_file_write(const char *filename, bool binary, bool append);
+ extern void split(char *dest, char *message, char split, int *initial, int d_size, int m_size);
+ extern void clean_newline(char *message, int size);
+ extern void lcase(char *message, int m_size);
+ extern double current_time();
+- extern void create_folder(char *foldername);
+ extern void uni_pause(int m_sec);
+ extern char *wtoc_s(const wchar_t *input);
+ extern char *wtoc(const wchar_t *input, char *dest, int size);
+diff -burN zod_engine/zod_launcher_src/makefile zod_engine.new/zod_launcher_src/makefile
+--- zod_engine/zod_launcher_src/makefile 2011-03-22 12:13:12.000000000 +0100
++++ zod_engine.new/zod_launcher_src/makefile 2012-05-06 04:09:08.000000000 +0200
+@@ -1,2 +1,11 @@
++CC=g++
++CFLAGS=-g `wx-config --cppflags`
++LDFLAGS=`wx-config --libs`
++EXENAME=zod_launcher
++
++ifdef DATA_PATH
++ CFLAGS += -DDATA_PATH=\"$(DATA_PATH)\"
++endif
++
+ default:
+- g++ -g -o zod_launcher *.cpp `wx-config --cppflags` `wx-config --libs`
++ $(CC) $(CFLAGS) -o $(EXENAME) *.cpp $(LDFLAGS)
+diff -burN zod_engine/zod_launcher_src/store_settings.cpp zod_engine.new/zod_launcher_src/store_settings.cpp
+--- zod_engine/zod_launcher_src/store_settings.cpp 2011-03-22 12:05:11.000000000 +0100
++++ zod_engine.new/zod_launcher_src/store_settings.cpp 2012-05-06 16:14:49.000000000 +0200
+@@ -11,7 +11,7 @@
+ {
+ FILE *fp;
+
+- fp = fopen("zod_launcher_settings.txt", "w");
++ fp = open_file_write("zod_launcher_settings.txt", false, false);
+
+ if(!fp) return;
+
+@@ -45,7 +45,7 @@
+ {
+ FILE *fp;
+
+- fp = fopen("zod_launcher_settings.txt", "r");
++ fp = open_file_read("zod_launcher_settings.txt", false);
+
+ if(!fp) return;
+
+I file binari zod_engine/zod_launcher_src/zod_launcher e zod_engine.new/zod_launcher_src/zod_launcher sono diversi
+diff -burN zod_engine/zod_launcher_src/zod_launcherApp.cpp zod_engine.new/zod_launcher_src/zod_launcherApp.cpp
+--- zod_engine/zod_launcher_src/zod_launcherApp.cpp 2011-03-22 12:05:11.000000000 +0100
++++ zod_engine.new/zod_launcher_src/zod_launcherApp.cpp 2012-05-05 22:32:45.000000000 +0200
+@@ -9,11 +9,17 @@
+
+ #include "zod_launcherApp.h"
+ #include "zod_launcherFrm.h"
++#include "common.h"
+
+ IMPLEMENT_APP(zod_launcherFrmApp)
+
+ bool zod_launcherFrmApp::OnInit()
+ {
++ // initialize file system
++ wxString bin_path(argv[0]);
++ COMMON::init_file_paths(bin_path.mb_str(wxConvUTF8));
++
++ // create form
+ zod_launcherFrm* frame = new zod_launcherFrm(NULL);
+ SetTopWindow(frame);
+ frame->Show();
+diff -burN zod_engine/zod_launcher_src/zod_launcherFrm.cpp zod_engine.new/zod_launcher_src/zod_launcherFrm.cpp
+--- zod_engine/zod_launcher_src/zod_launcherFrm.cpp 2011-03-22 12:35:01.000000000 +0100
++++ zod_engine.new/zod_launcher_src/zod_launcherFrm.cpp 2012-05-06 16:16:19.000000000 +0200
+@@ -10,6 +10,7 @@
+
+ #include "zod_launcherFrm.h"
+ #include "store_settings.h"
++#include "common.h"
+
+ //Do not add custom headers between
+ //Header Include Start and Header Include End
+@@ -215,7 +216,7 @@
+ #ifdef _WIN32
+ message = wxT("zod_engine.exe");
+ #else
+- message = wxT("./zod");
++ message = wxT("zod");
+ #endif
+
+ if(WxEdit1->GetValue().length())
+diff -burN zod_engine/zod_src/cgatling.cpp zod_engine.new/zod_src/cgatling.cpp
+--- zod_engine/zod_src/cgatling.cpp 2011-09-06 17:35:10.000000000 +0200
++++ zod_engine.new/zod_src/cgatling.cpp 2012-05-05 17:26:16.000000000 +0200
+@@ -53,7 +53,7 @@
+ for(j=0;j<MAX_ANGLE_TYPES;j++)
+ {
+ sprintf(filename_c, "assets/units/cannons/gatling/empty_r%03d.png", ROTATION[j]);
+- temp_surface = IMG_Load(filename_c);
++ temp_surface = ZSDL_IMG_Load(filename_c, false);
+ fire[0][j].LoadBaseImage(temp_surface, false);
+ passive[0][j].LoadBaseImage(temp_surface, false);
+ //fire[0][j] = passive[0][j] = IMG_Load_Error(filename_c);
+diff -burN zod_engine/zod_src/common.cpp zod_engine.new/zod_src/common.cpp
+--- zod_engine/zod_src/common.cpp 2011-09-06 17:35:10.000000000 +0200
++++ zod_engine.new/zod_src/common.cpp 2012-05-06 03:00:00.000000000 +0200
+@@ -3,12 +3,16 @@
+ #include <ctype.h>
+ #include <math.h>
+ #include <string.h>
++#include <algorithm>
+ #include "common.h"
+
+ #ifdef _WIN32
+ #include <windows.h>
+ #include <time.h>
+ #include <direct.h>
++
++#define OSPATH_SEP '\\'
++
+ #else
+ #include <sys/stat.h>
+ #include <unistd.h>
+@@ -16,20 +20,257 @@
+ #include <sys/types.h>
+ #include <dirent.h>
+ #include <errno.h>
++
++#define OSPATH_SEP '/'
++
+ #endif
+
+ namespace COMMON
+ {
+
+-void create_folder(char *foldername)
++//base data path for the engine
++static char base_path[FILENAME_MAX];
++//home (user specific) data path for the engine
++static char home_path[FILENAME_MAX];
++
++static bool path_concat(const char *base, const char *file, char *dest)
++{
++ size_t i;
++ size_t len;
++ char c;
++ bool was_sep;
++
++ // base path is an OS specific path
++ len = 0;
++ for (i = 0; len < (FILENAME_MAX - 1) && base[i] != '\0'; i++)
++ dest[len++] = base[i];
++
++ // this also catches base[i] != '\0'
++ if (len == (FILENAME_MAX - 1))
++ return false;
++
++
++ // ensure base is terminated by OSPATH_SEP
++ if (len == 0 || dest[len - 1] != OSPATH_SEP)
++ dest[len++] = OSPATH_SEP;
++
++ was_sep = true;
++
++ // file name could have both '/' or '\\' for path separation
++ for (i = 0; len < (FILENAME_MAX - 1) && file[i] != '\0'; i++) {
++ char c = file[i];
++ if (c == '/' || c == '\\') {
++ // ignore double separators
++ if (was_sep)
++ continue;
++
++ c = OSPATH_SEP;
++ was_sep = true;
++ } else {
++ was_sep = false;
++ }
++
++ dest[len++] = c;
++ }
++
++ if (file[i] != '\0')
++ return false;
++
++ dest[len] = '\0';
++ return true;
++}
++
++static vector<string> scan_folder(string foldername)
++{
++ vector<string> list;
++
++#ifdef _WIN32
++
++ HANDLE hFind = INVALID_HANDLE_VALUE;
++ WIN32_FIND_DATA ffd;
++
++ foldername += "*";
++
++ hFind = FindFirstFile(foldername.c_str(), &ffd);
++
++ if(INVALID_HANDLE_VALUE == hFind) return filelist;
++
++ do
++ {
++ if(!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
++ list.push_back((char*)ffd.cFileName);
++ }
++ while (FindNextFile(hFind, &ffd) != 0);
++
++ FindClose(hFind);
++
++#else
++
++ DIR *dp;
++ struct dirent *dirp;
++
++ dp = opendir(foldername.c_str());
++
++ if (dp) {
++
++ while ((dirp = readdir(dp)) != NULL)
++ {
++ if(dirp->d_type == DT_REG)
++ list.push_back(dirp->d_name);
++ }
++
++ closedir(dp);
++ }
++
++#endif
++
++ return list;
++}
++
++static bool file_exists(const char*filename)
++{
++#ifdef _WIN32
++
++ DWORD attrs = GetFileAttributes(filename);
++ return (attrs != INVALID_FILE_ATTRIBUTES);
++
++#else
++
++ return (access(filename, R_OK) == 0);
++
++#endif
++
++}
++
++void init_file_paths(const char *bin_path)
++{
++ base_path[0] = '\0';
++
++#ifdef DATA_PATH
++ //compilation defined base path, ignore if too long
++ if (strlen(DATA_PATH) < FILENAME_MAX)
++ strcpy(base_path, DATA_PATH);
++#endif
++
++ if (base_path[0] == '\0' && bin_path && bin_path[0] != '\0') {
++ //default to binary path dirname
++ char dirname[FILENAME_MAX];
++ size_t len;
++
++ len = strlen(bin_path);
++ if (len < FILENAME_MAX) {
++ strcpy(base_path, bin_path);
++ //find the last separator
++ do len--; while (len > 0 && base_path[len] != OSPATH_SEP);
++
++ base_path[len] = '\0';
++ }
++ }
++
++ // if no explicit directory is specified
++ // default to current working directory
++ if (base_path[0] == '\0')
++ strcpy(base_path, ".");
++
++ // get home path
++ home_path[0] = '\0';
++
++#ifdef _WIN32
++ // on Windows home path is equivalent to base path
++ strcpy(home_path, base_path);
++
++#else
++ // on Unix platforms use a specific directory in home
++ const char *home = getenv("HOME");
++ if (home && home[0] != '\0') {
++ if (path_concat(home, ".zod-engine", home_path))
++ create_folder(home_path);
++ else
++ home_path[0] = '\0';
++ }
++
++#endif
++
++}
++
++void create_folder(const char *foldername)
+ {
+-#ifdef WIN32 //if windows
++#ifdef _WIN32 //if windows
+ mkdir(foldername);
+ #else
+ mkdir(foldername,-1);
+ #endif
+ }
+
++bool get_os_path(const char *filename, bool read_only, char *dest)
++{
++
++ if (read_only)
++ {
++ if (home_path[0])
++ {
++ if (path_concat(home_path, filename, dest) && file_exists(dest))
++ return true;
++ }
++
++ return path_concat(base_path, filename, dest) && file_exists(dest);
++
++ }
++ else
++ {
++ if (home_path[0] != '\0')
++ return path_concat(home_path, filename, dest);
++ else
++ return false;
++ }
++}
++
++FILE *open_file_read(const char *filename, bool binary)
++{
++ char path[FILENAME_MAX];
++ const char *mode;
++ FILE *fp;
++
++ fp = NULL;
++ mode = (binary)? "rb" : "r";
++ if (home_path[0] != '\0') {
++ // if home directory is available, pick the file from there,
++ // as there is where we can find user specific overrides
++ // of our files
++ if (path_concat(home_path, filename, path))
++ fp = fopen(path, mode);
++ }
++
++ if (!fp) {
++ // retrieve the file from the data directory
++ if (path_concat(base_path, filename, path))
++ fp = fopen(path, mode);
++ }
++
++ return fp;
++}
++
++FILE *open_file_write(const char *filename, bool binary, bool append)
++{
++ FILE *fp = NULL;
++ if (home_path[0] != '\0') {
++ //files can only be created in home path
++ char path[FILENAME_MAX];
++
++ if (path_concat(home_path, filename, path)) {
++ // determine open mode
++ char mode[3];
++
++ mode[0] = (append)? 'a' : 'w';
++ mode[1] = (binary)? 'b' : '\0';
++ mode[2] = '\0';
++ fp = fopen(path, mode);
++ }
++ }
++
++ return fp;
++}
++
+ double current_time()
+ {
+ #ifdef WIN32
+@@ -139,7 +380,18 @@
+ #ifdef _WIN32 //if windows
+ Sleep(m_sec); //win version
+ #else
+- usleep(m_sec * 1000); //lin version
++ struct timespec ts; //use nanosleep()
++ int secs;
++ int mills;
++ int res;
++
++ secs = m_sec / 1000;
++ mills = m_sec - secs * 1000;
++ ts.tv_sec = secs;
++ ts.tv_nsec = mills * 1000000L;
++
++ do res = nanosleep(&ts, &ts); while (res == -1 && errno == EINTR);
++
+ #endif
+ }
+
+@@ -229,7 +481,7 @@
+ lt = time(NULL);
+ ptr = localtime(&lt);
+
+- ofp = fopen("reg_log.txt","a");
++ ofp = open_file_write("reg_log.txt",false,true);
+
+ strcpy(timebuf, asctime(ptr));
+ clean_newline(timebuf, 100);
+@@ -259,7 +511,7 @@
+ {
+ FILE *fp;
+
+- fp = fopen(filename, "a");
++ fp = open_file_write(filename, false, true);
+
+ if(!fp) return false;
+
+@@ -270,51 +522,37 @@
+
+ vector<string> directory_filelist(string foldername)
+ {
+- vector<string> filelist;
++ vector<string> list;
++ vector<string> base;
++ vector<string> merged;
++ char path[FILENAME_MAX];
+
+-#ifdef _WIN32
++ // scan both base and home folders
++ if (path_concat(home_path, foldername.c_str(), path))
++ list = scan_folder(path);
+
+- HANDLE hFind = INVALID_HANDLE_VALUE;
+- WIN32_FIND_DATA ffd;
++ if (path_concat(base_path, foldername.c_str(), path))
++ base = scan_folder(path);
+
+- foldername += "*";
++ // for (size_t i=0;i<list.size(); i++) printf("list found:%s\n", list[i].c_str());
++ // for (size_t i=0;i<base.size(); i++) printf("base found:%s\n", base[i].c_str());
+
+- hFind = FindFirstFile(foldername.c_str(), &ffd);
++ // add unique entries for each file
++ sort(list.begin(), list.end(), sort_string_func);
++ merged = list;
++ for (size_t i = 0; i < base.size(); i++) {
++ vector<string>::iterator el;
+
+- if(INVALID_HANDLE_VALUE == hFind) return filelist;
++ el = lower_bound(list.begin(), list.end(), base[i], sort_string_func);
++ if (el != list.end() && *el == base[i])
++ continue;
+
+- do
+- {
+- if(!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+- filelist.push_back((char*)ffd.cFileName);
++ merged.push_back(base[i]);
+ }
+- while (FindNextFile(hFind, &ffd) != 0);
+-
+- FindClose(hFind);
+-
+-#else
+- DIR *dp;
+- struct dirent *dirp;
+-
+- if(!foldername.size()) foldername = ".";
+-
+- dp = opendir(foldername.c_str());
+-
+- if(!dp) return filelist;
+-
+- while ((dirp = readdir(dp)) != NULL)
+- {
+- if(dirp->d_type == DT_REG)
+- filelist.push_back(dirp->d_name);
+- }
+-
+- closedir(dp);
+-
+-#endif
+
+- //for(int i=0;i<filelist.size(); i++) printf("filelist found:%s\n", filelist[i].c_str());
++ // for (size_t i=0;i<merged.size(); i++) printf("merged found:%s\n", merged[i].c_str());
+
+- return filelist;
++ return merged;
+ }
+
+ void parse_filelist(vector<string> &filelist, string extension)
+diff -burN zod_engine/zod_src/common.h zod_engine.new/zod_src/common.h
+--- zod_engine/zod_src/common.h 2011-09-06 17:35:07.000000000 +0200
++++ zod_engine.new/zod_src/common.h 2012-05-05 20:39:00.000000000 +0200
+@@ -1,6 +1,7 @@
+ #ifndef _COMMON_H_
+ #define _COMMON_H_
+
++#include <stdio.h>
+ #include <string>
+ #include <vector>
+ #include <stdlib.h>
+@@ -19,12 +20,16 @@
+ int x, y;
+ };
+
++ extern void init_file_paths(const char *bin_path);
++ extern bool get_os_path(const char *filename, bool read_only, char*dest);
++ extern FILE *open_file_read(const char *filename, bool binary);
++ extern FILE *open_file_write(const char *filename, bool binary, bool append);
+ extern void split(char *dest, char *message, char split, int *initial, int d_size, int m_size);
+ extern void clean_newline(char *message, int size);
+ extern void lcase(char *message, int m_size);
+ extern void lcase(string &message);
+ extern double current_time();
+- extern void create_folder(char *foldername);
++ extern void create_folder(const char *foldername);
+ extern void uni_pause(int m_sec);
+ extern char *wtoc_s(const wchar_t *input);
+ extern char *wtoc(const wchar_t *input, char *dest, int size);
+diff -burN zod_engine/zod_src/cursor.cpp zod_engine.new/zod_src/cursor.cpp
+--- zod_engine/zod_src/cursor.cpp 2011-09-06 17:35:10.000000000 +0200
++++ zod_engine.new/zod_src/cursor.cpp 2012-05-05 17:31:02.000000000 +0200
+@@ -24,56 +24,56 @@
+ cursor[CURSOR_C][0][j].LoadBaseImage(filename_c);
+
+ sprintf(filename_c, "assets/cursors/placed_n%02d.png", j);
+- temp_surface = IMG_Load(filename_c);
++ temp_surface = ZSDL_IMG_Load(filename_c, false);
+ cursor[PLACED_C][0][j].LoadBaseImage(temp_surface, false);
+ cursor[PLACE_C][0][j].LoadBaseImage(temp_surface);
+ //cursor[PLACED_C][0][j] = IMG_Load_Error(filename_c);
+ //cursor[PLACE_C][0][j] = cursor[PLACED_C][0][j];
+
+ sprintf(filename_c, "assets/cursors/attacked_n%02d.png", j);
+- temp_surface = IMG_Load(filename_c);
++ temp_surface = ZSDL_IMG_Load(filename_c, false);
+ cursor[ATTACKED_C][0][j].LoadBaseImage(temp_surface, false);
+ cursor[ATTACK_C][0][j].LoadBaseImage(temp_surface);
+ //cursor[ATTACKED_C][0][j] = IMG_Load_Error(filename_c);
+ //cursor[ATTACK_C][0][j] = cursor[ATTACKED_C][0][j];
+
+ sprintf(filename_c, "assets/cursors/grabbed_n%02d.png", j);
+- temp_surface = IMG_Load(filename_c);
++ temp_surface = ZSDL_IMG_Load(filename_c, false);
+ cursor[GRABBED_C][0][j].LoadBaseImage(temp_surface, false);
+ cursor[GRAB_C][0][j].LoadBaseImage(temp_surface);
+ //cursor[GRABBED_C][0][j] = IMG_Load_Error(filename_c);
+ //cursor[GRAB_C][0][j] = cursor[GRABBED_C][0][j];
+
+ sprintf(filename_c, "assets/cursors/grenaded_n%02d.png", j);
+- temp_surface = IMG_Load(filename_c);
++ temp_surface = ZSDL_IMG_Load(filename_c, false);
+ cursor[GRENADED_C][0][j].LoadBaseImage(temp_surface, false);
+ cursor[GRENADE_C][0][j].LoadBaseImage(temp_surface);
+ //cursor[GRENADED_C][0][j] = IMG_Load_Error(filename_c);
+ //cursor[GRENADE_C][0][j] = cursor[GRENADED_C][0][j];
+
+ sprintf(filename_c, "assets/cursors/repaired_n%02d.png", j);
+- temp_surface = IMG_Load(filename_c);
++ temp_surface = ZSDL_IMG_Load(filename_c, false);
+ cursor[REPAIRED_C][0][j].LoadBaseImage(temp_surface, false);
+ cursor[REPAIR_C][0][j].LoadBaseImage(temp_surface);
+ //cursor[REPAIRED_C][0][j] = IMG_Load_Error(filename_c);
+ //cursor[REPAIR_C][0][j] = cursor[REPAIRED_C][0][j];
+
+ sprintf(filename_c, "assets/cursors/entered_n%02d.png", j);
+- temp_surface = IMG_Load(filename_c);
++ temp_surface = ZSDL_IMG_Load(filename_c, false);
+ cursor[ENTERED_C][0][j].LoadBaseImage(temp_surface, false);
+ cursor[ENTER_C][0][j].LoadBaseImage(temp_surface);
+ //cursor[ENTERED_C][0][j] = IMG_Load_Error(filename_c);
+ //cursor[ENTER_C][0][j] = cursor[ENTERED_C][0][j];
+
+ sprintf(filename_c, "assets/cursors/exited_n%02d.png", j);
+- temp_surface = IMG_Load(filename_c);
++ temp_surface = ZSDL_IMG_Load(filename_c, false);
+ cursor[EXITED_C][0][j].LoadBaseImage(temp_surface, false);
+ cursor[EXIT_C][0][j].LoadBaseImage(temp_surface);
+ //cursor[EXITED_C][0][j] = IMG_Load_Error(filename_c);
+ //cursor[EXIT_C][0][j] = cursor[EXITED_C][0][j];
+
+ sprintf(filename_c, "assets/cursors/cannoned_n%02d.png", j);
+- temp_surface = IMG_Load(filename_c);
++ temp_surface = ZSDL_IMG_Load(filename_c, false);
+ cursor[CANNONED_C][0][j].LoadBaseImage(temp_surface, false);
+ cursor[CANNON_C][0][j].LoadBaseImage(temp_surface);
+ //cursor[CANNONED_C][0][j] = IMG_Load_Error(filename_c);
+diff -burN zod_engine/zod_src/main.cpp zod_engine.new/zod_src/main.cpp
+--- zod_engine/zod_src/main.cpp 2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/main.cpp 2012-05-05 17:49:03.000000000 +0200
+@@ -42,7 +42,7 @@
+
+ printf("Welcome to the Zod Engine\n");
+
+- if(argc<=1) starting_conditions.setdefaults();
++ if(argc==1) starting_conditions.setdefaults();
+
+ //read in the arguments
+ starting_conditions.getoptions(argc, argv);
+@@ -51,6 +51,9 @@
+ //like we are trying to make a dedicated server that is supposed to connect to another server
+ starting_conditions.checkoptions();
+
++ //init engine search paths
++ COMMON::init_file_paths(argv[0]);
++
+ //init this for the bots
+ ZCore::CreateRandomBotBypassData(bot_bypass_data, bot_bypass_size);
+
+diff -burN zod_engine/zod_src/makefile zod_engine.new/zod_src/makefile
+--- zod_engine/zod_src/makefile 2011-09-06 17:35:07.000000000 +0200
++++ zod_engine.new/zod_src/makefile 2012-05-06 04:03:47.000000000 +0200
+@@ -18,6 +18,9 @@
+ MAPEDITOR_OFILES = map_editor.o $(CPPFILES:.cpp=.o)
+ DATE = `date +%m-%d-%y`
+
++ifdef DATA_PATH
++ CFLAGS += -D DATA_PATH=\"$(DATA_PATH)\"
++endif
+
+ main: $(OFILES)
+ $(CC) -o $(EXENAME) $(OFILES) $(LDFLAGS)
+diff -burN zod_engine/zod_src/map_editor.cpp zod_engine.new/zod_src/map_editor.cpp
+--- zod_engine/zod_src/map_editor.cpp 2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/map_editor.cpp 2012-05-05 21:50:20.000000000 +0200
+@@ -270,6 +270,8 @@
+ //check if args ok
+ if(!checkargs(argv[0])) return 0;
+
++ //init filesystem search paths
++ COMMON::init_file_paths(argv[0]);
+ //init SDL
+ SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
+ screen = SDL_SetVideoMode(800,600,32,SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_RESIZABLE);
+@@ -287,8 +289,15 @@
+ ZSDL_Surface::SetHasHud(false);
+
+ //TTF
++ char path[FILENAME_MAX];
++
+ TTF_Init();
+- ttf_font = TTF_OpenFont("assets/arial.ttf",10);
++ ttf_font = NULL;
++ if (COMMON::get_os_path("assets/arial.ttf", true, path))
++ {
++ ttf_font = TTF_OpenFont(path,10);
++ }
++
+ if (!ttf_font) printf("could not load arial.ttf\n");
+
+ //init stuff
+@@ -499,10 +508,8 @@
+ //save the map
+ {
+ bmp_filename = filename + ".bmp";
+-
+ printf("saving map screenshot: '%s'\n", bmp_filename.c_str());
+-
+- SDL_SaveBMP(print_surface, bmp_filename.c_str());
++ ZSDL_SaveBMP(print_surface, filename);
+ }
+
+ SDL_FreeSurface(print_surface);
+diff -burN zod_engine/zod_src/map_merger.cpp zod_engine.new/zod_src/map_merger.cpp
+--- zod_engine/zod_src/map_merger.cpp 2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/map_merger.cpp 2012-05-05 16:17:15.000000000 +0200
+@@ -16,6 +16,9 @@
+ return 0;
+ }
+
++ //init filesystem paths
++ COMMON::init_file_paths(argv[0]);
++
+ printf("argc:%d\n", argc);
+ printf("output_map:'%s'\n", argv[1]);
+ printf("direction:'%s'\n", argv[2]);
+diff -burN zod_engine/zod_src/ogrenades.cpp zod_engine.new/zod_src/ogrenades.cpp
+--- zod_engine/zod_src/ogrenades.cpp 2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/ogrenades.cpp 2012-05-05 17:28:25.000000000 +0200
+@@ -24,7 +24,7 @@
+
+ void OGrenades::Init()
+ {
+- render_img.LoadBaseImage("assets/other/map_items/grenades.png");// = ZSDL_IMG_Load("assets/other/map_items/grenades.png");
++ render_img.LoadBaseImage("assets/other/map_items/grenades.png");// = ZSDL_IMG_Load("assets/other/map_items/grenades.png", true);
+ }
+
+ void OGrenades::DoRender(ZMap &the_map, SDL_Surface *dest, int shift_x, int shift_y)
+diff -burN zod_engine/zod_src/ohut.cpp zod_engine.new/zod_src/ohut.cpp
+--- zod_engine/zod_src/ohut.cpp 2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/ohut.cpp 2012-05-05 17:28:13.000000000 +0200
+@@ -42,7 +42,7 @@
+ for(i=0;i<MAX_PLANET_TYPES;i++)
+ {
+ filename = "assets/other/map_items/hut_" + planet_type_string[i] + ".png";
+- render_img[i].LoadBaseImage(filename);// = ZSDL_IMG_Load(filename);
++ render_img[i].LoadBaseImage(filename);// = ZSDL_IMG_Load(filename, true);
+ }
+ }
+
+diff -burN zod_engine/zod_src/omapobject.cpp zod_engine.new/zod_src/omapobject.cpp
+--- zod_engine/zod_src/omapobject.cpp 2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/omapobject.cpp 2012-05-05 17:22:19.000000000 +0200
+@@ -42,7 +42,7 @@
+ for(i=0;i<MAP_ITEMS_AMOUNT;i++)
+ {
+ sprintf(filename_c, "assets/other/map_items/map_object%d.png", i);
+- render_img[i].LoadBaseImage(filename_c);// = ZSDL_IMG_Load(filename_c);
++ render_img[i].LoadBaseImage(filename_c);// = ZSDL_IMG_Load(filename_c, true);
+ }
+ }
+
+diff -burN zod_engine/zod_src/orock.cpp zod_engine.new/zod_src/orock.cpp
+--- zod_engine/zod_src/orock.cpp 2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/orock.cpp 2012-05-05 17:27:26.000000000 +0200
+@@ -70,7 +70,7 @@
+ for(i=0;i<MAX_PLANET_TYPES;i++)
+ {
+ filename = "assets/planets/rocks_" + planet_type_string[i] + ".png";
+- rock_pal[i].LoadBaseImage(filename);// = ZSDL_IMG_Load(filename);
++ rock_pal[i].LoadBaseImage(filename);// = ZSDL_IMG_Load(filename, true);
+
+ if(rock_pal[i].GetBaseSurface())
+ {
+diff -burN zod_engine/zod_src/tile_info_editor.cpp zod_engine.new/zod_src/tile_info_editor.cpp
+--- zod_engine/zod_src/tile_info_editor.cpp 2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/tile_info_editor.cpp 2012-05-05 16:20:57.000000000 +0200
+@@ -76,6 +76,8 @@
+
+ //seed
+ srand(time(0));
++ //init filesystem search paths
++ COMMON::init_file_paths(argv[0]);
+
+ //init SDL
+ SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
+@@ -94,8 +96,18 @@
+
+ //TTF
+ TTF_Init();
+- ttf_font = TTF_OpenFont("assets/arial.ttf",10);
++ FILE *fp = COMMON::open_file_read("assets/arial.ttf",true);
++ if (fp)
++ {
++ SDL_RWops *rw = SDL_RWFromFP(fp,1);
++
++ ttf_font = TTF_OpenFontRW(rw,1,10);
+ if (!ttf_font) printf("could not load arial.ttf\n");
++ }
++ else
++ {
++ printf("cannot find arial.ttf\n");
++ }
+
+ //init map class
+ ZMap::Init();
+diff -burN zod_engine/zod_src/zcore.cpp zod_engine.new/zod_src/zcore.cpp
+--- zod_engine/zod_src/zcore.cpp 2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/zcore.cpp 2012-05-05 16:25:45.000000000 +0200
+@@ -111,7 +111,7 @@
+ //clients and servers on different threads may use this function
+ SDL_LockMutex(check_mutex);
+
+- fp = fopen("registration.zkey", "r");
++ fp = COMMON::open_file_read("registration.zkey", false);
+
+ if(!fp)
+ {
+diff -burN zod_engine/zod_src/zfont.cpp zod_engine.new/zod_src/zfont.cpp
+--- zod_engine/zod_src/zfont.cpp 2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/zfont.cpp 2012-05-05 17:29:09.000000000 +0200
+@@ -16,7 +16,7 @@
+ for(i=0;i<MAX_CHARACTERS;i++)
+ {
+ sprintf(filename_c, "assets/fonts/%s/char_%03d.png", font_type_string[type].c_str(), i);
+- char_img[i] = IMG_Load(filename_c);
++ char_img[i] = ZSDL_IMG_Load(filename_c, false);
+ }
+
+ finished_init = true;
+diff -burN zod_engine/zod_src/zgfile.cpp zod_engine.new/zod_src/zgfile.cpp
+--- zod_engine/zod_src/zgfile.cpp 2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/zgfile.cpp 2012-05-05 16:24:41.000000000 +0200
+@@ -16,7 +16,7 @@
+ {
+ FILE *fp;
+
+- fp = fopen(ZGFILE_NAME, "rb");
++ fp = COMMON::open_file_read(ZGFILE_NAME, true);
+
+ if(!fp)
+ {
+@@ -90,7 +90,7 @@
+ return;
+ }
+
+- fp = fopen(ZGFILE_NAME, "ab");
++ fp = COMMON::open_file_write(ZGFILE_NAME, true, true);
+
+ if(!fp)
+ {
+@@ -166,7 +166,7 @@
+ return NULL;
+ }
+
+- fp = fopen(ZGFILE_NAME, "rb");
++ fp = COMMON::open_file_read(ZGFILE_NAME, true);
+
+ if(!fp)
+ {
+diff -burN zod_engine/zod_src/zmap.cpp zod_engine.new/zod_src/zmap.cpp
+--- zod_engine/zod_src/zmap.cpp 2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/zmap.cpp 2012-05-05 17:18:57.000000000 +0200
+@@ -69,7 +69,7 @@
+
+ //load BMP palette
+ filename = "assets/planets/" + planet_type_string[i] + ".bmp";
+- planet_template[i].LoadBaseImage(filename);// = SDL_LoadBMP ( filename.c_str() );
++ planet_template[i].LoadBaseImage(filename);// = ZSDL_LoadBMP ( filename.c_str() );
+
+ //if(!planet_template[i])
+ // printf("unable to load:%s\n", filename.c_str());
+@@ -124,7 +124,7 @@
+ SDL_LockMutex(init_mutex);
+
+ filename = "assets/planets/" + planet_type_string[i] + ".tileinfo";
+- fp = fopen(filename.c_str(), "rb");
++ fp = COMMON::open_file_read(filename.c_str(), true);
+
+ if(!fp)
+ {
+@@ -195,7 +195,7 @@
+
+ filename = "assets/planets/" + planet_type_string[palette] + ".tileinfo";
+
+- fp = fopen(filename.c_str(), "wb");
++ fp = COMMON::open_file_write(filename.c_str(), true, false);
+
+ if(!fp) return 0;
+
+@@ -216,7 +216,7 @@
+ {
+ filename = "assets/planets/" + planet_type_string[i] + ".tileinfo";
+
+- fp = fopen(filename.c_str(), "wb");
++ fp = COMMON::open_file_write(filename.c_str(), true, false);
+
+ if(!fp)
+ {
+@@ -979,7 +979,7 @@
+ if(!filename) return 0;
+ if(!filename[0]) return 0;
+
+- fp = fopen(filename, "rb");
++ fp = COMMON::open_file_read(filename, true);
+
+ if(!fp) return 0;
+
+@@ -1075,7 +1075,7 @@
+ if(!filename) return 0;
+ if(!filename[0]) return 0;
+
+- fp = fopen(filename, "wb");
++ fp = COMMON::open_file_write(filename, true, false);
+
+ if(!fp) return 0;
+
+diff -burN zod_engine/zod_src/zmap_crater_graphics.cpp zod_engine.new/zod_src/zmap_crater_graphics.cpp
+--- zod_engine/zod_src/zmap_crater_graphics.cpp 2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/zmap_crater_graphics.cpp 2012-05-05 17:20:54.000000000 +0200
+@@ -33,7 +33,7 @@
+
+ sprintf(filename, "assets/planets/craters/crater_small_%s_t%02d_n%02d.png", planet_type_string[p].c_str(), t, n);
+
+- surface = IMG_Load(filename);
++ surface = ZSDL_IMG_Load(filename, false);
+
+ //not loaded?
+ if(!surface) break;
+@@ -60,7 +60,7 @@
+
+ sprintf(filename, "assets/planets/craters/crater_large_%s_t%02d_n%02d.png", planet_type_string[p].c_str(), t, n);
+
+- surface = IMG_Load(filename);
++ surface = ZSDL_IMG_Load(filename, false);
+
+ //not loaded?
+ if(!surface) break;
+diff -burN zod_engine/zod_src/zplayer.cpp zod_engine.new/zod_src/zplayer.cpp
+--- zod_engine/zod_src/zplayer.cpp 2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zplayer.cpp 2012-05-05 21:47:14.000000000 +0200
+@@ -367,12 +367,13 @@
+ Uint16 audio_format = AUDIO_S16; /* 16-bit stereo */
+ int audio_channels = 2;
+ int audio_buffers = 4096;
++ char font_path[FILENAME_MAX];
+
+ //init SDL
+ SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
+
+ //some stuff that just has to be right after init
+- game_icon = IMG_Load("assets/icon.png");
++ game_icon = ZSDL_IMG_Load("assets/icon.png", false);
+ //ffuts
+
+ if(game_icon) SDL_WM_SetIcon(game_icon, NULL);
+@@ -436,13 +437,18 @@
+
+ //TTF
+ TTF_Init();
+- ttf_font = TTF_OpenFont("assets/arial.ttf",10);
+- ttf_font_7 = TTF_OpenFont("assets/arial.ttf",7);
++ ttf_font = NULL;
++ if (COMMON::get_os_path("assets/arial.ttf", true, font_path))
++ {
++ ttf_font = TTF_OpenFont(font_path,10);
++ ttf_font_7 = TTF_OpenFont(font_path,7);
++ }
++
+ if (!ttf_font) printf("could not load assets/arial.ttf\n");
+
+ //splash sound best loaded here
+ //splash_music = MUS_Load_Error("assets/sounds/ABATTLE.mp3");
+- splash_screen.LoadBaseImage("assets/splash.bmp");// = IMG_Load("assets/splash.bmp");
++ splash_screen.LoadBaseImage("assets/splash.bmp");// = ZSDL_IMG_Load("assets/splash.bmp", false);
+ splash_screen.UseDisplayFormat(); //Regular needs this to do fading
+
+ // if(splash_screen)
+diff -burN zod_engine/zod_src/zplayer_events.cpp zod_engine.new/zod_src/zplayer_events.cpp
+--- zod_engine/zod_src/zplayer_events.cpp 2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zplayer_events.cpp 2012-05-05 16:30:09.000000000 +0200
+@@ -1402,7 +1402,7 @@
+ FILE *fp;
+ int ret;
+
+- fp = fopen("registration.zkey", "w");
++ fp = COMMON::open_file_write("registration.zkey", false, false);
+
+ if(!fp)
+ {
+diff -burN zod_engine/zod_src/zpsettings.cpp zod_engine.new/zod_src/zpsettings.cpp
+--- zod_engine/zod_src/zpsettings.cpp 2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zpsettings.cpp 2012-05-05 16:36:55.000000000 +0200
+@@ -35,7 +35,7 @@
+ {
+ FILE *fp;
+
+- fp = fopen(filename.c_str(), "r");
++ fp = COMMON::open_file_read(filename.c_str(), false);
+
+ if(!fp)
+ {
+@@ -106,7 +106,7 @@
+ {
+ FILE *fp;
+
+- fp = fopen(filename.c_str(), "w");
++ fp = COMMON::open_file_write(filename.c_str(), false, false);
+
+ if(!fp)
+ {
+diff -burN zod_engine/zod_src/zrobot.cpp zod_engine.new/zod_src/zrobot.cpp
+--- zod_engine/zod_src/zrobot.cpp 2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zrobot.cpp 2012-05-05 17:23:22.000000000 +0200
+@@ -168,7 +168,7 @@
+ SDL_Surface *temp_surface;
+
+ strcpy(filename_c, "assets/units/robots/null.png");
+- temp_surface = IMG_Load(filename_c);
++ temp_surface = ZSDL_IMG_Load(filename_c, false);
+
+ for(j=0;j<MAX_ANGLE_TYPES;j++)
+ stand[0][j].LoadBaseImage(temp_surface, false);
+diff -burN zod_engine/zod_src/zsdl.cpp zod_engine.new/zod_src/zsdl.cpp
+--- zod_engine/zod_src/zsdl.cpp 2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zsdl.cpp 2012-05-05 21:58:47.000000000 +0200
+@@ -442,26 +442,53 @@
+ return src;
+ }
+
+-SDL_Surface *ZSDL_IMG_Load(string filename)
++SDL_Surface *ZSDL_IMG_Load(string filename, bool to_display_format)
+ {
++ char path[FILENAME_MAX];
+ SDL_Surface *ret;
+
+- ret = IMG_Load(filename.c_str());
++ if(!COMMON::get_os_path(filename.c_str(), true, path))
++ return NULL;
+
+- if(!ret) printf("could not load:%s\n", filename.c_str());
++ ret = IMG_Load(path);
+
++ if (to_display_format)
+ ret = ZSDL_ConvertImage(ret);
+
+- //SDL_DisplayFormat
+-
+ return ret;
+ }
+
++bool ZSDL_SaveBMP(SDL_Surface *src, string filename)
++{
++ char path[FILENAME_MAX];
++
++ if (!COMMON::get_os_path(filename.c_str(), false, path))
++ {
++ printf("could not save:%s\n", filename.c_str());
++ return false;
++ }
++
++ return (SDL_SaveBMP(src, path) == 0);
++}
++
++SDL_Surface *ZSDL_LoadBMP(string filename)
++{
++ char path[FILENAME_MAX];
++
++ if (!COMMON::get_os_path(filename.c_str(), true, path))
++ {
++ printf("could not load:%s\n", filename.c_str());
++ return NULL;
++ }
++
++ return SDL_LoadBMP(path);
++}
++
+ SDL_Surface *IMG_Load_Error(string filename)
+ {
+ SDL_Surface *ret;
+
+- if(!(ret = ZSDL_IMG_Load(filename.c_str()))) printf("could not load:%s\n", filename.c_str());
++ if(!(ret = ZSDL_IMG_Load(filename.c_str(), true))) printf("could not load:%s\n", filename.c_str());
+
+ //SDL_DisplayFormat
+
+@@ -470,18 +497,24 @@
+
+ Mix_Music *MUS_Load_Error(string filename)
+ {
++ char path[FILENAME_MAX];
+ Mix_Music *ret;
+
+- if(!(ret = Mix_LoadMUS(filename.c_str()))) printf("could not load:%s\n", filename.c_str());
++ if (!COMMON::get_os_path(filename.c_str(), true, path)) printf("could not open:%s\n", filename.c_str());
++
++ if (!(ret = Mix_LoadMUS(path))) printf("could not load:%s\n", filename.c_str());
+
+ return ret;
+ }
+
+ Mix_Chunk *MIX_Load_Error(string filename)
+ {
++ char path[FILENAME_MAX];
+ Mix_Chunk *ret;
+
+- if(!(ret = Mix_LoadWAV(filename.c_str()))) printf("could not load:%s\n", filename.c_str());
++ if (!COMMON::get_os_path(filename.c_str(), true, path)) printf("could not open:%s\n", filename.c_str());
++
++ if (!(ret = Mix_LoadWAV(path))) printf("could not load:%s\n", filename.c_str());
+
+ return ret;
+ }
+diff -burN zod_engine/zod_src/zsdl.h zod_engine.new/zod_src/zsdl.h
+--- zod_engine/zod_src/zsdl.h 2011-09-06 17:35:09.000000000 +0200
++++ zod_engine.new/zod_src/zsdl.h 2012-05-05 17:34:05.000000000 +0200
+@@ -64,8 +64,10 @@
+ };
+
+ SDL_Surface *ZSDL_ConvertImage(SDL_Surface *src);
+-SDL_Surface *ZSDL_IMG_Load(string filename);
++SDL_Surface *ZSDL_IMG_Load(string filename, bool to_display_format);
+ SDL_Surface *IMG_Load_Error(string filename);
++bool ZSDL_SaveBMP(SDL_Surface *src, string filename);
++SDL_Surface *ZSDL_LoadBMP(string filename);
+ Mix_Music *MUS_Load_Error(string filename);
+ Mix_Chunk *MIX_Load_Error(string filename);
+ SDL_Surface *CopyImage(SDL_Surface *original);
+diff -burN zod_engine/zod_src/zsdl_opengl.cpp zod_engine.new/zod_src/zsdl_opengl.cpp
+--- zod_engine/zod_src/zsdl_opengl.cpp 2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zsdl_opengl.cpp 2012-05-05 17:32:31.000000000 +0200
+@@ -107,7 +107,7 @@
+ //set this for later debugging purposes
+ image_filename = filename;
+
+- SDL_Surface *surface = IMG_Load(filename.c_str());
++ SDL_Surface *surface = ZSDL_IMG_Load(filename.c_str(), false);
+
+ LoadBaseImage(surface);
+ }
+diff -burN zod_engine/zod_src/zserver.cpp zod_engine.new/zod_src/zserver.cpp
+--- zod_engine/zod_src/zserver.cpp 2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zserver.cpp 2012-05-06 02:44:12.000000000 +0200
+@@ -270,7 +270,7 @@
+ //if we can't read in the official list
+ //and we can't make one
+ //then just use the regular map list
+- if(!ReadSelectableMapList() && !ReadSelectableMapListFromFolder())
++ if(!ReadSelectableMapList() && !ReadSelectableMapListFromFolder("."))
+ selectable_map_list = map_list;
+ }
+
+@@ -454,7 +454,7 @@
+
+ map_list.clear();
+
+- fp = fopen(map_list_name.c_str(), "r");
++ fp = COMMON::open_file_read(map_list_name.c_str(), false);
+
+ if(!fp)
+ {
+@@ -496,7 +496,7 @@
+
+ selectable_map_list.clear();
+
+- fp = fopen(psettings.selectable_map_list.c_str(), "r");
++ fp = COMMON::open_file_read(psettings.selectable_map_list.c_str(), false);
+
+ if(!fp)
+ {
+diff -burN zod_engine/zod_src/zserver_events.cpp zod_engine.new/zod_src/zserver_events.cpp
+--- zod_engine/zod_src/zserver_events.cpp 2011-09-06 17:35:07.000000000 +0200
++++ zod_engine.new/zod_src/zserver_events.cpp 2012-05-05 16:32:42.000000000 +0200
+@@ -164,7 +164,7 @@
+ {
+ FILE *fp;
+
+- fp = fopen(p->map_name.c_str(), "rb");
++ fp = COMMON::open_file_read(p->map_name.c_str(), true);
+
+ if(fp)
+ {
+diff -burN zod_engine/zod_src/zsettings.cpp zod_engine.new/zod_src/zsettings.cpp
+--- zod_engine/zod_src/zsettings.cpp 2011-09-06 17:35:08.000000000 +0200
++++ zod_engine.new/zod_src/zsettings.cpp 2012-05-05 16:31:45.000000000 +0200
+@@ -393,7 +393,7 @@
+ {
+ FILE *fp;
+
+- fp = fopen(filename.c_str(), "r");
++ fp = COMMON::open_file_read(filename.c_str(), false);
+
+ if(!fp)
+ {
+@@ -555,7 +555,7 @@
+ {
+ FILE *fp;
+
+- fp = fopen(filename.c_str(), "w");
++ fp = COMMON::open_file_write(filename.c_str(), false, false);
+
+ if(!fp)
+ {
+diff -burN zod_engine/zod_src/zteam.cpp zod_engine.new/zod_src/zteam.cpp
+--- zod_engine/zod_src/zteam.cpp 2011-09-06 17:35:07.000000000 +0200
++++ zod_engine.new/zod_src/zteam.cpp 2012-05-05 17:31:56.000000000 +0200
+@@ -113,7 +113,7 @@
+ }
+
+ //save surface
+- SDL_SaveBMP(src, filename.c_str());
++ ZSDL_SaveBMP(src, filename);
+
+ //free surface
+ SDL_FreeSurface(src);
+@@ -264,7 +264,7 @@
+ if(team == ZTEAM_BASE_TEAM) return;
+
+ filename = "assets/teams/" + team_type_string[team] + "_palette.bmp";
+- surface = IMG_Load(filename.c_str());
++ surface = ZSDL_IMG_Load(filename.c_str(), false);
+
+ if(!surface)
+ {
+@@ -294,7 +294,7 @@
+
+ team_palette[team].SaveSurfacePalette(filename);
+
+- //SDL_SaveBMP(team_palette[team], filename.c_str());
++ //ZSDL_SaveBMP(team_palette[team], filename);
+ }
+
+ void ZTeam::SaveAllPalettes()
diff --git a/games-strategy/zod-engine/zod-engine-20110906.ebuild b/games-strategy/zod-engine/zod-engine-20110906.ebuild
new file mode 100644
index 00000000..86528d3e
--- /dev/null
+++ b/games-strategy/zod-engine/zod-engine-20110906.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v3
+# $Header: $
+
+EAPI="3"
+
+WX_GTK_VER="2.8"
+
+inherit wxwidgets eutils games
+
+MY_PN="zod_linux"
+MY_P="${MY_PN}-${PV:0:4}-${PV:4:2}-${PV:6:2}"
+
+DESCRIPTION="Zod Engine is a remake of the 1996 classic game by Bitmap Brothers called Z"
+HOMEPAGE="http://zod.sourceforge.net/"
+SRC_URI="mirror://sourceforge/zod/${MY_P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="
+ >=media-libs/libsdl-1.2[X]
+ >=media-libs/sdl-ttf-2.0[X]
+ >=media-libs/sdl-mixer-1.2[timidity]
+ >=media-libs/sdl-image-1.2
+ virtual/mysql
+ x11-libs/wxGTK:2.8[X]"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/zod_engine"
+
+src_prepare() {
+ # various fixes and proper linux platform and filesystem support
+ epatch "${FILESDIR}/${P}-proper-linux-support.patch"
+
+ # fix files, this project really should provide a make install
+
+ # remove Thumbs.db files
+ find . -type f -name Thumbs.db -exec rm -f {} \; || die
+ # remove GIMP .xcf files
+ find . -type f -name "*.xcf" -exec rm -f {} \; || die
+ # remove Windows .ico files, unused on Linux build
+ find . -type f -name "*.ico" -exec rm -f {} \; || die
+ # remove useless icescene file
+ rm -f "assets/WebCamScene.icescene" || die
+ # remove unused splash screen
+ rm -f "assets/splash.png" || die
+}
+
+src_compile() {
+ emake -C zod_src DATA_PATH="\"${GAMES_DATADIR}/${PN}\"" map_editor main || die
+ emake -C zod_launcher_src DATA_PATH="\"${GAMES_DATADIR}/${PN}\"" || die
+}
+
+src_install() {
+ # custom install procedure for Gentoo
+ insinto "${GAMES_DATADIR}/${PN}"
+ doins -r assets blank_maps *.map default_settings.txt *map_list.txt || die
+ dogamesbin zod_launcher_src/zod_launcher || die
+ dogamesbin zod_src/zod || die
+ dogamesbin zod_src/zod_map_editor || die
+
+ newicon assets/icon.png ${PN}.png || die
+ make_desktop_entry zod_launcher "Zod Engine" || die
+
+ dodoc zod_engine_help.txt map_editor_help.txt || die
+
+ prepgamesdirs
+}