# Template file for 'dolphin-emu'
pkgname=dolphin-emu
version=2509
revision=2
_cubeb_commit=54217bca3f3e0cd53c073690a23dd25d83557909
_fmt_commit=e69e5f977d458f2650bb346dadf2ad30c5320281
_googletest_commit=40412d85124f7c6f3d88454583c4633e5e10fc8c
_implot_commit=3da8bd34299965d3b0ab124df743fe3e076fa222
_libspng_commit=fb768002d4288590083a476af628e51c3f1d47cd
_mgba_commit=8739b22fbc90fdf0b4f6612ef9c0520f0ba44a51
_rcheevos_commit=b443902b1cdfee5a66b09fec20a94d2d2afaf2ec
_sanitizers_cmake_commit=aab6948fa863bc1cbe5d0850bc46b9ef02ed4c1a
_sfml_commit=016bea9491ccafc3529019fe1d403885a8b3a6ae
_spirv_cross_commit=ebe2aa0cd80f5eb5cd8a605da604cacf72205f3b
_tinygltf_commit=c5641f2c22d117da7971504591a8f6a41ece488b
_vma_commit=3bab6924988e5f19bf36586a496156cf72f70d9f
_watcher_commit=b03bdcfc11549df595b77239cefe2643943a3e2f
archs="x86_64* aarch64* ppc64le* i686"
build_style=cmake
configure_args="-DDISTRIBUTOR=voidlinux.org -DENABLE_ANALYTICS=OFF
 -DENABLE_AUTOUPDATE=OFF -DUSE_DISCORD_PRESENCE=OFF"
hostmakedepends="gettext pkg-config python3 qt6-base qt6-tools"
makedepends="SDL3-devel SFML-devel alsa-lib-devel ffmpeg6-devel glew-devel
 hidapi-devel libbluetooth-devel libcurl-devel libenet-devel libevdev-devel
 libgomp-devel liblz4-devel liblzma-devel libopenal-devel libusb-devel lzo-devel
 mbedtls2-devel miniupnpc-devel portaudio-devel pugixml-devel pulseaudio-devel
 qt6-base-devel qt6-base-private-devel qt6-svg-devel soundtouch-devel xxHash-devel zlib-devel
 minizip-ng-devel zlib-ng-devel"
depends="desktop-file-utils"
short_desc="Gamecube / Wii / Triforce emulator"
maintainer="Henry Naguski <henry@nilsu.org>"
license="GPL-2.0-or-later"
homepage="https://dolphin-emu.org"
distfiles="https://github.com/dolphin-emu/dolphin/archive/${version}.tar.gz
 https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/archive/${_vma_commit}.tar.gz
 https://github.com/KhronosGroup/SPIRV-Cross/archive/${_spirv_cross_commit}.tar.gz
 https://github.com/RetroAchievements/rcheevos/archive/${_rcheevos_commit}.tar.gz
 https://github.com/SFML/SFML/archive/${_sfml_commit}.tar.gz
 https://github.com/arsenm/sanitizers-cmake/archive/${_sanitizers_cmake_commit}.tar.gz
 https://github.com/e-dant/watcher/archive/${_watcher_commit}.tar.gz
 https://github.com/epezent/implot/archive/${_implot_commit}.tar.gz
 https://github.com/fmtlib/fmt/archive/${_fmt_commit}.tar.gz
 https://github.com/google/googletest/archive/${_googletest_commit}.tar.gz
 https://github.com/mgba-emu/mgba/archive/${_mgba_commit}.tar.gz
 https://github.com/mozilla/cubeb/archive/${_cubeb_commit}.tar.gz
 https://github.com/randy408/libspng/archive/${_libspng_commit}.tar.gz
 https://github.com/syoyo/tinygltf/archive/${_tinygltf_commit}.tar.gz"
checksum="97d2851f479978334f7a8dffab301d43d9318d767c63260b4982e4a5c7d2397d
 618dc35e4f571a508575fc1fc914eb15ab513e4443986509aff08dfb8844ba24
 ff848426a2eabfa0dfb5ee961440210f6cdec190883ed438ee7252ba595c9128
 6b5872d010cc4e7441489c1f812961d0331a3b011503e84bb35d9677517a61a9
 6a203982ff5061cbda169f58531bf1942e87cd1394c195727797dcd285bd371e
 9f5b073625375322236a94ce8d2d803cdedad321c91e63845f487b9ebfb2c433
 61e97c12c3d23f2b6588d99ce61c8ad462b4382f979d14c7a338a11af507edd1
 4700b44ef00ca2feba0b35a31922c240045bbeb900da5b3eb3830b56871ada45
 1723f27eed50e751037f49dcdf73e33b17658f1178ea1c1f829a30bb02335745
 ff9fb47ea9e2cb4dc0f30956a2f3b5e42dde67b06f33241d22ac255e5981eda0
 07e73f02198affccf83cc9740d377b78ba27866b0d654a5e55cafae69d1dfa1c
 a795511bf56183ff7bad8fb2d2836ca5bb158e12ddd519caced62946ffa69c83
 d656813290d70a750b69e768323ff3b3875adf8c2e8c2fdb4e57ca1467abf86a
 6352803f1ed18d479ea93abf96ac75c0222a21403be22840bde1072ee5935dfa"
skip_extraction="${_cubeb_commit}.tar.gz
 ${_fmt_commit}.tar.gz
 ${_googletest_commit}.tar.gz
 ${_implot_commit}.tar.gz
 ${_libspng_commit}.tar.gz
 ${_mgba_commit}.tar.gz
 ${_rcheevos_commit}.tar.gz
 ${_sanitizers_cmake_commit}.tar.gz
 ${_sfml_commit}.tar.gz
 ${_spirv_cross_commit}.tar.gz
 ${_tinygltf_commit}.tar.gz
 ${_vma_commit}.tar.gz
 ${_watcher_commit}.tar.gz"

case "$XBPS_TARGET_MACHINE" in
	i686*) CFLAGS=-msse2 ;;
esac

case "$XBPS_TARGET_MACHINE" in
	x86_64*|aarch64*) ;;
	*) configure_args+=" -DENABLE_GENERIC=ON" ;;
esac

post_extract() {
	vsrcextract -C Externals/SFML/SFML ${_sfml_commit}.tar.gz
	vsrcextract -C Externals/VulkanMemoryAllocator ${_vma_commit}.tar.gz
	vsrcextract -C Externals/cubeb/cubeb ${_cubeb_commit}.tar.gz
	vsrcextract -C Externals/cubeb/cubeb/cmake/sanitizers-cmake ${_sanitizers_cmake_commit}.tar.gz
	vsrcextract -C Externals/fmt/fmt ${_fmt_commit}.tar.gz
	vsrcextract -C Externals/gtest ${_googletest_commit}.tar.gz
	vsrcextract -C Externals/implot/implot ${_implot_commit}.tar.gz
	vsrcextract -C Externals/libspng/libspng ${_libspng_commit}.tar.gz
	vsrcextract -C Externals/mGBA/mgba ${_mgba_commit}.tar.gz
	vsrcextract -C Externals/rcheevos/rcheevos ${_rcheevos_commit}.tar.gz
	vsrcextract -C Externals/spirv_cross/SPIRV-Cross ${_spirv_cross_commit}.tar.gz
	vsrcextract -C Externals/tinygltf/tinygltf ${_tinygltf_commit}.tar.gz
	vsrcextract -C Externals/watcher/watcher "${_watcher_commit}.tar.gz"
	cp -r Externals/gtest/* Externals/cubeb/cubeb/googletest
}

post_install() {
	vinstall Data/51-usb-device.rules 644 usr/lib/udev/rules.d
}
