summaryrefslogtreecommitdiff
path: root/games-strategy/megaglest
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /games-strategy/megaglest
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.xz
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'games-strategy/megaglest')
-rw-r--r--games-strategy/megaglest/Manifest2
-rw-r--r--games-strategy/megaglest/files/megaglest-3.11.1-cmake.patch28
-rw-r--r--games-strategy/megaglest/files/megaglest-3.11.1-static-build.patch63
-rw-r--r--games-strategy/megaglest/files/megaglest-3.9.1-cmake.patch46
-rw-r--r--games-strategy/megaglest/files/megaglest-3.9.1-static-build.patch63
-rw-r--r--games-strategy/megaglest/megaglest-3.11.1.ebuild162
-rw-r--r--games-strategy/megaglest/megaglest-3.9.1-r1.ebuild165
-rw-r--r--games-strategy/megaglest/metadata.xml31
8 files changed, 560 insertions, 0 deletions
diff --git a/games-strategy/megaglest/Manifest b/games-strategy/megaglest/Manifest
new file mode 100644
index 00000000000..b5cf59efaad
--- /dev/null
+++ b/games-strategy/megaglest/Manifest
@@ -0,0 +1,2 @@
+DIST megaglest-source-3.11.1.tar.xz 2863180 SHA256 94e28a9628f3593ce337ce663f258a125176b11128f16afb8c947f2763930841 SHA512 9e1d8eccff1889199ff0e4b0f1cc3d0193306cd9271a2c98f12a49d61a09789d0813d5f3dadfe7701d2446976992834c63287f0227d660dc9cc9d2ecef65e225 WHIRLPOOL 7a6b0908da7c6164f3baa71ea10c1f09fca86581b9da4930c3a0aa70e2c25d582349772d45ec8edee91ded2cbe1e68ee66e8756d1d23205c5d751eae135758b0
+DIST megaglest-source-3.9.1.tar.xz 2957360 SHA256 e62314b8108ba3c80706aa896f4fed5992a8ea8d82a410e09fbb242c4bf54edc SHA512 2a3d402aa68a1b1ee326bf49b6b6dee5ed561623b541ab47c1545596fa9c77f805245b66bd8457ecd82625a3f1d4868269a4a3888a54245c73d9cb6babbace70 WHIRLPOOL 59ad629c66633b2f320c7c80eef627f4326cbacb0cc48169c33b6783bfc26d1a8baef1773f0d05a1bc589ec5ae6bbedbb1f394c34616b166faa6e7f9630a22e5
diff --git a/games-strategy/megaglest/files/megaglest-3.11.1-cmake.patch b/games-strategy/megaglest/files/megaglest-3.11.1-cmake.patch
new file mode 100644
index 00000000000..527671246e9
--- /dev/null
+++ b/games-strategy/megaglest/files/megaglest-3.11.1-cmake.patch
@@ -0,0 +1,28 @@
+From e463986ba1f40210b40eff34c4aac727c7f2e571 Mon Sep 17 00:00:00 2001
+From: Michael Palimaka <kensington@gentoo.org>
+Date: Wed, 13 May 2015 04:22:45 +1000
+Subject: [PATCH] Fix build with >=cmake-3.2.
+
+The FindOpenGL module no longer pulls in X11 libraries.
+---
+ source/shared_lib/CMakeLists.txt | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/source/shared_lib/CMakeLists.txt b/source/shared_lib/CMakeLists.txt
+index 3da563e..e5a06fc 100644
+--- a/source/shared_lib/CMakeLists.txt
++++ b/source/shared_lib/CMakeLists.txt
+@@ -95,6 +95,10 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
+ SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${OPENGL_LIBRARY})
+ ENDIF()
+
++ IF(UNIX)
++ FIND_PACKAGE(X11 REQUIRED)
++ SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${X11_LIBRARIES})
++ ENDIF()
+
+ IF(WANT_XERCES)
+ FIND_PACKAGE(XercesC REQUIRED)
+--
+2.3.6
+
diff --git a/games-strategy/megaglest/files/megaglest-3.11.1-static-build.patch b/games-strategy/megaglest/files/megaglest-3.11.1-static-build.patch
new file mode 100644
index 00000000000..2586a561956
--- /dev/null
+++ b/games-strategy/megaglest/files/megaglest-3.11.1-static-build.patch
@@ -0,0 +1,63 @@
+commit 754a6eb9f81a4a40a2a0102ffe1bfdbba734b36a
+Author: hasufell <hasufell@gentoo.org>
+Date: Mon Nov 18 21:54:54 2013 +0100
+
+ fix static build
+
+diff --git a/mk/cmake/Modules/FindOGG.cmake b/mk/cmake/Modules/FindOGG.cmake
+index 2a026cc..8ca8a23 100644
+--- a/mk/cmake/Modules/FindOGG.cmake
++++ b/mk/cmake/Modules/FindOGG.cmake
+@@ -19,11 +19,11 @@
+
+ FIND_PATH(OGG_INCLUDE_DIR ogg/ogg.h)
+
+-#IF (OGG_STATIC AND NOT OGG_LIBRARY)
+-# FIND_LIBRARY(OGG_LIBRARY NAMES libogg.a ogg)
+-#ELSE()
+- FIND_LIBRARY(OGG_LIBRARY NAMES ogg)
+-#ENDIF()
++IF (OGG_STATIC AND NOT OGG_LIBRARY)
++ FIND_LIBRARY(OGG_LIBRARY NAMES libogg.a)
++ELSE()
++ FIND_LIBRARY(OGG_LIBRARY NAMES libogg.so)
++ENDIF()
+
+ #IF (OGG_STATIC AND NOT VORBIS_LIBRARY)
+ # FIND_LIBRARY(VORBIS_LIBRARY NAMES libvorbis.a vorbis)
+--- a/mk/cmake/Modules/FindXercesC.cmake
++++ b/mk/cmake/Modules/FindXercesC.cmake
+@@ -83,6 +83,9 @@
+ /usr/lib
+ /usr/local/lib
+ )
++
++ FIND_LIBRARY(ICUUC_LIBRARY NAMES libicuuc.a)
++ FIND_LIBRARY(ICUDATA_LIBRARY NAMES libicudata.a)
+
+ IF (XERCESC_INCLUDE AND XERCESC_LIBRARY)
+ MESSAGE(STATUS "Found static Xerces-C lib [${XERCESC_LIBRARY}]")
+@@ -90,7 +93,7 @@
+
+ IF(UNIX AND NOT APPLE)
+ #SET(XERCESC_LIBRARY "-Bstatic ${XERCESC_LIBRARY} -Bdynamic -licuuc -licudata")
+- SET(XERCESC_LIBRARY "-Bstatic ${XERCESC_LIBRARY}")
++ SET(XERCESC_LIBRARY "-Bstatic ${XERCESC_LIBRARY} ${ICUUC_LIBRARY} ${ICUDATA_LIBRARY}")
+ ENDIF()
+ ENDIF()
+ ENDIF()
+--- a/mk/cmake/Modules/FindFriBiDi.cmake
++++ b/mk/cmake/Modules/FindFriBiDi.cmake
+@@ -28,9 +28,9 @@
+ SET(FRIBIDI_NAMES ${FRIBIDI_NAMES} fribidi libfribidi)
+
+ OPTION(WANT_STATIC_LIBS "builds as many static libs as possible" OFF)
+-IF(WANT_STATIC_LIBS)
+- SET(FRIBIDI_NAMES fribidi.a libfribidi.a ${FRIBIDI_NAMES})
+-ENDIF()
++#IF(WANT_STATIC_LIBS)
++# SET(FRIBIDI_NAMES fribidi.a libfribidi.a ${FRIBIDI_NAMES})
++#ENDIF()
+
+ MESSAGE(STATUS "** Searching for library names: [${FRIBIDI_NAMES}] ...")
+
diff --git a/games-strategy/megaglest/files/megaglest-3.9.1-cmake.patch b/games-strategy/megaglest/files/megaglest-3.9.1-cmake.patch
new file mode 100644
index 00000000000..c7801466f5c
--- /dev/null
+++ b/games-strategy/megaglest/files/megaglest-3.9.1-cmake.patch
@@ -0,0 +1,46 @@
+From: Julian Ospald <hasufell@gentoo.org>
+Date: Mon Jan 27 00:46:56 UTC 2014
+Subject: fix installation
+
+--- megaglest-source-3.9.1.tar.xz/source/glest_game/CMakeLists.txt
++++ megaglest-source-3.9.1.tar.xz/source/glest_game/CMakeLists.txt
+@@ -310,9 +310,9 @@
+ "${PROJECT_SOURCE_DIR}/mk/linux/megaglest.png"
+ "${PROJECT_SOURCE_DIR}/mk/linux/megaglest.xpm"
+ "${PROJECT_SOURCE_DIR}/mk/linux/megaglest.bmp"
+- "${PROJECT_SOURCE_DIR}/data/glest_game/editor.ico"
++ "${PROJECT_SOURCE_DIR}/editor.ico"
+ "${PROJECT_SOURCE_DIR}/mk/linux/glest.ico"
+- "${PROJECT_SOURCE_DIR}/data/glest_game/g3dviewer.ico"
++ "${PROJECT_SOURCE_DIR}/g3dviewer.ico"
+ DESTINATION ${MEGAGLEST_ICON_INSTALL_PATH})
+ ELSE()
+
+From e463986ba1f40210b40eff34c4aac727c7f2e571 Mon Sep 17 00:00:00 2001
+From: Michael Palimaka <kensington@gentoo.org>
+Date: Wed, 13 May 2015 04:22:45 +1000
+Subject: [PATCH] Fix build with >=cmake-3.2.
+
+The FindOpenGL module no longer pulls in X11 libraries.
+---
+ source/shared_lib/CMakeLists.txt | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/source/shared_lib/CMakeLists.txt b/source/shared_lib/CMakeLists.txt
+index 3da563e..e5a06fc 100644
+--- a/source/shared_lib/CMakeLists.txt
++++ b/source/shared_lib/CMakeLists.txt
+@@ -95,6 +95,10 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
+ SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${OPENGL_LIBRARY})
+ ENDIF()
+
++ IF(UNIX)
++ FIND_PACKAGE(X11 REQUIRED)
++ SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${X11_LIBRARIES})
++ ENDIF()
+
+ IF(WANT_XERCES)
+ FIND_PACKAGE(XercesC REQUIRED)
+--
+2.3.6
+
diff --git a/games-strategy/megaglest/files/megaglest-3.9.1-static-build.patch b/games-strategy/megaglest/files/megaglest-3.9.1-static-build.patch
new file mode 100644
index 00000000000..2586a561956
--- /dev/null
+++ b/games-strategy/megaglest/files/megaglest-3.9.1-static-build.patch
@@ -0,0 +1,63 @@
+commit 754a6eb9f81a4a40a2a0102ffe1bfdbba734b36a
+Author: hasufell <hasufell@gentoo.org>
+Date: Mon Nov 18 21:54:54 2013 +0100
+
+ fix static build
+
+diff --git a/mk/cmake/Modules/FindOGG.cmake b/mk/cmake/Modules/FindOGG.cmake
+index 2a026cc..8ca8a23 100644
+--- a/mk/cmake/Modules/FindOGG.cmake
++++ b/mk/cmake/Modules/FindOGG.cmake
+@@ -19,11 +19,11 @@
+
+ FIND_PATH(OGG_INCLUDE_DIR ogg/ogg.h)
+
+-#IF (OGG_STATIC AND NOT OGG_LIBRARY)
+-# FIND_LIBRARY(OGG_LIBRARY NAMES libogg.a ogg)
+-#ELSE()
+- FIND_LIBRARY(OGG_LIBRARY NAMES ogg)
+-#ENDIF()
++IF (OGG_STATIC AND NOT OGG_LIBRARY)
++ FIND_LIBRARY(OGG_LIBRARY NAMES libogg.a)
++ELSE()
++ FIND_LIBRARY(OGG_LIBRARY NAMES libogg.so)
++ENDIF()
+
+ #IF (OGG_STATIC AND NOT VORBIS_LIBRARY)
+ # FIND_LIBRARY(VORBIS_LIBRARY NAMES libvorbis.a vorbis)
+--- a/mk/cmake/Modules/FindXercesC.cmake
++++ b/mk/cmake/Modules/FindXercesC.cmake
+@@ -83,6 +83,9 @@
+ /usr/lib
+ /usr/local/lib
+ )
++
++ FIND_LIBRARY(ICUUC_LIBRARY NAMES libicuuc.a)
++ FIND_LIBRARY(ICUDATA_LIBRARY NAMES libicudata.a)
+
+ IF (XERCESC_INCLUDE AND XERCESC_LIBRARY)
+ MESSAGE(STATUS "Found static Xerces-C lib [${XERCESC_LIBRARY}]")
+@@ -90,7 +93,7 @@
+
+ IF(UNIX AND NOT APPLE)
+ #SET(XERCESC_LIBRARY "-Bstatic ${XERCESC_LIBRARY} -Bdynamic -licuuc -licudata")
+- SET(XERCESC_LIBRARY "-Bstatic ${XERCESC_LIBRARY}")
++ SET(XERCESC_LIBRARY "-Bstatic ${XERCESC_LIBRARY} ${ICUUC_LIBRARY} ${ICUDATA_LIBRARY}")
+ ENDIF()
+ ENDIF()
+ ENDIF()
+--- a/mk/cmake/Modules/FindFriBiDi.cmake
++++ b/mk/cmake/Modules/FindFriBiDi.cmake
+@@ -28,9 +28,9 @@
+ SET(FRIBIDI_NAMES ${FRIBIDI_NAMES} fribidi libfribidi)
+
+ OPTION(WANT_STATIC_LIBS "builds as many static libs as possible" OFF)
+-IF(WANT_STATIC_LIBS)
+- SET(FRIBIDI_NAMES fribidi.a libfribidi.a ${FRIBIDI_NAMES})
+-ENDIF()
++#IF(WANT_STATIC_LIBS)
++# SET(FRIBIDI_NAMES fribidi.a libfribidi.a ${FRIBIDI_NAMES})
++#ENDIF()
+
+ MESSAGE(STATUS "** Searching for library names: [${FRIBIDI_NAMES}] ...")
+
diff --git a/games-strategy/megaglest/megaglest-3.11.1.ebuild b/games-strategy/megaglest/megaglest-3.11.1.ebuild
new file mode 100644
index 00000000000..7776e566b51
--- /dev/null
+++ b/games-strategy/megaglest/megaglest-3.11.1.ebuild
@@ -0,0 +1,162 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# google-breakpad
+# TODO: fribidi, libvorbis static
+
+EAPI=5
+VIRTUALX_REQUIRED="manual"
+inherit eutils flag-o-matic cmake-utils virtualx wxwidgets gnome2-utils games
+
+DESCRIPTION="Cross-platform 3D realtime strategy game"
+HOMEPAGE="http://www.megaglest.org/"
+SRC_URI="https://github.com/MegaGlest/megaglest-source/releases/download/${PV}/megaglest-source-${PV}.tar.xz"
+
+LICENSE="GPL-3 BitstreamVera"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug +editor fribidi cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 static +streflop +tools +unicode wxuniversal +model-viewer videos"
+
+RDEPEND="
+ ~games-strategy/${PN}-data-${PV}
+ >=dev-lang/lua-5.1:0
+ dev-libs/libxml2
+ media-libs/fontconfig
+ media-libs/freetype
+ media-libs/libsdl[X,sound,joystick,opengl,video]
+ media-libs/libvorbis
+ media-libs/openal
+ net-libs/gnutls
+ sys-libs/zlib
+ virtual/opengl
+ virtual/glu
+ x11-libs/libX11
+ x11-libs/libXext
+ editor? ( x11-libs/wxGTK:2.8[X,opengl] )
+ fribidi? ( dev-libs/fribidi )
+ model-viewer? ( x11-libs/wxGTK:2.8[X] )
+ !static? (
+ dev-libs/xerces-c[icu]
+ media-libs/ftgl
+ media-libs/glew
+ media-libs/libpng:0
+ net-libs/libircclient
+ >=net-libs/miniupnpc-1.8
+ net-misc/curl
+ virtual/jpeg:0
+ )
+ videos? ( media-video/vlc )"
+DEPEND="${RDEPEND}
+ sys-apps/help2man
+ virtual/pkgconfig
+ editor? ( ${VIRTUALX_DEPEND} )
+ model-viewer? ( ${VIRTUALX_DEPEND} )
+ static? (
+ dev-libs/icu[static-libs]
+ dev-libs/xerces-c[icu,static-libs]
+ media-libs/ftgl[static-libs]
+ media-libs/glew[static-libs]
+ media-libs/libpng:0[static-libs]
+ net-libs/libircclient[static-libs]
+ net-libs/miniupnpc[static-libs]
+ net-misc/curl[static-libs]
+ virtual/jpeg:0[static-libs]
+ )"
+
+src_prepare() {
+ if use editor || use model-viewer ; then
+ WX_GTK_VER="2.8"
+ need-wxwidgets unicode
+ fi
+
+ epatch "${FILESDIR}"/${P}-static-build.patch \
+ "${FILESDIR}"/${P}-cmake.patch
+}
+
+src_configure() {
+ if use cpu_flags_x86_sse3; then
+ SSE=3
+ elif use cpu_flags_x86_sse2; then
+ SSE=2
+ elif use cpu_flags_x86_sse; then
+ SSE=1
+ else
+ SSE=0
+ fi
+
+ local mycmakeargs=(
+ $(cmake-utils_use_enable fribidi FRIBIDI)
+ $(cmake-utils_use_build editor MEGAGLEST_MAP_EDITOR)
+ $(cmake-utils_use_build tools MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS)
+ $(cmake-utils_use_build model-viewer MEGAGLEST_MODEL_VIEWER)
+ $(cmake-utils_use_with videos VLC)
+ -DMAX_SSE_LEVEL_DESIRED="${SSE}"
+ -DMEGAGLEST_BIN_INSTALL_PATH="${GAMES_BINDIR}"
+ -DMEGAGLEST_DATA_INSTALL_PATH="${GAMES_DATADIR}/${PN}"
+ # icons are used at runtime, wrong default location share/pixmaps
+ -DMEGAGLEST_ICON_INSTALL_PATH="${GAMES_DATADIR}/${PN}"
+ -DUSE_FTGL=ON
+ $(cmake-utils_use_want static STATIC_LIBS)
+ $(cmake-utils_use_want streflop STREFLOP)
+ -DWANT_SVN_STAMP=off
+ $(cmake-utils_use static wxWidgets_USE_STATIC)
+ $(cmake-utils_use unicode wxWidgets_USE_UNICODE)
+ $(cmake-utils_use wxuniversal wxWidgets_USE_UNIVERSAL)
+
+ $(usex debug "-DBUILD_MEGAGLEST_UPNP_DEBUG=ON -DwxWidgets_USE_DEBUG=ON" "")
+ )
+
+ # support CMAKE_BUILD_TYPE=Gentoo
+ append-cppflags '-DCUSTOM_DATA_INSTALL_PATH=\\\"'${GAMES_DATADIR}/${PN}/'\\\"'
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ if use editor || use model-viewer; then
+ VIRTUALX_COMMAND="cmake-utils_src_compile" virtualmake
+ else
+ cmake-utils_src_compile
+ fi
+}
+
+src_install() {
+ # rebuilds some targets randomly without fast option
+ emake -C "${CMAKE_BUILD_DIR}" DESTDIR="${D}" "$@" install/fast
+
+ dodoc docs/{AUTHORS.source_code,CHANGELOG,README}.txt
+ doicon -s 48 ${PN}.png
+
+ use editor &&
+ make_desktop_entry ${PN}_editor "MegaGlest Map Editor"
+ use model-viewer &&
+ make_desktop_entry ${PN}_g3dviewer "MegaGlest Model Viewer"
+
+ prepgamesdirs
+}
+
+pkg_preinst() {
+ games_pkg_preinst
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ einfo
+ elog 'Note about Configuration:'
+ elog 'DO NOT directly edit glest.ini and glestkeys.ini but rather glestuser.ini'
+ elog 'and glestuserkeys.ini in ~/.megaglest/ and create your user over-ride'
+ elog 'values in these files.'
+ elog
+ elog 'If you have an older graphics card which only supports OpenGL 1.2, and the'
+ elog 'game crashes when you try to play, try starting with "megaglest --disable-vbo"'
+ elog 'Some graphics cards may require setting Max Lights to 1.'
+ einfo
+
+ games_pkg_postinst
+ gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+}
diff --git a/games-strategy/megaglest/megaglest-3.9.1-r1.ebuild b/games-strategy/megaglest/megaglest-3.9.1-r1.ebuild
new file mode 100644
index 00000000000..dea6d1d8584
--- /dev/null
+++ b/games-strategy/megaglest/megaglest-3.9.1-r1.ebuild
@@ -0,0 +1,165 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# google-breakpad
+# TODO: fribidi, libvorbis static
+
+EAPI=5
+VIRTUALX_REQUIRED="manual"
+inherit eutils flag-o-matic cmake-utils virtualx wxwidgets gnome2-utils games
+
+DESCRIPTION="Cross-platform 3D realtime strategy game"
+HOMEPAGE="http://www.megaglest.org/"
+SRC_URI="https://github.com/MegaGlest/megaglest-source/releases/download/${PV}/megaglest-source-${PV}.tar.xz"
+
+LICENSE="GPL-3 BitstreamVera"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="debug +editor fribidi cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 static +streflop +tools +unicode wxuniversal +model-viewer videos"
+
+RDEPEND="
+ >=dev-lang/lua-5.1
+ dev-libs/libxml2
+ media-libs/fontconfig
+ media-libs/freetype
+ media-libs/libsdl[X,sound,joystick,opengl,video]
+ media-libs/libvorbis
+ media-libs/openal
+ net-libs/gnutls
+ sys-libs/zlib
+ virtual/opengl
+ virtual/glu
+ x11-libs/libX11
+ x11-libs/libXext
+ editor? ( x11-libs/wxGTK:2.8[X,opengl] )
+ fribidi? ( dev-libs/fribidi )
+ model-viewer? ( x11-libs/wxGTK:2.8[X] )
+ !static? (
+ dev-libs/xerces-c[icu]
+ media-libs/ftgl
+ media-libs/glew
+ media-libs/libpng:0
+ net-libs/libircclient
+ >=net-libs/miniupnpc-1.8
+ net-misc/curl
+ virtual/jpeg
+ )
+ videos? ( media-video/vlc )"
+DEPEND="${RDEPEND}
+ sys-apps/help2man
+ virtual/pkgconfig
+ editor? ( ${VIRTUALX_DEPEND} )
+ model-viewer? ( ${VIRTUALX_DEPEND} )
+ static? (
+ dev-libs/icu[static-libs]
+ dev-libs/xerces-c[icu,static-libs]
+ media-libs/ftgl[static-libs]
+ media-libs/glew[static-libs]
+ media-libs/libpng:0[static-libs]
+ net-libs/libircclient[static-libs]
+ net-libs/miniupnpc[static-libs]
+ net-misc/curl[static-libs]
+ virtual/jpeg[static-libs]
+ )"
+PDEPEND="~games-strategy/${PN}-data-${PV}"
+
+src_prepare() {
+ if use editor || use model-viewer ; then
+ WX_GTK_VER="2.8"
+ need-wxwidgets unicode
+ fi
+
+ epatch "${FILESDIR}"/${P}-static-build.patch \
+ "${FILESDIR}"/${P}-cmake.patch
+}
+
+src_configure() {
+ if use cpu_flags_x86_sse3; then
+ SSE=3
+ elif use cpu_flags_x86_sse2; then
+ SSE=2
+ elif use cpu_flags_x86_sse; then
+ SSE=1
+ else
+ SSE=0
+ fi
+
+ local mycmakeargs=(
+ $(cmake-utils_use_enable fribidi FRIBIDI)
+ $(cmake-utils_use_build editor MEGAGLEST_MAP_EDITOR)
+ $(cmake-utils_use_build tools MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS)
+ $(cmake-utils_use_build model-viewer MEGAGLEST_MODEL_VIEWER)
+ $(cmake-utils_use_with videos VLC)
+ -DMAX_SSE_LEVEL_DESIRED="${SSE}"
+ -DMEGAGLEST_BIN_INSTALL_PATH="${GAMES_BINDIR}"
+ -DMEGAGLEST_DATA_INSTALL_PATH="${GAMES_DATADIR}/${PN}"
+ # icons are used at runtime, wrong default location share/pixmaps
+ -DMEGAGLEST_ICON_INSTALL_PATH="${GAMES_DATADIR}/${PN}"
+ -DUSE_FTGL=ON
+ $(cmake-utils_use_want static STATIC_LIBS)
+ $(cmake-utils_use_want streflop STREFLOP)
+ -DWANT_SVN_STAMP=off
+ $(cmake-utils_use static wxWidgets_USE_STATIC)
+ $(cmake-utils_use unicode wxWidgets_USE_UNICODE)
+ $(cmake-utils_use wxuniversal wxWidgets_USE_UNIVERSAL)
+
+ $(usex debug "-DBUILD_MEGAGLEST_UPNP_DEBUG=ON -DwxWidgets_USE_DEBUG=ON" "")
+ )
+
+ # support CMAKE_BUILD_TYPE=Gentoo
+ append-cppflags '-DCUSTOM_DATA_INSTALL_PATH=\\\"'${GAMES_DATADIR}/${PN}/'\\\"'
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ if use editor || use model-viewer; then
+ VIRTUALX_COMMAND="cmake-utils_src_compile" virtualmake
+ else
+ cmake-utils_src_compile
+ fi
+}
+
+src_install() {
+ # rebuilds some targets randomly without fast option
+ emake -C "${CMAKE_BUILD_DIR}" DESTDIR="${D}" "$@" install/fast
+
+ dodoc docs/{AUTHORS.source_code,CHANGELOG,README}.txt
+ doicon -s 48 ${PN}.png
+
+ use editor &&
+ make_desktop_entry ${PN}_editor "MegaGlest Map Editor"
+ use model-viewer &&
+ make_desktop_entry ${PN}_g3dviewer "MegaGlest Model Viewer"
+
+ # provided by megaglest-data
+ rm "${ED%/}/${GAMES_DATADIR}"/${PN}/${PN}.bmp || die
+
+ prepgamesdirs
+}
+
+pkg_preinst() {
+ games_pkg_preinst
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ einfo
+ elog 'Note about Configuration:'
+ elog 'DO NOT directly edit glest.ini and glestkeys.ini but rather glestuser.ini'
+ elog 'and glestuserkeys.ini in ~/.megaglest/ and create your user over-ride'
+ elog 'values in these files.'
+ elog
+ elog 'If you have an older graphics card which only supports OpenGL 1.2, and the'
+ elog 'game crashes when you try to play, try starting with "megaglest --disable-vbo"'
+ elog 'Some graphics cards may require setting Max Lights to 1.'
+ einfo
+
+ games_pkg_postinst
+ gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+}
diff --git a/games-strategy/megaglest/metadata.xml b/games-strategy/megaglest/metadata.xml
new file mode 100644
index 00000000000..ca0584f15be
--- /dev/null
+++ b/games-strategy/megaglest/metadata.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <changelog>http://megaglest.svn.sourceforge.net/viewvc/megaglest/trunk/docs/CHANGELOG.txt?revision=3397</changelog>
+ <doc lang="en">http://glest.wikia.com/wiki/MG</doc>
+ <bugs-to>https://sourceforge.net/tracker/?group_id=300350&amp;atid=1266776</bugs-to>
+ <remote-id type="github">MegaGlest/megaglest-source</remote-id>
+ </upstream>
+ <use>
+ <flag name="editor">Build map editor</flag>
+ <flag name="fribidi">Enable FriBIDi support</flag>
+ <flag name="streflop">Use the library streflop. Out of synchs may
+ occur if not enabled.</flag>
+ <flag name="tools">Build model import/export tools</flag>
+ <flag name="unicode">Use unicode strings for wxwidgets</flag>
+ <flag name="wxuniversal">Use the wxUniversal port which implements
+ the various GUI controls by drawing them itself </flag>
+ <flag name="model-viewer">Build model viewer</flag>
+ </use>
+ <longdescription lang="en">
+ MegaGlest is an entertaining free (freeware and free software) and
+ open source cross-platform 3D real-time strategy (RTS) game, where
+ you control the armies of one of seven different factions: Tech,
+ Magic, Egyptians, Indians, Norsemen, Persian or Romans. The game is
+ setup in one of 17 naturally looking settings, which -like the unit
+ models- are crafted with great appreciation for detail. Additional
+ game data can be downloaded from within the game at no cost.
+ </longdescription>
+</pkgmetadata>