# Template file for 'dolphin-emu'
pkgname=dolphin-emu
version=2606
revision=1
_cpp_ipc_commit=b6cbbc940e25ff898f09a40b107781cef6027b13
_cpp_optparse_commit=2265d647232249a53a03b411099863ceca35f0d3
_cubeb_commit=54217bca3f3e0cd53c073690a23dd25d83557909
_glslang_commit=a57276bf558f5cf94d3a9854ebdf5a2236849a5a
_googletest_commit=40412d85124f7c6f3d88454583c4633e5e10fc8c
_imgui_commit=45acd5e0e82f4c954432533ae9985ff0e1aad6d5
_implot_commit=3da8bd34299965d3b0ab124df743fe3e076fa222
_libspng_commit=fb768002d4288590083a476af628e51c3f1d47cd
_mgba_commit=0b40863f64d0940f333fa1c638e75f86f8a26a33
_rcheevos_commit=926e4608f8dca7989267c787bbefb3ab1c835ac5
_sanitizers_cmake_commit=aab6948fa863bc1cbe5d0850bc46b9ef02ed4c1a
_sfml_commit=0fa201c969e48ecc253581c5841ce73f44d42f49
_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 fmt-devel"
depends="desktop-file-utils"
short_desc="Gamecube / Wii / Triforce emulator"
maintainer="chrysos349 <chrysostom349@gmail.com>"
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/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/KhronosGroup/glslang/archive/${_glslang_commit}.tar.gz
 https://github.com/mutouyun/cpp-ipc/archive/${_cpp_ipc_commit}.tar.gz
 https://github.com/ocornut/imgui/archive/${_imgui_commit}.tar.gz
 https://github.com/weisslj/cpp-optparse/archive/${_cpp_optparse_commit}.tar.gz
 https://github.com/syoyo/tinygltf/archive/${_tinygltf_commit}.tar.gz"
checksum="9c83727723db7dd5d0502857b745a21ac03dce1129566d0893581cca72933066
 618dc35e4f571a508575fc1fc914eb15ab513e4443986509aff08dfb8844ba24
 ff848426a2eabfa0dfb5ee961440210f6cdec190883ed438ee7252ba595c9128
 11e5fc43c4676289ff4637c04a9f43070235006d826c363628dcb194d5182ebd
 df03afdc2858d0e15e1c9ff06bddd113c18b2a6c089532f5b8d05dbb2e653f2a
 9f5b073625375322236a94ce8d2d803cdedad321c91e63845f487b9ebfb2c433
 61e97c12c3d23f2b6588d99ce61c8ad462b4382f979d14c7a338a11af507edd1
 4700b44ef00ca2feba0b35a31922c240045bbeb900da5b3eb3830b56871ada45
 ff9fb47ea9e2cb4dc0f30956a2f3b5e42dde67b06f33241d22ac255e5981eda0
 9b59ed1422914f605ce912e9cafcd84d1c5b1bf9abcf0fef1b49e1d810f6f5e5
 a795511bf56183ff7bad8fb2d2836ca5bb158e12ddd519caced62946ffa69c83
 d656813290d70a750b69e768323ff3b3875adf8c2e8c2fdb4e57ca1467abf86a
 02f4321a3ed01b9a9a9874f76e2d8ad078825818fcc9aae12dbf2c01674fb8af
 33991ccd0620ab1bd244c6e94c519f4bf7e64247cec90a772e20f5eccd468a30
 97484925aec2f4d3e913d6644d46b234f8d6d8d98c6aa9c50109e0f0df772090
 6f38fff3c4d2788eead7a28626b3220cc4c101510fc984678ad55f77756b107e
 6352803f1ed18d479ea93abf96ac75c0222a21403be22840bde1072ee5935dfa"
skip_extraction="${_cubeb_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
 ${_cpp_ipc_commit}.tar.gz
 ${_cpp_optparse_commit}.tar.gz
 ${_glslang_commit}.tar.gz
 ${_imgui_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/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"
	vsrcextract -C Externals/glslang/glslang "${_glslang_commit}.tar.gz"
	vsrcextract -C Externals/cpp-ipc/cpp-ipc "${_cpp_ipc_commit}.tar.gz"
	vsrcextract -C Externals/cpp-optparse/cpp-optparse "${_cpp_optparse_commit}.tar.gz"
	vsrcextract -C Externals/imgui/imgui "${_imgui_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
}
