Skip to content

Instantly share code, notes, and snippets.

@Odaem

Odaem/PKGBUILD Secret

Last active May 14, 2024 16:57
Show Gist options
  • Save Odaem/3ba0143fd2b78abfc14a8d7c23d356cd to your computer and use it in GitHub Desktop.
Save Odaem/3ba0143fd2b78abfc14a8d7c23d356cd to your computer and use it in GitHub Desktop.
suyu PKGBUILD
# Maintainer: Fijxu <fijxu [at] nadeko [dot] net>
# Maintainer: HurricanePootis <hurricanepootis@protonmail.com>
_pkgname=suyu
_branch=dev
pkgname=suyu-dev-qt6-git
pkgver=r27428.dfb9f06e5c
pkgrel=1
pkgdesc="suyu is the afterlife the world's most popular, open-source, Nintendo Switch emulator (dev branch with QT6)"
arch=(x86_64)
url=https://git.suyu.dev/suyu/suyu
license=(GPL-3.0-or-later)
provides=('suyu')
conflicts=(suyu-dev-git suyu-git)
provides=(suyu-dev-git suyu-git)
install=$pkgname.install
depends=(
brotli
enet
llvm-libs
gcc-libs
glibc
hicolor-icon-theme
libavcodec.so
libavutil.so
libboost_context.so
libcrypto.so
libfmt.so
libopus.so
libspeexdsp.so
libssl.so
libusb-1.0.so
libva.so
libzstd.so
lz4
qt6-base
qt6-multimedia
qt6-webengine
sdl2
zlib
)
makedepends=(
boost
clang
cmake
ffmpeg
git
glslang
llvm
ninja
nlohmann-json
qt6-tools
shaderc
spirv-headers
vulkan-utility-libraries
catch2
rapidjson
mbedtls
)
options=(!debug lto)
source=(
git+https://git.suyu.dev/suyu/suyu.git#branch=${_branch}
# Submodules
git+https://github.com/lsalzman/enet.git
git+https://github.com/mozilla/cubeb.git
git+https://git.suyu.dev/suyu/dynarmic.git
git+https://github.com/libusb/libusb.git
git+https://git.suyu.dev/suyu/discord-rpc.git
git+https://git.suyu.dev/suyu/sirit.git
git+https://git.suyu.dev/suyu/mbedtls.git
git+https://github.com/herumi/xbyak.git
git+https://github.com/xiph/opus.git
git+https://github.com/yhirose/cpp-httplib.git
git+https://github.com/arun11299/cpp-jwt.git
git+https://github.com/bylaws/libadrenotools.git
git+https://github.com/lat9nq/tzdb_to_nx.git
git+https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
git+https://git.suyu.dev/suyu/breakpad.git
git+https://github.com/brofield/simpleini.git
git+https://github.com/merryhime/oaknut.git
# These repos are not used
# git+https://github.com/KhronosGroup/Vulkan-Headers.git
# git+https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
# git+https://github.com/libsdl-org/SDL.git
# git+https://github.com/microsoft/vcpkg.git
# ffmpeg::git+https://github.com/FFmpeg/FFmpeg.git
# Submodule Submodules
git+https://github.com/arsenm/sanitizers-cmake.git
git+https://github.com/zyantific/zycore-c.git
git+https://github.com/bylaws/liblinkernsbypass.git
git+https://github.com/eggert/tz.git
# Likewise not used
# git+https://github.com/KhronosGroup/SPIRV-Headers.git
)
b2sums=('SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
)
pkgver() {
cd "$srcdir/$_pkgname"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
local -A submodules=(
['enet']='externals/enet'
['cubeb']='externals/cubeb'
['dynarmic']='externals/dynarmic'
['libusb']='externals/libusb/libusb'
['discord-rpc']='externals/discord-rpc'
['sirit']='externals/sirit'
['mbedtls']='externals/mbedtls'
['xbyak']='externals/xbyak'
['opus']='externals/opus'
['cpp-httplib']='externals/cpp-httplib'
['cpp-jwt']='externals/cpp-jwt'
['libadrenotools']='externals/libadrenotools'
['tzdb_to_nx']='externals/nx_tzdb/tzdb_to_nx'
['VulkanMemoryAllocator']='externals/VulkanMemoryAllocator'
['breakpad']='externals/breakpad'
['simpleini']='externals/simpleini'
['oaknut']='externals/oaknut'
# ['Vulkan-Headers']='externals/Vulkan-Headers'
# ['Vulkan-Utility-Libraries']='externals/Vulkan-Utility-Libraries'
# ['SDL']='externals/SDL'
# ['ffmpeg']='externals/ffmpeg/ffmpeg'
# ['vcpkg']='externals/vcpkg'
)
cd "$srcdir/$_pkgname"
for submodule in "${!submodules[@]}" ; do
git submodule init "${submodules[$submodule]}"
git submodule set-url "${submodules[$submodule]}" "$srcdir/$submodule"
done
git -c protocol.file.allow=always submodule update
pushd externals/cubeb
git config submodule.cmake/sanitizers-cmake.url "${srcdir}"/sanitizers-cmake
git -c protocol.file.allow=always submodule update
popd
pushd externals/dynarmic/externals/zydis
git config submodule.dependencies/zycore.url "${srcdir}"/zycore
git -c protocol.file.allow=always submodule update
popd
pushd externals/libadrenotools
git config submodule.lib/linkersbypass.url "${srcdir}"/linkernsbypass
git -c protocol.file.allow=always submodule update
popd
pushd externals/nx_tzdb/tzdb_to_nx
git config submodule.externals/tz/tz.url "${srcdir}"/tz
git -c protocol.file.allow=always submodule update
popd
# SPIRV headers coming from the distro, so these are not used:
# pushd externals/sirit
# git config submodule.externals/SPIRV-Headers.url "${srcdir}"/SPIRV-Headers
# git -c protocol.file.allow=always submodule update
# popd
}
build() {
if [[ $CXXFLAGS == *"-flto"* ]]; then
flags+=("-DSUYU_ENABLE_LTO=ON")
fi
export CXXFLAGS+=' -Wno-switch'
cmake -S suyu -B build -G Ninja \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_REPOSITORY=suyu-emu/suyu \
-DBUILD_TAG=${_branch}-${pkgver} \
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF \
-DENABLE_QT6=ON \
-DENABLE_QT_TRANSLATION=ON \
-DENABLE_SDL2=ON \
-DENABLE_WEB_SERVICE=ON \
-DSIRIT_USE_SYSTEM_SPIRV_HEADERS=ON \
-DTITLE_BAR_FORMAT_IDLE="suyu | ${_branch}-${pkgver} {}" \
-DTITLE_BAR_FORMAT_RUNNING="suyu | ${_branch}-${pkgver} | {}" \
-DUSE_DISCORD_PRESENCE=ON \
-DSUYU_CHECK_SUBMODULES=ON \
-DSUYU_DOWNLOAD_TIME_ZONE_DATA=ON \
-DSUYU_USE_BUNDLED_FFMPEG=OFF \
-DSUYU_USE_BUNDLED_QT=OFF \
-DSUYU_USE_BUNDLED_SDL2=OFF \
-DSUYU_USE_EXTERNAL_VULKAN_HEADERS=OFF \
-DSUYU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES=OFF \
-DSUYU_USE_EXTERNAL_SDL2=OFF \
-DSUYU_USE_FASTER_LD=OFF \
-DSUYU_USE_PRECOMPILED_HEADERS=OFF \
-DSUYU_USE_QT_MULTIMEDIA=ON \
-DSUYU_USE_QT_WEB_ENGINE=ON \
-DSUYU_TESTS=OFF \
-DSUYU_CHECK_SUBMODULES=OFF \
"${flags[@]}" \
-Wno-dev
cmake --build build
}
package() {
DESTDIR="${pkgdir}" cmake --install build
install -Dm644 ${_pkgname}/dist/72-suyu-input.rules -t "${pkgdir}"/usr/lib/udev/rules.d/
}
# vim: ts=2 sw=2 et
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment