Files
guru/games-emulation/yuzu/yuzu-9999.ebuild
Samuel Bauer cb65ef27f4 games-emulation/yuzu: tweaks
Signed-off-by: Samuel Bauer <samuel.bauer@yahoo.fr>
2022-07-25 01:09:37 +02:00

156 lines
4.7 KiB
Bash

# Copyright 2020-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake git-r3 toolchain-funcs xdg
DESCRIPTION="An emulator for Nintendo Switch"
HOMEPAGE="https://yuzu-emu.org"
EGIT_REPO_URI="https://github.com/yuzu-emu/yuzu-mainline"
EGIT_SUBMODULES=( '-*' 'cpp-httplib' 'dynarmic' 'soundtouch' 'sirit' 'xbyak' )
# Soundtouch cannot be unbundled -> custom version
# Dynarmic is intended to be tailored on purpose, not to be generic
# TODO wait 'xbyak' for bump in tree, require 5.96
LICENSE="|| ( Apache-2.0 GPL-2+ ) 0BSD BSD GPL-2+ ISC MIT
!system-vulkan? ( Apache-2.0 )"
SLOT="0"
KEYWORDS=""
IUSE="+compatibility-list +cubeb discord +qt5 sdl system-vulkan webengine +webservice"
RDEPEND="
>=app-arch/zstd-1.5
>=dev-libs/libfmt-8:=
>=dev-libs/openssl-1.1:=
>=media-video/ffmpeg-4.3:=
app-arch/lz4:=
dev-libs/boost:=[context]
media-libs/opus
net-libs/mbedtls[cmac]
sys-libs/zlib
virtual/libusb:1
cubeb? ( media-libs/cubeb )
qt5? (
>=dev-qt/qtcore-5.15:5
>=dev-qt/qtgui-5.15:5
>=dev-qt/qtwidgets-5.15:5
)
sdl? (
>=media-libs/libsdl2-2.0.18
>=dev-libs/inih-52
)
"
DEPEND="${RDEPEND}
dev-util/spirv-headers
system-vulkan? ( >=dev-util/vulkan-headers-1.3.216 )
"
BDEPEND="
>=dev-cpp/catch-2.13:0
>=dev-cpp/nlohmann_json-3.8.0
dev-cpp/robin-map
dev-util/glslang
discord? ( >=dev-libs/rapidjson-1.1.0 )
"
REQUIRED_USE="|| ( qt5 sdl )"
pkg_setup() {
if tc-is-gcc; then
[[ "$(gcc-major-version)" -lt 11 ]] && \
die "You need gcc version 11 or clang to compile this package"
fi
}
src_unpack() {
if use discord; then
EGIT_SUBMODULES+=('discord-rpc')
fi
if use !system-vulkan; then
EGIT_SUBMODULES+=('Vulkan-Headers')
fi
git-r3_src_unpack
# Do not fetch via sources because this file always changes
use compatibility-list && curl https://api.yuzu-emu.org/gamedb/ > "${S}"/compatibility_list.json
}
src_prepare() {
# unused-result maybe temporary fix
sed -i -e '/Werror=unused-result/d' src/CMakeLists.txt || die
# headers is not a valid boost component
sed -i -e '/find_package(Boost/{s/headers //;s/CONFIG //}' CMakeLists.txt || die
# Allow skip submodule downloading
rm .gitmodules || die
# Unbundle inih
sed -i -e '/inih/d' externals/CMakeLists.txt || die
sed -i -e '1afind_package(PkgConfig REQUIRED)\npkg_check_modules(INIH REQUIRED INIReader)' \
-e '/target_link_libraries/s/inih/${INIH_LIBRARIES}/' src/yuzu_cmd/CMakeLists.txt || die
sed -i -e 's:inih/cpp/::' src/yuzu_cmd/config.cpp || die
# Unbundle xbyak ( uncomment when xbyak version is ok or never as it is only headers )
# sed -i -e '/^# xbyak/,/^endif()/d' externals/CMakeLists.txt || die
if use system-vulkan; then # Unbundle vulkan headers
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 || die
fi
# Unbundle mbedtls: undefined reference to `mbedtls_cipher_cmac'
sed -i -e '/mbedtls/d' externals/CMakeLists.txt || die
sed -i -e 's/mbedtls/& mbedcrypto mbedx509/' \
-e '1ifind_path(MBEDTLS_INCLUDE_DIR NAMES mbedtls/ssl.h)' \
-e '1ifind_library(MBEDTLS_LIB NAMES mbedtls)' \
-e '1ifind_library(MBEDX509_LIB NAMES mbedx509)' \
-e '1ifind_library(MBEDCRYPTO_LIB NAMES mbedcrypto)' \
src/core/CMakeLists.txt
# Workaround: GenerateSCMRev fails
sed -i -e "s/@GIT_BRANCH@/${EGIT_BRANCH:-master}/" \
-e "s/@GIT_REV@/$(git rev-parse --short HEAD)/" \
-e "s/@GIT_DESC@/$(git describe --always --long)/" \
src/common/scm_rev.cpp.in || die
if ! use discord; then
sed -i -e '/discord-rpc/d' externals/CMakeLists.txt || die
else
# Unbundle discord rapidjson
sed -i '/NOT RAPIDJSONTEST/,/endif(NOT RAPIDJSONTEST)/d;/find_file(RAPIDJSON/d;s:\${RAPIDJSON}:"/usr/include/rapidjson":' \
externals/discord-rpc/CMakeLists.txt || die
fi
# Unbundle cubeb
use cubeb && sed -i '$afind_package(Threads REQUIRED)' CMakeLists.txt || die
sed -i '/cubeb/d' externals/CMakeLists.txt || die
cmake_src_prepare
}
src_configure() {
local -a mycmakeargs=(
# Libraries are private and rely on circular dependency resolution.
-DBUILD_SHARED_LIBS=OFF
-DDYNARMIC_NO_BUNDLED_ROBIN_MAP=ON
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=$(usex compatibility-list)
-DENABLE_CUBEB=$(usex cubeb)
-DENABLE_QT=$(usex qt5)
-DENABLE_QT_TRANSLATION=$(usex qt5)
-DENABLE_SDL2=$(usex sdl)
-DENABLE_WEB_SERVICE=$(usex webservice)
-DSIRIT_USE_SYSTEM_SPIRV_HEADERS=ON # Use system SPIRV headers
-DUSE_DISCORD_PRESENCE=$(usex discord)
-DYUZU_USE_BUNDLED_OPUS=OFF
-DYUZU_USE_EXTERNAL_SDL2=OFF
-DYUZU_USE_QT_WEB_ENGINE=$(usex webengine)
)
cmake_src_configure
# This would be better in src_unpack but it would be unlinked
if use compatibility-list; then
mv "${S}"/compatibility_list.json "${BUILD_DIR}"/dist/compatibility_list/ || die
fi
}