games-sports/dustrac: 1.13.0 version bump, cmake.eclass, build w/ GCC10

New HOMEPAGE
Make tests optional, both dependency and build
Fix tests using virtualx
Fix appdata install path
Fix build with GCC-10

Bug: https://bugs.gentoo.org/725516
Closes: https://bugs.gentoo.org/682552
Closes: https://bugs.gentoo.org/722524
Package-Manager: Portage-3.0.16, Repoman-3.0.2
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
This commit is contained in:
Andreas Sturmlechner 2021-02-27 21:10:40 +01:00
parent 5b62623e9e
commit 60240ee164
No known key found for this signature in database
GPG Key ID: 508AA000E0EE83E0
7 changed files with 346 additions and 0 deletions

View File

@ -1 +1,2 @@
DIST dustrac-1.11.0.tar.gz 27505282 BLAKE2B a42de406e388e13f1829e10248899f47cf98333a972eb4ce978116a706d9786840c4c6ec9107403aad25bd538453a7595c35cab33b0643968133710db2a3c66c SHA512 af67b76a815543d41cf8e5681ede11bfd63a2d6be7e4a21986d495d77b2673f5a145bb1c9cd5237d2caf64a4e77f221ae48b97a38a883dcd4e5bb0ef8c55f839
DIST dustrac-1.13.0.tar.gz 18466297 BLAKE2B 694b879755125f273864f16ebb889d39d1dc690aa0f79e6cc3f8b5e64eec64209f32065dd2c88eb7b82e246837a0217ee284fb529b9e1e3149f2adeb5e54d2d1 SHA512 afb7a361771e5c19ef6ef26dd273a4b5df2b0ae7d7dd8292d2c875ac6a3109d2ff50f37f83006505c68486c50b4f6b371ba1f76cdedbe99652637508d86d7b49

View File

@ -0,0 +1,79 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit cmake xdg-utils virtualx
DESCRIPTION="Tile-based, cross-platform 2D racing game"
HOMEPAGE="https://juzzlin.github.io/DustRacing2D/"
SRC_URI="https://github.com/juzzlin/DustRacing2D/archive/${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/DustRacing2D-${PV}"
LICENSE="GPL-3+ CC-BY-SA-3.0"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="test"
RESTRICT="!test? ( test )"
RDEPEND="
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtopengl:5
dev-qt/qtxml:5
media-fonts/ubuntu-font-family
media-libs/libvorbis
media-libs/openal
virtual/opengl
"
DEPEND="${RDEPEND}
test? ( dev-qt/qttest:5 )
"
BDEPEND="
dev-qt/linguist-tools:5
virtual/pkgconfig
"
PATCHES=(
# upstream backports
"${FILESDIR}"/${P}-gcc10.patch # bug 722524
"${FILESDIR}"/${P}-opengl.patch
"${FILESDIR}"/${P}-appdata.patch
# downstream patches
"${FILESDIR}"/${P}-cmake.patch
"${FILESDIR}"/${P}-cmake-add_library-static.patch
)
src_configure() {
# -DGLES=ON didn't build for me but maybe just need use flags on some Qt package?
# Maybe add a local gles use flag
local mycmakeargs=(
-DReleaseBuild=ON
-DOpenGL_GL_PREFERENCE=GLVND
-DDATA_PATH=/usr/share/${PN}
-DBIN_PATH=/usr/bin
-DDOC_PATH=/usr/share/doc/${PF}
-DBUILD_TESTING=$(usex test)
)
cmake_src_configure
}
src_test() {
virtx cmake_src_test
}
src_install() {
cmake_src_install
dosym ../../fonts/ubuntu-font-family/UbuntuMono-B.ttf /usr/share/${PN}/fonts/UbuntuMono-B.ttf
dosym ../../fonts/ubuntu-font-family/UbuntuMono-R.ttf /usr/share/${PN}/fonts/UbuntuMono-R.ttf
}
pkg_postinst() {
xdg_icon_cache_update
}
pkg_postrm() {
xdg_icon_cache_update
}

View File

@ -0,0 +1,27 @@
From 5c5c437c2634572da21a22e1f64fac1dc1b296ea Mon Sep 17 00:00:00 2001
From: Pino Toscano <toscano.pino@tiscali.it>
Date: Sun, 24 Sep 2017 16:19:51 +0200
Subject: [PATCH] Install AppData file to the right location
According to the specs [1], the location is now /usr/share/metainfo,
with appdata left as legacy directory. Hence, install the AppData file
to the non-legacy directory.
[1] https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html
---
InstallLinux.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/InstallLinux.cmake b/InstallLinux.cmake
index 15e69855..3e0443d1 100644
--- a/InstallLinux.cmake
+++ b/InstallLinux.cmake
@@ -74,7 +74,7 @@ function(setup_install_targets BIN_PATH DATA_PATH DOC_PATH)
install(FILES ${CMAKE_BINARY_DIR}/dustrac-editor.desktop DESTINATION share/applications)
# Install app store meta data
- install(FILES src/dustrac.appdata.xml DESTINATION share/appdata)
+ install(FILES src/dustrac.appdata.xml DESTINATION share/metainfo)
# Install icons
install(FILES data/icons/dustrac-game.png DESTINATION share/pixmaps)

View File

@ -0,0 +1,31 @@
Fix linking with BUILD_SHARED_LIBS=ON default in EAPI-7.
--- a/src/game/STFH/CMakeLists.txt 2017-08-28 21:43:54.000000000 +0200
+++ b/src/game/STFH/CMakeLists.txt 2021-02-27 20:58:35.523503983 +0100
@@ -10,5 +10,5 @@
source.cpp
)
-add_library(STFH ${STFHSRC})
+add_library(STFH STATIC ${STFHSRC})
--- a/src/game/MTFH/CMakeLists.txt 2017-08-28 21:43:54.000000000 +0200
+++ b/src/game/MTFH/CMakeLists.txt 2021-02-27 20:58:48.451565823 +0100
@@ -9,5 +9,5 @@
menumanager.cpp
menuitemview.cpp)
-add_library(MTFH ${MTFHSRC})
+add_library(MTFH STATIC ${MTFHSRC})
--- a/src/game/MiniCore/CMakeLists.txt 2017-08-28 21:43:54.000000000 +0200
+++ b/src/game/MiniCore/CMakeLists.txt 2021-02-27 20:59:01.267627130 +0100
@@ -82,7 +82,7 @@
set(MiniCoreSRC ${MiniCoreSRC} Graphics/contrib/glew/glew.c)
endif()
-add_library(MiniCore ${MiniCoreSRC})
+add_library(MiniCore STATIC ${MiniCoreSRC})
target_link_libraries(MiniCore Qt5::Core Qt5::OpenGL Qt5::Xml OpenGL::GL)

View File

@ -0,0 +1,69 @@
Rebase CFLAGS and COPYING removal patch onto 1.13.0
Use CTest module for standard BUILD_TESTING switch and make Qt5Test optional
--- a/CMakeLists.txt 2017-08-28 21:43:54.000000000 +0200
+++ b/CMakeLists.txt 2021-02-27 19:21:04.090117623 +0100
@@ -57,6 +57,9 @@
add_definitions(-DGLEW_STATIC)
add_definitions(-DGLEW_NO_GLU)
+# Enable CMake's unit test framework
+include(CTest)
+
if(UNIX)
include("InstallLinux.cmake")
elseif(WIN32)
@@ -64,8 +67,7 @@
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR MINGW OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
- add_compile_options(-std=c++11 -W -Wall -O3 -pedantic)
- add_compile_options(-fomit-frame-pointer -finline-functions -ffast-math)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -W -Wall -fomit-frame-pointer -finline-functions")
elseif(MSVC)
add_definitions(-DNOMINMAX)
endif()
@@ -83,7 +85,10 @@
find_package(Qt5Xml ${QT_MIN_VER} REQUIRED)
find_package(Qt5Widgets ${QT_MIN_VER} REQUIRED)
find_package(Qt5LinguistTools ${QT_MIN_VER} REQUIRED)
-find_package(Qt5Test ${QT_MIN_VER} REQUIRED)
+
+if(BUILD_TESTING)
+ find_package(Qt5Test ${QT_MIN_VER} REQUIRED)
+endif()
# Find OpenGL
find_package(OpenGL REQUIRED)
@@ -109,9 +114,6 @@
pkg_check_modules(VORBISFILE REQUIRED vorbisfile)
endif()
-# Enable CMake's unit test framework
-enable_testing()
-
# Install paths depend on the build type and target platform
resolve_install_paths()
--- a/InstallLinux.cmake 2017-08-28 21:43:54.000000000 +0200
+++ b/InstallLinux.cmake 2021-02-27 19:21:23.760211724 +0100
@@ -58,7 +58,7 @@
install(FILES data/fonts.conf DESTINATION ${DATA_PATH})
install(FILES data/meshes.conf DESTINATION ${DATA_PATH})
install(FILES data/surfaces.conf DESTINATION ${DATA_PATH})
- install(FILES AUTHORS CHANGELOG COPYING README.md DESTINATION ${DOC_PATH})
+ install(FILES AUTHORS CHANGELOG README.md DESTINATION ${DOC_PATH})
install(DIRECTORY data/images DESTINATION ${DATA_PATH} FILES_MATCHING PATTERN "*.jpg")
install(DIRECTORY data/images DESTINATION ${DATA_PATH} FILES_MATCHING PATTERN "*.png")
install(DIRECTORY data/levels DESTINATION ${DATA_PATH} FILES_MATCHING PATTERN "*.trk")
--- a/src/game/MiniCore/CMakeLists.txt 2017-08-28 21:43:54.000000000 +0200
+++ b/src/game/MiniCore/CMakeLists.txt 2021-02-27 19:17:29.616848751 +0100
@@ -86,5 +86,7 @@
target_link_libraries(MiniCore Qt5::OpenGL Qt5::Xml)
-add_subdirectory(UnitTests)
+if(BUILD_TESTING)
+ add_subdirectory(UnitTests)
+endif()

View File

@ -0,0 +1,48 @@
From d41a46ac32038055bfc9fe9a907e199ed74e371c Mon Sep 17 00:00:00 2001
From: Pino Toscano <toscano.pino@tiscali.it>
Date: Fri, 17 Apr 2020 13:25:12 +0200
Subject: [PATCH] Include <stdexcept> for std::runtime_error
It was implicitly pulled before, and in GCC 10 it will not be anymore.
---
src/game/openaloggdata.cpp | 1 +
src/game/openalsource.cpp | 1 +
src/game/openalwavdata.cpp | 1 +
3 files changed, 3 insertions(+)
diff --git a/src/game/openaloggdata.cpp b/src/game/openaloggdata.cpp
index 56634c20..4a2ab882 100644
--- a/src/game/openaloggdata.cpp
+++ b/src/game/openaloggdata.cpp
@@ -19,6 +19,7 @@
#include <vector>
#include <cstdio>
+#include <stdexcept>
#include <vorbis/vorbisfile.h>
diff --git a/src/game/openalsource.cpp b/src/game/openalsource.cpp
index 9d2bb7f5..37a4272a 100644
--- a/src/game/openalsource.cpp
+++ b/src/game/openalsource.cpp
@@ -19,6 +19,7 @@
#include <AL/alc.h>
#include <memory>
+#include <stdexcept>
static bool checkError()
{
diff --git a/src/game/openalwavdata.cpp b/src/game/openalwavdata.cpp
index 3a9fc20a..015a11d3 100644
--- a/src/game/openalwavdata.cpp
+++ b/src/game/openalwavdata.cpp
@@ -25,6 +25,7 @@
#include <cstdio>
#include <AL/alc.h>
+#include <stdexcept>
static bool checkError()
{

View File

@ -0,0 +1,91 @@
From acde4499b4a4d014d95668269797a272fd53bf86 Mon Sep 17 00:00:00 2001
From: Jussi Lind <jussi.lind@iki.fi>
Date: Thu, 15 Nov 2018 01:35:58 +0200
Subject: [PATCH] CMake: Default to GLVND, use the recommended way to link to
GL
---
CMakeLists.txt | 7 +++++++
src/game/CMakeLists.txt | 2 +-
src/game/MiniCore/src/CMakeLists.txt | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)
From 7d6d2213d10ea96d25b5b9f18b42cace5bf0fbfd Mon Sep 17 00:00:00 2001
From: Jussi Lind <jussi.lind@iki.fi>
Date: Sun, 18 Nov 2018 21:12:20 +0200
Subject: [PATCH] Fix linking to OpenGL libs on CMake < 3.11.0
---
CMakeLists.txt | 5 +++++
src/game/CMakeLists.txt | 4 +---
src/game/MiniCore/CMakeLists.txt | 5 +++++
src/game/MiniCore/src/CMakeLists.txt | 2 +-
4 files changed, 12 insertions(+), 4 deletions(-)
From edc1825110f80377af51226a686731bf17d1de52 Mon Sep 17 00:00:00 2001
From: Jussi Lind <jussi.lind@iki.fi>
Date: Tue, 30 Jul 2019 23:14:20 +0300
Subject: [PATCH] Use OpenGL::GL instead of OpenGL::OpenGL
- For more info: https://cmake.org/cmake/help/v3.10/module/FindOpenGL.html
---
CMakeLists.txt | 2 +-
src/game/MiniCore/CMakeLists.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff -u a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,8 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_policy(VERSION 2.8.12)
+# Use cmake --help-policy [POLICY] for more information about these:
+
if(POLICY CMP0005)
cmake_policy(SET CMP0005 NEW)
endif()
@@ -11,6 +13,11 @@
cmake_policy(SET CMP0020 NEW)
endif()
+# Default to GLVND
+if(POLICY CMP0072)
+ cmake_policy(SET CMP0072 OLD)
+endif()
+
# Global game version
set(VERSION_MAJOR "2")
set(VERSION_MINOR "0")
diff -u a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt
--- a/src/game/CMakeLists.txt
+++ b/src/game/CMakeLists.txt
@@ -157,15 +157,13 @@
MiniCore
MTFH
STFH
- ${OPENGL_gl_LIBRARY}
- ${OPENGL_glu_LIBRARY}
${OPENAL_LIBRARY}
${VORBISFILE_LIBRARIES}
${VORBISFILE_LIB} # Valid only with MSVC
${VORBIS_LIB} # Valid only with MSVC
${OGG_LIB}) # Valid only with MSVC
-target_link_libraries(${GAME_BINARY_NAME} ${COMMON_LIBS} Qt5::OpenGL Qt5::Xml)
+target_link_libraries(${GAME_BINARY_NAME} ${COMMON_LIBS} Qt5::OpenGL Qt5::Xml OpenGL::GL)
foreach(TS_FILE ${TS})
# Make targets to copy generated qm files to data dir. This is done the hard
diff -u a/src/game/MiniCore/CMakeLists.txt b/src/game/MiniCore/CMakeLists.txt
--- a/src/game/MiniCore/CMakeLists.txt
+++ b/src/game/MiniCore/CMakeLists.txt
@@ -88,7 +88,7 @@
add_library(MiniCore ${MiniCoreSRC})
-target_link_libraries(MiniCore Qt5::OpenGL Qt5::Xml)
+target_link_libraries(MiniCore Qt5::Core Qt5::OpenGL Qt5::Xml OpenGL::GL)
if(BUILD_TESTING)
add_subdirectory(UnitTests)