commit:     727ef34a6076430ed3b1b74586f5474f40b55324
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  1 22:24:42 2020 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Tue Dec  1 22:27:06 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=727ef34a

games-strategy/hedgewars: migrate to lua-single.eclass

Locked to 5.1 but by using a bundled version of FindLua.cmake which only
considers that version rather than looking for the package "Lua51".
Therefore, I have already put machinery in place which requests a specific
Lua version.

BTW. All tests of both this ebuild and its unmigrated counterpart fail with
"unsupported image format" unless media-libs/sdl2-image has been built in
USE=png. Haven't checked what happens at run time.

Closes: https://bugs.gentoo.org/752714
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 .../files/hedgewars-1.0.0-cmake_lua_version.patch  |  11 ++
 .../hedgewars/hedgewars-1.0.0-r100.ebuild          | 112 +++++++++++++++++++++
 profiles/package.mask                              |   1 +
 3 files changed, 124 insertions(+)

diff --git 
a/games-strategy/hedgewars/files/hedgewars-1.0.0-cmake_lua_version.patch 
b/games-strategy/hedgewars/files/hedgewars-1.0.0-cmake_lua_version.patch
new file mode 100644
index 00000000000..b1daa255112
--- /dev/null
+++ b/games-strategy/hedgewars/files/hedgewars-1.0.0-cmake_lua_version.patch
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -202,7 +202,7 @@
+ #lua discovery
+ if(LUA_SYSTEM)
+     if(NOT LUA_LIBRARY OR NOT LUA_INCLUDE_DIR)
+-        find_package(Lua)
++        find_package(Lua ${LUA_VERSION} EXACT REQUIRED)
+     endif()
+ 
+     if(LUA_LIBRARY AND LUA_INCLUDE_DIR)

diff --git a/games-strategy/hedgewars/hedgewars-1.0.0-r100.ebuild 
b/games-strategy/hedgewars/hedgewars-1.0.0-r100.ebuild
new file mode 100644
index 00000000000..8f127f79072
--- /dev/null
+++ b/games-strategy/hedgewars/hedgewars-1.0.0-r100.ebuild
@@ -0,0 +1,112 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+CMAKE_MAKEFILE_GENERATOR=emake
+LUA_COMPAT=( lua5-1 )
+
+inherit cmake lua-single xdg-utils
+
+MY_P=${PN}-src-${PV}
+
+DESCRIPTION="A turn-based strategy, artillery, action and comedy game"
+HOMEPAGE="https://www.hedgewars.org/";
+SRC_URI="https://www.hedgewars.org/download/releases/${MY_P}.tar.bz2";
+
+LICENSE="GPL-2 Apache-2.0 FDL-1.3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="server"
+
+REQUIRED_USE="${LUA_REQUIRED_USE}"
+
+QA_FLAGS_IGNORED="/usr/bin/hwengine" # pascal sucks
+QA_PRESTRIPPED="/usr/bin/hwengine" # pascal sucks
+
+# qtcore:5= - depends on private header
+DEPEND="${LUA_DEPS}
+       >=dev-games/physfs-3.0.1
+       dev-qt/qtcore:5=
+       dev-qt/qtgui:5
+       dev-qt/qtnetwork:5
+       dev-qt/qtwidgets:5
+       media-libs/libpng:0=
+       media-libs/libsdl2:=
+       media-libs/sdl2-image:=
+       media-libs/sdl2-mixer:=[vorbis]
+       media-libs/sdl2-net:=
+       media-libs/sdl2-ttf:=
+       sys-libs/zlib
+       !x86? ( media-video/ffmpeg:= )
+       "
+RDEPEND="${DEPEND}
+       app-arch/xz-utils
+       >=media-fonts/dejavu-2.28
+       media-fonts/wqy-zenhei"
+BDEPEND="
+       dev-qt/linguist-tools:5
+       server? (
+               >=dev-lang/ghc-6.10
+               dev-haskell/entropy
+               dev-haskell/hslogger
+               >=dev-haskell/mtl-2
+               >=dev-haskell/network-2.3
+               dev-haskell/random
+               dev-haskell/regex-tdfa
+               dev-haskell/sandi
+               dev-haskell/sha
+               dev-haskell/vector
+               dev-haskell/utf8-string
+               dev-haskell/yaml
+               >=dev-haskell/zlib-0.5.3 <dev-haskell/zlib-0.6
+       )
+       !x86? ( >=dev-lang/fpc-2.4 )
+       x86? (
+               >=dev-lang/ghc-6.10
+               dev-haskell/parsec
+       )"
+
+PATCHES=(
+       "${FILESDIR}/${P}-qt-5.15.patch"
+       "${FILESDIR}/${PN}-1.0.0-cmake_lua_version.patch"
+)
+
+S="${WORKDIR}"/${MY_P}
+
+src_configure() {
+       local mycmakeargs=(
+               -DMINIMAL_FLAGS=ON
+               -DDATA_INSTALL_DIR="${EPREFIX}/usr/share/${PN}"
+               -Dtarget_binary_install_dir="${EPREFIX}/usr/bin"
+               -Dtarget_library_install_dir="${EPREFIX}/usr/$(get_libdir)"
+               -DNOSERVER=$(usex !server)
+               -DBUILD_ENGINE_C=$(usex x86)
+               -DNOVIDEOREC=$(usex !x86)
+               -DCMAKE_VERBOSE_MAKEFILE=TRUE
+               # Need to tell the build system where the fonts are located
+               # as it uses PhysFS' symbolic link protection mode which
+               # prevents us from symlinking the fonts into the right directory
+               #   https://hg.hedgewars.org/hedgewars/rev/76ad55807c24
+               #   
https://icculus.org/physfs/docs/html/physfs_8h.html#aad451d9b3f46f627a1be8caee2eef9b7
+               
-DFONTS_DIRS="${EPREFIX}/usr/share/fonts/wqy-zenhei;${EPREFIX}/usr/share/fonts/dejavu"
+               # upstream sets RPATH that leads to weird breakage
+               # https://bugzilla.redhat.com/show_bug.cgi?id=1200193
+               -DCMAKE_SKIP_RPATH=ON
+               -DLUA_VERSION=$(lua_get_version)
+       )
+       cmake_src_configure
+}
+
+src_install() {
+       cmake_src_install
+       doman man/${PN}.6
+}
+
+pkg_postinst() {
+       xdg_desktop_database_update
+}
+
+pkg_postrm() {
+       xdg_desktop_database_update
+}

diff --git a/profiles/package.mask b/profiles/package.mask
index 415ef0457d9..de708ef1857 100644
--- a/profiles/package.mask
+++ b/profiles/package.mask
@@ -578,6 +578,7 @@ dev-lua/luacrypto
 >=games-rpg/sumwars-0.5.8-r100
 >=games-simulation/corsix-th-0.64-r100
 >=games-sports/xmoto-0.6.1-r100
+>=games-strategy/hedgewars-1.0.0-r100
 >=games-util/slade-3.1.12a-r100
 >=mail-filter/imapfilter-2.6.16-r100
 >=media-gfx/geeqie-1.5.1-r1

Reply via email to