Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:master commit in: games-emulation/yuzu/files/, games-emulation/yuzu/
Date: Thu, 29 Apr 2021 08:23:34
Message-Id: 1619625576.4b611a5c84b3a3d33b7f428cbd0ca638d1e50ca5.mgorny@gentoo
1 commit: 4b611a5c84b3a3d33b7f428cbd0ca638d1e50ca5
2 Author: Samuel Bauer <samuel.bauer <AT> yahoo <DOT> fr>
3 AuthorDate: Wed Apr 28 15:59:36 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 28 15:59:36 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=4b611a5c
7
8 games-emulation/yuzu: new ebuild
9
10 Signed-off-by: Samuel Bauer <samuel.bauer <AT> yahoo.fr>
11
12 games-emulation/yuzu/Manifest | 3 +
13 games-emulation/yuzu/files/yuzu-9999-assert.patch | 34 ++++++
14 games-emulation/yuzu/metadata.xml | 15 +++
15 games-emulation/yuzu/yuzu-9999.ebuild | 120 ++++++++++++++++++++++
16 4 files changed, 172 insertions(+)
17
18 diff --git a/games-emulation/yuzu/Manifest b/games-emulation/yuzu/Manifest
19 new file mode 100644
20 index 000000000..b86ef1467
21 --- /dev/null
22 +++ b/games-emulation/yuzu/Manifest
23 @@ -0,0 +1,3 @@
24 +AUX yuzu-9999-assert.patch 2145 BLAKE2B 140ace2db8a6621205b65e8f7585a624a792198ded7949b2baafc549dbe70afc3faa0eae62d440d8d02a6f7272c2a5290aa185d68cf92417c50b20fafb96daf1 SHA512 89930366f369ccb1a978cd0eb7c32ecd03f77ffa04a5439450e5e3264a79b92cdddc9468f88e5b1adacbf340c8aa2c7614ca5b12cf7062a069bb519a6dc009b1
25 +EBUILD yuzu-9999.ebuild 4296 BLAKE2B 487ef667564ad7e04afcfe5f13276c547311432a435381a9dae7b8a317ae527ac2fa7f9ade61c20577c42bf7b3484621a3a3c1471d0a78e39a151491da7df95f SHA512 a53f40d05363fb5059b4318026a130f84c2f97ca9be9222688c9f93a0382621d9b53193db47e7acef48b1c0cacb0b598233338ace26fcdf38e0155dc21ef6dcf
26 +MISC metadata.xml 613 BLAKE2B 4d4bddfd2fa545273ac302e325fccff48bd3690009f76533a0fc1240ed543bb940096f8918e0c22700ea55e0cc2b5211e98cef067f96afaaa76563762b3c6ea3 SHA512 a816a2e2dd9bf374ed15128fb87d5db011dcc42e913f6f24eb98eee9642b302fd2b5d9e50ec07f2a11f2cfe65c3e819c3b6cb36f4f401cbb7ddc86ac0b0ab573
27
28 diff --git a/games-emulation/yuzu/files/yuzu-9999-assert.patch b/games-emulation/yuzu/files/yuzu-9999-assert.patch
29 new file mode 100644
30 index 000000000..cd342ffba
31 --- /dev/null
32 +++ b/games-emulation/yuzu/files/yuzu-9999-assert.patch
33 @@ -0,0 +1,34 @@
34 +--- a/src/common/assert.h
35 ++++ b/src/common/assert.h
36 +@@ -28,22 +28,19 @@ __declspec(noinline, noreturn)
37 + }
38 +
39 + #define ASSERT(_a_) \
40 +- do \
41 +- if (!(_a_)) { \
42 +- assert_noinline_call([] { LOG_CRITICAL(Debug, "Assertion Failed!"); }); \
43 +- } \
44 +- while (0)
45 ++ if (!(_a_)) { \
46 ++ LOG_CRITICAL(Debug, "Assertion Failed!"); \
47 ++ }
48 +
49 + #define ASSERT_MSG(_a_, ...) \
50 +- do \
51 +- if (!(_a_)) { \
52 +- assert_noinline_call([&] { LOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); }); \
53 +- } \
54 +- while (0)
55 ++ if (!(_a_)) { \
56 ++ LOG_CRITICAL(Debug, "Assertion Failed! " __VA_ARGS__); \
57 ++ }
58 +
59 +-#define UNREACHABLE() assert_noinline_call([] { LOG_CRITICAL(Debug, "Unreachable code!"); })
60 ++#define UNREACHABLE() \
61 ++ { LOG_CRITICAL(Debug, "Unreachable code!"); }
62 + #define UNREACHABLE_MSG(...) \
63 +- assert_noinline_call([&] { LOG_CRITICAL(Debug, "Unreachable code!\n" __VA_ARGS__); })
64 ++ { LOG_CRITICAL(Debug, "Unreachable code!\n" __VA_ARGS__); }
65 +
66 + #ifdef _DEBUG
67 + #define DEBUG_ASSERT(_a_) ASSERT(_a_)
68
69 diff --git a/games-emulation/yuzu/metadata.xml b/games-emulation/yuzu/metadata.xml
70 new file mode 100644
71 index 000000000..de9ad3b9b
72 --- /dev/null
73 +++ b/games-emulation/yuzu/metadata.xml
74 @@ -0,0 +1,15 @@
75 +<?xml version="1.0" encoding="UTF-8"?>
76 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
77 +<pkgmetadata>
78 +<maintainer type="person">
79 + <name>mazes-80</name>
80 + <email>mazes-80@××××××.com</email>
81 +</maintainer>
82 +<use>
83 + <flag name="boxcat">Enable the Boxcat service, a yuzu high-level implementation of BCAT</flag>
84 + <flag name="cubeb">Enables the cubeb audio backend</flag>
85 + <flag name="discord">Enables Discord Rich Presence</flag>
86 + <flag name="webengine">Use QtWebEngine for web applet implementation</flag>
87 + <flag name="webservice">Enable web services (telemetry, etc.)</flag>
88 +</use>
89 +</pkgmetadata>
90
91 diff --git a/games-emulation/yuzu/yuzu-9999.ebuild b/games-emulation/yuzu/yuzu-9999.ebuild
92 new file mode 100644
93 index 000000000..27ff0368f
94 --- /dev/null
95 +++ b/games-emulation/yuzu/yuzu-9999.ebuild
96 @@ -0,0 +1,120 @@
97 +# Copyright 2021 Gentoo Authors
98 +# Distributed under the terms of the GNU General Public License v2
99 +
100 +EAPI=7
101 +# PYTHON_COMPAT=( python2_7 )
102 +
103 +#inherit cmake git-r3 flag-o-matic python-any-r1 toolchain-funcs xdg
104 +inherit cmake git-r3 flag-o-matic toolchain-funcs xdg
105 +
106 +DESCRIPTION="An emulator for Nintendo Switch"
107 +HOMEPAGE="https://yuzu-emu.org"
108 +EGIT_REPO_URI="https://github.com/yuzu-emu/yuzu"
109 +EGIT_SUBMODULES=( '*' '-ffmpeg' '-inih' '-libressl' '-libusb' '-libzip' '-opus' )
110 +# TODO '-Vulkan-Headers' need to fix API in code
111 +# TODO '-xbyak' wait for bump in tree
112 +# TODO cubeb auto-links to jack, pulse, alsa .., allow determining cubeb output
113 +# media-libs/cubeb would benefit to a lot of packages: dolphin-emu, firefox, citra, self, ...
114 +# TODO many submodules produce static libraries which forces to unset BUILD_SHARED_LIBS
115 +# this may be better to generate shared libraries and install them under /usr/$(get_libdir)/yuzu
116 +# TODO python2 code should be needed only for submodules test
117 +# until verified keep track of python specific ebuild stuffs as comment
118 +
119 +LICENSE="GPL-3"
120 +SLOT="0"
121 +KEYWORDS="~amd64"
122 +IUSE="+boxcat +cubeb discord +qt5 sdl webengine +webservice"
123 +
124 +DEPEND="
125 + discord? ( >=dev-libs/rapidjson-1.1.0 )
126 + qt5? (
127 + >=dev-qt/qtgui-5.15
128 + >=dev-qt/qtwidgets-5.15
129 + )
130 + sdl? (
131 + media-libs/libsdl2
132 + >=dev-libs/inih-52
133 + )
134 + >=app-arch/lz4-1.8
135 + >=app-arch/zstd-1.4
136 + >=dev-cpp/catch-2.13:0
137 + >=dev-cpp/nlohmann_json-3.8.0
138 + >=dev-libs/boost-1.73:=[context]
139 + >=dev-libs/libfmt-7.1.0
140 + >=dev-libs/libzip-1.5
141 + >=media-libs/opus-1.3.1
142 + >=sys-libs/zlib-1.2
143 + virtual/libusb:1
144 +"
145 +# >=dev-libs/xbyak-5.96
146 +RDEPEND="${DEPEND}"
147 +REQUIRED_USE="boxcat? ( webservice ) || ( qt5 sdl )"
148 +
149 +PATCHES=( "${FILESDIR}"/${P}-assert.patch )
150 +
151 +pkg_setup() {
152 + if [ tc-is-gcc -a $(gcc-major-version) -lt 10 ]; then
153 + die "You need gcc version 10 or clang to compile this package"
154 + fi
155 +}
156 +
157 +src_unpack() {
158 + git-r3_src_unpack
159 +
160 + # Do not fetch via sources because this file always changes
161 + curl https://api.yuzu-emu.org/gamedb/ > "${S}"/compatibility_list.json
162 +}
163 +
164 +src_prepare() {
165 + # Set yuzu dev flags
166 + filter-flags '-*'
167 + append-cflags '-O3 -DNDEBUG'
168 + append-cxxflags '-O3 -DNDEBUG'
169 +
170 + # headers is not a valid boost component
171 + sed -i -e '/find_package(Boost/s/headers //' CMakeLists.txt || die
172 +
173 + # Allow skip submodule downloading
174 + rm .gitmodules
175 +
176 + # unbundle opus (thx to https://github.com/Alex-Aralis/yuzu-overlay/blob/master/games-emulation/yuzu/files/unbundle-opus.patch)
177 + sed -i -e "s!add_subdirectory(opus)!add_library(opus INTERFACE)\ntarget_include_directories(opus SYSTEM INTERFACE /usr/include/opus)\ntarget_link_libraries(opus INTERFACE /usr/$(get_libdir)/libopus.so)!" externals/CMakeLists.txt || die
178 +
179 + # Fix libzip detection
180 + sed -i -e '/Libzip/s:.*:include(find-modules/FindLibzip.cmake)\n&:' externals/CMakeLists.txt || die
181 +
182 + # Unbundle inih
183 + sed -i -e '/inih/d' externals/CMakeLists.txt || die
184 + sed -i -e '1afind_package(PkgConfig REQUIRED)\npkg_check_modules(INIH REQUIRED INIReader)' \
185 + -e '/target_link_libraries/s/inih/${INIH_LIBRARIES}/' src/yuzu_cmd/CMakeLists.txt || die
186 + sed -i -e 's:inih/cpp/::' src/yuzu_cmd/config.cpp || die
187 +
188 + # Unbundle xbyak ( uncomment when xbyak version is ok or never as it is only headers )
189 + # sed -i -e '/target_include_directories(xbyak/s:./xbyak/xbyak:/usr/include/xbyak/:' externals/CMakeLists.txt
190 +
191 + # Unbundle vulkan headers
192 + # sed -i -e 's:../../externals/Vulkan-Headers/include:/usr/include/vulkan/:' src/video_core/CMakeLists.txt src/yuzu/CMakeLists.txt src/yuzu_cmd/CMakeLists.txt
193 +
194 + # Unbundle discord rapidjson
195 + sed -i '/NOT RAPIDJSONTEST/,/endif(NOT RAPIDJSONTEST)/d;/find_file(RAPIDJSON/d;s:\${RAPIDJSON}:"/usr/include/rapidjson":' externals/discord-rpc/CMakeLists.txt || die
196 +
197 + cmake_src_prepare
198 +}
199 +
200 +src_configure() {
201 + local -a mycmakeargs=(
202 + -DBUILD_SHARED_LIBS=OFF
203 + -DENABLE_CUBEB=$(usex cubeb ON OFF)
204 + -DENABLE_QT=$(usex qt5)
205 + -DENABLE_QT_TRANSLATION=$(usex qt5)
206 + -DENABLE_SDL2=$(usex sdl)
207 + -DENABLE_WEB_SERVICE=$(usex webservice ON OFF)
208 + -DUSE_DISCORD_PRESENCE=$(usex discord ON OFF)
209 + -DYUZU_ENABLE_BOXCAT=$(usex boxcat ON OFF)
210 + -DYUZU_USE_QT_WEB_ENGINE=$(usex webengine ON OFF)
211 + )
212 + cmake_src_configure
213 +
214 + # This would be better in src_unpack but it would be unlinked
215 + mv "${S}"/compatibility_list.json "${BUILD_DIR}"/dist/compatibility_list/ || die
216 +}