Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-strategy/s25rttr/files/, games-strategy/s25rttr/
Date: Sat, 11 Sep 2021 08:38:28
Message-Id: 1631349256.0b52435579ce5e9941a9f2a6102674bb7ce1b0ad.chewi@gentoo
1 commit: 0b52435579ce5e9941a9f2a6102674bb7ce1b0ad
2 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 11 08:34:16 2021 +0000
4 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 11 08:34:16 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0b524355
7
8 games-strategy/s25rttr: Bump to 0.9.1, EAPI 8
9
10 Closes: https://bugs.gentoo.org/750512
11 Closes: https://bugs.gentoo.org/778587
12 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
13
14 games-strategy/s25rttr/Manifest | 1 +
15 .../s25rttr/files/s25rttr-0.9.1-cxx-std.patch | 30 ++++++
16 .../files/s25rttr-0.9.1-libsamplerate.patch | 37 +++++++
17 games-strategy/s25rttr/s25rttr-0.9.1.ebuild | 114 +++++++++++++++++++++
18 4 files changed, 182 insertions(+)
19
20 diff --git a/games-strategy/s25rttr/Manifest b/games-strategy/s25rttr/Manifest
21 index 246f9787269..d80aad01563 100644
22 --- a/games-strategy/s25rttr/Manifest
23 +++ b/games-strategy/s25rttr/Manifest
24 @@ -1,4 +1,5 @@
25 DIST s25client-f0b97b120140c96bbeacae9c22633f899931db69.tar.gz 20184306 BLAKE2B 4204a62e0a57a614c5ae1a947741f8f92fd7cd75b203467716483baa6f68a7c608033f403337e66b00bc8c2851b03f04c25bf84cda124548cfe09a110478fc54 SHA512 c4f0b59a68a0d5ece57f06f51e7a977be0b41ae85ff57821b317c2bb822a2533a192e1dfaa1a738c6738e65505a70ec34b3e7b22a8bd6effc95a4279d5eb19da
26 +DIST s25client_src_v0.9.1.tar.gz 31042856 BLAKE2B 296e61467f5ba64f2a833e3f6627844db3757604d9b239d18f3a2b42afc7f46df09ff3b9e8d8a26865e5220f8996b6e78fd4d5fe6252510bbdf8fc238de40bfc SHA512 b7478f76e0246c52a219d9ef5293d56fe682dc87bcd1269d1647417d86c5174632bf05f1fe09e91a9bf9d6738f58e1cac51abdc54df47c00d228687767e19510
27 DIST s25rttr-kaguya-38ca7e1d894c138e454bbe5c89048bdd5091545a.tar.gz 156126 BLAKE2B 05eeccc890549b8dd3fa004c61b73be65f1fcf20867b7f4a46d0963f80b4a76fca611915ea72a401bdc49a81997d3d4500c5f5378a7cd55cbbfab6bcf647261a SHA512 470414d41cb6bad4e428858114f3c91139abfb1bf3ae02bb322d51bfabba8c0aad6796e183ccbb57624ed3484fea3f463636561ac8a359b6be7b90cfd5c0696a
28 DIST s25rttr-languages-6906b7ce9cb64242ba406eda34a404fa8eb1e33d.tar.gz 698512 BLAKE2B 82bc98077ed18622083894a63044194f599375c93aa745e330ad8ba390e14d9829ebb7c8e62141758f41dff2b72d3afbe2a5b6ebb584c3293c244e6f0c88ff89 SHA512 47de2791a4d4707fa17344de8fff8a15dd4436dd6e8c75adbd95273739cf5022e39a1024edee228eb27294e4f1f0b2a91110a1249b3d4fe64641cace051e4544
29 DIST s25rttr-libendian-dd2c11498f679247530b6b7cf7bd5964f539ddfd.tar.gz 17008 BLAKE2B 98486acff6e56581b5dd06bba9892da739bf1947151f036ade31354c340b6dd79e1b77cd42475bc38225515392062c4e5dbf9ab28349356368db0ca90a81ee65 SHA512 1827edf6470f20a4b6a1b991a31af411e2cc5ceae36a65d54dbd6927dcf46949c4ad729ac982242da9a8ec9d141531d6c99792af761370b2252872bdbb7da8f0
30
31 diff --git a/games-strategy/s25rttr/files/s25rttr-0.9.1-cxx-std.patch b/games-strategy/s25rttr/files/s25rttr-0.9.1-cxx-std.patch
32 new file mode 100644
33 index 00000000000..cb5ecdf2822
34 --- /dev/null
35 +++ b/games-strategy/s25rttr/files/s25rttr-0.9.1-cxx-std.patch
36 @@ -0,0 +1,30 @@
37 +From 5db419d044149ab3760c1588b44536febab5d657 Mon Sep 17 00:00:00 2001
38 +From: James Le Cuirot <chewi@g.o>
39 +Date: Sat, 11 Sep 2021 08:41:57 +0100
40 +Subject: [PATCH] Set C++ standard (to C++14) using CMake
41 +
42 +Not adding the -std flag broke builds with GCC 11 until the code was
43 +fixed up recently. This should prevent this sort of thing from
44 +happening in future. It also ensures that the compiler is actually new
45 +enough.
46 +---
47 + CMakeLists.txt | 3 +++
48 + 1 file changed, 3 insertions(+)
49 +
50 +diff --git a/CMakeLists.txt b/CMakeLists.txt
51 +index 8ab991c97..b55c545a2 100644
52 +--- a/CMakeLists.txt
53 ++++ b/CMakeLists.txt
54 +@@ -22,6 +22,9 @@ if(DEFINED CMAKE_TOOLCHAIN_FILE)
55 + message(STATUS "Used Toolchain definition file '${CMAKE_TOOLCHAIN_FILE}'")
56 + endif()
57 +
58 ++set(CMAKE_CXX_STANDARD 14)
59 ++set(CXX_STANDARD_REQUIRED ON)
60 ++
61 + list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules" "${CMAKE_SOURCE_DIR}/external/libutil/cmake")
62 + if(CMAKE_VERSION VERSION_LESS 3.14)
63 + list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/external/libutil/cmake/cmake_3.14")
64 +--
65 +2.32.0
66 +
67
68 diff --git a/games-strategy/s25rttr/files/s25rttr-0.9.1-libsamplerate.patch b/games-strategy/s25rttr/files/s25rttr-0.9.1-libsamplerate.patch
69 new file mode 100644
70 index 00000000000..41d6d90e5fd
71 --- /dev/null
72 +++ b/games-strategy/s25rttr/files/s25rttr-0.9.1-libsamplerate.patch
73 @@ -0,0 +1,37 @@
74 +From 16cb06c99f78a21b1be2bc681c1f1d85a6caddca Mon Sep 17 00:00:00 2001
75 +From: James Le Cuirot <chewi@g.o>
76 +Date: Fri, 10 Sep 2021 22:59:51 +0100
77 +Subject: [PATCH] Fix bad channel count handling with libsamplerate 0.2.0
78 +
79 +Since libsndfile/libsamplerate@26d92c369394bcd0b0cea488890edce1a0d757d5,
80 +initialising libsamplerate with 0 channels or less causes a SIGABRT. We
81 +therefore need to handle this in the C++ wrapper classes.
82 +---
83 + libs/libsamplerate/include/samplerate.hpp | 4 ++++
84 + 1 file changed, 4 insertions(+)
85 +
86 +diff --git a/libs/libsamplerate/include/samplerate.hpp b/libs/libsamplerate/include/samplerate.hpp
87 +index d0af34317..23e243d91 100644
88 +--- a/libs/libsamplerate/include/samplerate.hpp
89 ++++ b/libs/libsamplerate/include/samplerate.hpp
90 +@@ -152,6 +152,8 @@ class State : public detail::StateBase
91 + {
92 + static SRC_STATE* createOrThrow(Converter converter, int channels)
93 + {
94 ++ if (channels <= 0)
95 ++ throw std::runtime_error("Channel count must be >= 1.");
96 + int error;
97 + auto* state = src_new(static_cast<int>(converter), channels, &error);
98 + if(!state)
99 +@@ -174,6 +176,8 @@ class StateCallback : public detail::StateBase
100 + {
101 + static SRC_STATE* createOrThrow(Converter converter, int channels, src_callback_t func, void* data)
102 + {
103 ++ if (channels <= 0)
104 ++ throw std::runtime_error("Channel count must be >= 1.");
105 + int error;
106 + auto* state = src_callback_new(func, static_cast<int>(converter), channels, &error, data);
107 + if(!state)
108 +--
109 +2.32.0
110 +
111
112 diff --git a/games-strategy/s25rttr/s25rttr-0.9.1.ebuild b/games-strategy/s25rttr/s25rttr-0.9.1.ebuild
113 new file mode 100644
114 index 00000000000..4aa4156d566
115 --- /dev/null
116 +++ b/games-strategy/s25rttr/s25rttr-0.9.1.ebuild
117 @@ -0,0 +1,114 @@
118 +# Copyright 1999-2021 Gentoo Authors
119 +# Distributed under the terms of the GNU General Public License v2
120 +
121 +EAPI=8
122 +
123 +LUA_COMPAT=( lua5-3 )
124 +
125 +inherit desktop flag-o-matic lua-single toolchain-funcs xdg cmake
126 +
127 +MY_PN="s25client"
128 +DESCRIPTION="Open source remake of The Settlers II: Gold Edition (needs original data files)"
129 +HOMEPAGE="https://www.siedler25.org/"
130 +SRC_URI="https://github.com/Return-To-The-Roots/${MY_PN}/releases/download/v${PV}/${MY_PN}_src_v${PV}.tar.gz"
131 +LICENSE="GPL-2+ GPL-3 Boost-1.0"
132 +SLOT="0"
133 +KEYWORDS="~amd64 ~arm64 ~x86"
134 +IUSE="test"
135 +RESTRICT="!test? ( test )"
136 +REQUIRED_USE="${LUA_REQUIRED_USE}"
137 +
138 +RDEPEND="${LUA_DEPS}
139 + app-arch/bzip2
140 + >=dev-libs/boost-1.73:0=[nls]
141 + >=media-libs/libsamplerate-0.1.9
142 + >=media-libs/libsdl2-2.0.10-r2[opengl,sound,video]
143 + media-libs/libsndfile
144 + media-libs/sdl2-mixer[vorbis,wav]
145 + net-libs/miniupnpc
146 + virtual/opengl
147 +"
148 +
149 +DEPEND="
150 + ${RDEPEND}
151 + test? ( >=sys-devel/clang-5 )
152 +"
153 +
154 +BDEPEND="
155 + sys-devel/gettext
156 + virtual/pkgconfig
157 +"
158 +
159 +PATCHES=(
160 + "${FILESDIR}"/${PN}-0.9.0_pre20200723-cmake_lua_version.patch
161 + "${FILESDIR}"/${PN}-0.9.1-libsamplerate.patch
162 + "${FILESDIR}"/${PN}-0.9.1-cxx-std.patch
163 +)
164 +
165 +S="${WORKDIR}/${MY_PN}_v${PV}"
166 +
167 +# Build type is checked but blank is valid.
168 +CMAKE_BUILD_TYPE=
169 +
170 +src_prepare() {
171 + cmake_src_prepare
172 + rm -v external/{kaguya,libutil}/cmake/FindLua.cmake || die
173 +}
174 +
175 +src_configure() {
176 + if [[ -f revision.txt ]]; then
177 + local RTTR_REVISION="$(< revision.txt)"
178 + elif [[ -n ${COMMIT} ]]; then
179 + local RTTR_REVISION="${COMMIT}"
180 + else
181 + die "Could not determine RTTR_REVISION."
182 + fi
183 +
184 + local mycmakeargs=(
185 + -DBUILD_TESTING=$(usex test)
186 + -DCCACHE_PROGRAM=OFF
187 + -DCMAKE_DISABLE_FIND_PACKAGE_ClangFormat=ON
188 + -DCMAKE_SKIP_RPATH=ON
189 + -DLUA_VERSION=$(lua_get_version)
190 + -DRTTR_BUILD_UPDATER=OFF
191 + -DRTTR_ENABLE_OPTIMIZATIONS=OFF
192 + -DRTTR_ENABLE_SANITIZERS=$(usex test)
193 + -DRTTR_ENABLE_WERROR=OFF
194 + -DRTTR_INCLUDE_DEVTOOLS=OFF
195 + -DRTTR_LIBDIR="$(get_libdir)"
196 + -DRTTR_REVISION="${RTTR_REVISION}"
197 + -DRTTR_USE_SYSTEM_LIBS=ON
198 + -DRTTR_VERSION="${PV##*_pre}" # Tests expect a date for snapshots.
199 + )
200 +
201 + if use test && tc-is-gcc; then
202 + # Work around libasan and libsandbox both wanting to be first.
203 + append-ldflags -static-libasan
204 + fi
205 +
206 + cmake_src_configure
207 +}
208 +
209 +src_test() {
210 + SDL_AUDIODRIVER=dummy \
211 + SDL_VIDEODRIVER=dummy \
212 + USER=$(whoami) \
213 + cmake_src_test
214 +}
215 +
216 +src_install() {
217 + cmake_src_install
218 +
219 + doicon -s 64 tools/release/debian/s25rttr.png
220 + make_desktop_entry "${MY_PN}" "Return to the Roots"
221 +}
222 +
223 +pkg_postinst() {
224 + xdg_pkg_postinst
225 +
226 + if ! has_version -r games-strategy/settlers-2-gold-data; then
227 + elog "Install games-strategy/settlers-2-gold-data or manually copy the DATA"
228 + elog "and GFX directories from original data files into"
229 + elog "${EPREFIX}/usr/share/${PN}/S2."
230 + fi
231 +}