Skip to content

Instantly share code, notes, and snippets.

@infirit
Last active June 18, 2023 08:31
Show Gist options
  • Save infirit/c9271ad8c0b1b1859427f6c55d4968c6 to your computer and use it in GitHub Desktop.
Save infirit/c9271ad8c0b1b1859427f6c55d4968c6 to your computer and use it in GitHub Desktop.
Dolphin don't download all of github PKGBUILD
_project_name="dolphin-emu"
_project_version="19368"
_mainpkg_name="dolphin-emu-beta"
_noguipkgname="$_projectname-beta-nogui"
_commit="dadbeb4bae7e7fa23af2b46e0add4143094dc107"
_commit_gtest="58d77fa8070e8cec2dc1ed015d66b454c8d78850"
_commit_implot="d87512353495e7760e7fda7566a05beef7627d8f"
_commit_libspng="dc5b1032c08efac68ad30170f7ccbf0aa8dd55c9"
_commit_mgba="8739b22fbc90fdf0b4f6612ef9c0520f0ba44a51"
_commit_rcheevos="d9e990e6d13527532b7e2bb23164a1f3b7f33bb5"
_commit_spirv="50b4d5389b6a06f86fb63a2848e1a7da6d9755ca"
_commit_zlib="ce01b1e41da298334f8214389cc9369540a7560f"
_commit_vma="498e20dfd1343d99b9115201034bb0219801cdec"
pkgname=("$_mainpkg_name")
pkgver=5.0_r$_project_version
pkgrel=1
pkgdesc='A Gamecube / Wii emulator'
arch=(x86_64)
url=https://dolphin-emu.org
license=(GPL-2.0-or-later)
depends=(
alsa-lib
bluez-libs
enet
gcc-libs
glibc
hidapi
libavcodec.so
libavformat.so
libavutil.so
libcurl.so
libevdev
libfmt.so
libgl
libminiupnpc.so
libpulse
libswscale.so
libudev.so
libusb-1.0.so
libx11
libxi
libxrandr
lzo
mbedtls
minizip-ng
pugixml
qt6-base
sfml
zlib
)
makedepends=(
cmake
git
ninja
python
)
optdepends=('pulseaudio: PulseAudio backend')
options=(!emptydirs)
conflicts=("dolphin-emu" "dolphin-emu-git" "dolphin-emu-beta-git")
source=(
"https://github.com/dolphin-emu/dolphin/archive/$_commit/dolphin-emu-$_commit.tar.gz"
"https://github.com/google/googletest/archive/$_commit_gtest/gtest-$_commit_gtest.tar.gz"
"https://github.com/epezent/implot/archive/$_commit_implot/implot-$_commit_implot.tar.gz"
"https://github.com/mgba-emu/mgba/archive/$_commit_mgba/mgba-$_commit_mgba.tar.gz"
"https://github.com/randy408/libspng/archive/$_commit_libspng/libspng-$_commit_libspng.tar.gz"
"https://github.com/RetroAchievements/rcheevos/archive/$_commit_rcheevos/rcheevos-$_commit_rcheevos.tar.gz"
"https://github.com/KhronosGroup/SPIRV-Cross/archive/$_commit_spirv/spirv-cross-$_commit_spirv.tar.gz"
"https://github.com/zlib-ng/zlib-ng/archive/$_commit_zlib/zlib-ng-$_commit.tar.gz"
"https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/archive/$_commit_vma/vma-$_commit_vma.tar.gz"
)
sha512sums=(
"f818c2c159022f3d7b5a7b8e12054d21e58f364cf3590a56c9dd7f47e6aef8d8b834ab9d8fa9c7c2225e4afd360178b3737f000996b0f39c30040d7146df3fff"
"d8153c426e4f9c89a74721cc4a24dfcaf319810f4f10aa25fc972f99da2d96d66bc840cf2f51b756fef6b1ca47e8d2c8633f5862cc24e34d57309ad48802124a"
"2b48ee1313ec6c0790fd10f5772082c91902fe3aa0a10a05b19107ee85096ef4e97b1068841cb7f6f947acfdd5df3695b01807222bdc1e4509cf79a1e6852ade"
"782d456b7bf827591c774f146a88821b41b3b936faefddb5aee82bb0dd16ca7ad7228a1c331e1e517eac40a71cc4c94cc44bee12560946328c8433e1c6327225"
"1931c8e8ce17926fa21fb167828a20aa7cca22090c6c82b1b28c8fa0024ede235128309148be661f39d80bea20e16cc36e19cd2673490daf01e5eb6f5461da01"
"2959002fc41225d7aedd0d69a5ca54b84a4e727814d5dca5b953a0075dd84fd2a2a3751e1840232ec6996868aa41874a00fdffabdf0d141ca53872849c5a8b40"
"237bf9c902c23721592bff44b493198bc6b732cbaf4712b1bf56bfe1df76e7290fadec7cccd1694fccd808a1f57b681f696c323ef616f547bb54ddc97c604cea"
"73f4e56410ae298ef211ebab52b1a0d3d5bfae91c2de3cd294b56cd0a78ab50e1203b396c7df462f360c1aaaa9392ec5625473d1e9eb084cc64bc813e28d12a1"
"1a58832ba11b953f097e321e335e5884e7f08e08ef7e7dff43c6faf7a0b7ffaf268b4c50f29fdc5eb08b03d4957f4194b72c4f4c87ae8f060bedf6f965063272"
)
builddir="$srcdir/dolphin-$_commit"
prepare() {
cd "$srcdir/dolphin-$_commit"
rm -r Externals/gtest
mv "$srcdir"/googletest-$_commit_gtest Externals/gtest
rm -r Externals/implot/implot
mv "$srcdir"/implot-$_commit_implot Externals/implot/implot
rm -r Externals/mGBA/mgba
mv "$srcdir"/mgba-$_commit_mgba Externals/mGBA/mgba
rm -r Externals/libspng/libspng
mv "$srcdir"/libspng-$_commit_libspng Externals/libspng/libspng
rm -r Externals/rcheevos/rcheevos
mv "$srcdir"/rcheevos-$_commit_rcheevos Externals/rcheevos/rcheevos
rm -r Externals/spirv_cross/SPIRV-Cross
mv "$srcdir"/SPIRV-Cross-$_commit_spirv Externals/spirv_cross/SPIRV-Cross
rm -r Externals/zlib-ng/zlib-ng
mv "$srcdir"/zlib-ng-$_commit_zlib Externals/zlib-ng/zlib-ng
rm -r Externals/VulkanMemoryAllocator
mv "$srcdir"/VulkanMemoryAllocator-$_commit_vma Externals/VulkanMemoryAllocator
KEEP_SOURCES="
Bochs_disasm
FatFs
FreeSurround
Vulkan
cpp-optparse
cubeb
discord-rpc
expr
fmt
glslang
gtest
imgui
implot
libspng
mbedtls
mGBA
minizip
picojson
rangeset
rcheevos
soundtouch
spirv_cross
VulkanMemoryAllocator
xxhash
zlib-ng
"
# Move the libraries we want to keep out of the externals folder
for s in $KEEP_SOURCES; do
mv -v "Externals/$s" .
done
# Remove the rest
rm -r Externals/*
# Move them back
for s in $KEEP_SOURCES; do
mv -v "$s" "Externals/"
done
# force the right version
sed -i "s|\${DOLPHIN_WC_DESCRIBE}|5.0-$_project_version|g" Source/Core/Common/scmrev.h.in
sed -i "s|\${DOLPHIN_WC_REVISION}|$_commit|g" Source/Core/Common/scmrev.h.in
## Fix packagename for arch
#sed -i "s|minizip|minizip-ng|g" CMakeLists.txt
# Fix VMA include
# sed -i "2605i #include <cstdio>" Externals/VulkanMemoryAllocator/include/vk_mem_alloc.h
}
build() {
cd "$srcdir/dolphin-$_commit"
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DUSE_SHARED_ENET=ON \
-DENABLE_LLVM=ON \
-DENABLE_GENERIC=$_generic \
-DDISTRIBUTOR="aur.archlinux.org" \
-DENABLE_SDL=ON \
-DENABLE_TESTS=OFF \
-DUSE_DISCORD_PRESENCE=ON \
-DENABLE_AUTOUPDATE=OFF \
-DENABLE_ANALYTICS=ON \
-Wno-dev \
-DCMAKE_DISABLE_FIND_PACKAGE_LIBMGBA=True \
-DCMAKE_DISABLE_FIND_PACKAGE_MBEDTLS=True \
-DCMAKE_C_COMPILER=gcc-12 \
-DCMAKE_CXX_COMPILER=g++-12
cmake --build build
}
package() {
cd "$srcdir/dolphin-$_commit"
DESTDIR="${pkgdir}" cmake --install build
install -Dm 644 Data/51-usb-device.rules -t "${pkgdir}"/usr/lib/udev/rules.d/
rm -rf "${pkgdir}"/usr/{include,lib/libdiscord-rpc.a}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment