diff options
Diffstat (limited to 'PKGBUILD')
-rwxr-xr-x | PKGBUILD | 432 |
1 files changed, 318 insertions, 114 deletions
@@ -1,132 +1,336 @@ -# Maintainer: Zion Nimchuk <zionnimchuk@gmail.com> -# Co-maintainer: Brendan Szymanski <bscubed@pm.me> +# Maintainer: +# Contributor: Zion Nimchuk <zionnimchuk@gmail.com> +# Contributor: Brendan Szymanski <hello@bscubed.dev> -_pkgname=yuzu -pkgname=$_pkgname-git -pkgver=r17729.2ff39f6fd +# options +: ${_build_clang:=true} + +: ${_build_avx:=false} +: ${_build_git:=true} + +[[ "${_build_avx::1}" == "t" ]] && _pkgtype+="-avx" +[[ "${_build_git::1}" == "t" ]] && _pkgtype+="-git" + +# basic info +_pkgname="yuzu" +pkgname="$_pkgname${_pkgtype:-}" +pkgver=r26547.8ddfecfba pkgrel=1 -pkgdesc='An experimental open-source Nintendo Switch emulator/debugger' -arch=('i686' 'x86_64') -url='https://github.com/yuzu-emu/yuzu' -license=('GPL2') -provides=('yuzu' 'yuzu-cmd') -conflicts=('yuzu-mainline-git' 'yuzu-canary-git') -depends=('desktop-file-utils' - 'glslang' - 'libxkbcommon-x11' - 'libfdk-aac' - 'lz4' - 'openssl' - 'qt5-base' - 'qt5-multimedia' - 'qt5-tools' - 'qt5-wayland' - 'qt5-webengine' - 'sdl2' - 'shared-mime-info' - 'zlib' - 'zstd') -makedepends=('catch2' 'cmake' 'fmt' 'git' 'nlohmann-json') -source=("$_pkgname::git+https://github.com/yuzu-emu/yuzu" - 'git+https://github.com/benhoyt/inih.git' - 'git+https://github.com/kinetiknz/cubeb.git' - 'git+https://github.com/MerryMage/dynarmic.git' - 'git+https://github.com/citra-emu/ext-soundtouch.git' - 'libressl::git+https://github.com/citra-emu/ext-libressl-portable.git' - 'git+https://github.com/libusb/libusb.git' - 'git+https://github.com/discordapp/discord-rpc.git' - 'git+https://github.com/KhronosGroup/Vulkan-Headers.git' - 'git+https://github.com/ReinUsesLisp/sirit' - 'git+https://github.com/yuzu-emu/mbedtls' - 'git+https://github.com/nih-at/libzip.git' - 'git+https://github.com/herumi/xbyak.git' - 'git+https://github.com/xiph/opus.git' - 'git+https://git.ffmpeg.org/ffmpeg.git' - 'git+https://github.com/libsdl-org/SDL.git' - # cubeb dependencies - 'git+https://github.com/arsenm/sanitizers-cmake.git' - # sirit dependencies - 'git+https://github.com/KhronosGroup/SPIRV-Headers.git') -md5sums=('SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP') +pkgdesc='Nintendo Switch emulator' +url="https://github.com/yuzu-emu/yuzu" +license=('GPL-3.0-or-later') +arch=('x86_64') + +# main package +_main_package() { + depends=( + 'boost-libs' + 'fmt' + 'qt6-multimedia' + 'qt6-webengine' + 'sdl2' + + #'cubeb' + #'enet' + #'mbedtls' + ) + makedepends=( + 'boost' + 'catch2' + 'cmake' + 'ffmpeg' + 'git' + 'glslang' + 'ninja' + 'nlohmann-json' + 'qt6-tools' + 'rapidjson' + 'robin-map' + 'stb' + + #'cpp-httplib' + #'cpp-jwt' + #'renderdoc' + #'spirv-headers' + #'vulkan-headers' + #'vulkan-memory-allocator' + ) + optdepends=( + "qt6-wayland: Wayland support" + ) + + if [[ "${_build_clang::1}" == "t" ]] ; then + makedepends+=( + 'clang' + 'lld' + 'llvm' + ) + fi + + provides=("$_pkgname") + conflicts=("$_pkgname") + + _pkgsrc="$_pkgname" + source=("$_pkgsrc"::"git+$url.git") + sha256sums=('SKIP') + + _source_yuzu + _source_bylaws_libadrenotools + _source_lat9nq_tzdb_to_nx + _source_mozilla_cubeb + _source_yuzu_emu_sirit +} + +# submodules +_source_yuzu() { + source+=( + 'arun11299.cpp-jwt'::'git+https://github.com/arun11299/cpp-jwt.git' + 'brofield.simpleini'::'git+https://github.com/brofield/simpleini.git' + 'bylaws.libadrenotools'::'git+https://github.com/bylaws/libadrenotools.git' + 'ffmpeg'::'git+https://github.com/FFmpeg/FFmpeg.git' + 'gpuopen-librariesandsdks.vulkanmemoryallocator'::'git+https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git' + 'herumi.xbyak'::'git+https://github.com/herumi/xbyak.git' + 'khronosgroup.vulkan-headers'::'git+https://github.com/KhronosGroup/Vulkan-Headers.git' + 'khronosgroup.vulkan-utility-libraries'::'git+https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git' + 'lat9nq.tzdb_to_nx'::'git+https://github.com/lat9nq/tzdb_to_nx.git' + 'libsdl-org.sdl'::'git+https://github.com/libsdl-org/SDL.git' + 'libusb'::'git+https://github.com/libusb/libusb.git' + 'lsalzman.enet'::'git+https://github.com/lsalzman/enet.git' + 'merryhime.dynarmic'::'git+https://github.com/merryhime/dynarmic.git' + 'merryhime.oaknut'::'git+https://github.com/merryhime/oaknut.git' + 'microsoft.vcpkg'::'git+https://github.com/microsoft/vcpkg.git' + 'mozilla.cubeb'::'git+https://github.com/mozilla/cubeb.git' + 'xiph.opus'::'git+https://github.com/xiph/opus.git' + 'yhirose.cpp-httplib'::'git+https://github.com/yhirose/cpp-httplib.git' + 'yuzu-emu.breakpad'::'git+https://github.com/yuzu-emu/breakpad.git' + 'yuzu-emu.discord-rpc'::'git+https://github.com/yuzu-emu/discord-rpc.git' + 'yuzu-emu.mbedtls'::'git+https://github.com/yuzu-emu/mbedtls.git' + 'yuzu-emu.sirit'::'git+https://github.com/yuzu-emu/sirit.git' + ) + sha256sums+=( + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + ) + + _prepare_yuzu() ( + cd "$_pkgsrc" + local -A _submodules=( + ['arun11299.cpp-jwt']='externals/cpp-jwt' + ['brofield.simpleini']='externals/simpleini' + ['bylaws.libadrenotools']='externals/libadrenotools' + ['ffmpeg']='externals/ffmpeg/ffmpeg' + ['gpuopen-librariesandsdks.vulkanmemoryallocator']='externals/VulkanMemoryAllocator' + ['herumi.xbyak']='externals/xbyak' + ['khronosgroup.vulkan-headers']='externals/Vulkan-Headers' + ['khronosgroup.vulkan-utility-libraries']='externals/Vulkan-Utility-Libraries' + ['lat9nq.tzdb_to_nx']='externals/nx_tzdb/tzdb_to_nx' + ['libsdl-org.sdl']='externals/SDL' + ['libusb']='externals/libusb/libusb' + ['lsalzman.enet']='externals/enet' + ['merryhime.dynarmic']='externals/dynarmic' + ['merryhime.oaknut']='externals/oaknut' + ['microsoft.vcpkg']='externals/vcpkg' + ['mozilla.cubeb']='externals/cubeb' + ['xiph.opus']='externals/opus' + ['yhirose.cpp-httplib']='externals/cpp-httplib' + ['yuzu-emu.breakpad']='externals/breakpad' + ['yuzu-emu.discord-rpc']='externals/discord-rpc' + ['yuzu-emu.mbedtls']='externals/mbedtls' + ['yuzu-emu.sirit']='externals/sirit' + ) + _submodule_update + ) +} + +_source_bylaws_libadrenotools() { + source+=( + 'bylaws.liblinkernsbypass'::'git+https://github.com/bylaws/liblinkernsbypass.git' + ) + sha256sums+=( + 'SKIP' + ) + + _prepare_bylaws_libadrenotools() ( + cd "$_pkgsrc" + cd "externals/libadrenotools" + local -A _submodules=( + ['bylaws.liblinkernsbypass']='lib/linkernsbypass' + ) + _submodule_update + ) +} + +_source_lat9nq_tzdb_to_nx() { + source+=( + 'eggert.tz'::'git+https://github.com/eggert/tz.git' + ) + sha256sums+=( + 'SKIP' + ) + + _prepare_lat9nq_tzdb_to_nx() ( + cd "$_pkgsrc" + cd "externals/nx_tzdb/tzdb_to_nx" + local -A _submodules=( + ['eggert.tz']='externals/tz/tz' + ) + _submodule_update + ) +} + +_source_mozilla_cubeb() { + source+=( + 'arsenm.sanitizers-cmake'::'git+https://github.com/arsenm/sanitizers-cmake.git' + 'google.googletest'::'git+https://github.com/google/googletest.git' + ) + sha256sums+=( + 'SKIP' + 'SKIP' + ) + _prepare_mozilla_cubeb() ( + cd "$_pkgsrc" + cd "externals/cubeb" + local -A _submodules=( + ['arsenm.sanitizers-cmake']='cmake/sanitizers-cmake' + ['google.googletest']='googletest' + ) + _submodule_update + ) +} + +_source_yuzu_emu_sirit() { + source+=( + 'khronosgroup.spirv-headers'::'git+https://github.com/KhronosGroup/SPIRV-Headers.git' + ) + sha256sums+=( + 'SKIP' + ) + + _prepare_yuzu_emu_sirit() ( + cd "$_pkgsrc" + cd "externals/sirit" + local -A _submodules=( + ['khronosgroup.spirv-headers']='externals/SPIRV-Headers' + ) + _submodule_update + ) +} + +# common functions pkgver() { - cd "$srcdir/$_pkgname" - echo "r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)" + cd "$_pkgsrc" + printf 'r%s.%s' \ + "$(git rev-list --count HEAD)" \ + "$(git rev-parse --short=9 HEAD)" } prepare() { - cd "$srcdir/$_pkgname" - - for submodule in externals/{inih/inih,cubeb,dynarmic,soundtouch,libressl,libusb/libusb,discord-rpc,Vulkan-Headers,sirit,mbedtls,libzip/libzip,xbyak,opus/opus,ffmpeg,SDL}; do - git submodule init ${submodule} - git config submodule.${submodule}.url "$srcdir/${submodule##*/}" - git submodule update + _submodule_update() { + local key + for key in ${!_submodules[@]} ; do + git submodule init "${_submodules[${key}]}" + git submodule set-url "${_submodules[${key}]}" "${srcdir}/${key}" + git -c protocol.file.allow=always submodule update "${_submodules[${key}]}" done + } - cd "$srcdir/$_pkgname"/externals/cubeb + _prepare_yuzu - for submodule in cmake/sanitizers-cmake; do - git submodule init ${submodule} - git config submodule.${submodule}.url "$srcdir/${submodule##*/}" - git submodule update - done - - cd "$srcdir/$_pkgname"/externals/sirit - - for submodule in externals/SPIRV-Headers; do - git submodule init ${submodule} - git config submodule.${submodule}.url "$srcdir/${submodule##*/}" - git submodule update - done + _prepare_bylaws_libadrenotools + _prepare_lat9nq_tzdb_to_nx + _prepare_mozilla_cubeb + _prepare_yuzu_emu_sirit } build() { - cd "$srcdir/$_pkgname" - - # Trick the compiler into thinking we're building from a continuous - # integration tool so the build number is correctly shown in the title - export CI=true - export TRAVIS=true - export TRAVIS_REPO_SLUG=yuzu-emu/yuzu-mainline - export TRAVIS_TAG=$(git describe --tags) - - if [[ -d build ]]; then - rm -rf build - fi - mkdir -p build && cd build - cmake .. \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_BUILD_TYPE=Release \ - -DENABLE_QT_TRANSLATION=ON \ - -DYUZU_USE_BUNDLED_BOOST=ON \ - -DYUZU_USE_QT_WEB_ENGINE=ON \ - -DUSE_DISCORD_PRESENCE=ON - make -} + local _cmake_options=( + -S "$_pkgsrc" + -B build + -GNinja + -DCMAKE_BUILD_TYPE="Release" + -DCMAKE_INSTALL_PREFIX="/usr" + + -DYUZU_USE_BUNDLED_FFMPEG=OFF + -DYUZU_USE_FASTER_LD=OFF + -DYUZU_USE_EXTERNAL_SDL2=OFF + -DYUZU_USE_EXTERNAL_VULKAN_HEADERS=OFF + + -DYUZU_USE_BUNDLED_QT=OFF + -DYUZU_USE_QT_MULTIMEDIA=ON + -DYUZU_USE_QT_WEB_ENGINE=ON + -DENABLE_QT6=ON + -DENABLE_QT_TRANSLATION=ON -check() { - cd "$srcdir/$_pkgname/build" - make test + -DYUZU_DOWNLOAD_TIME_ZONE_DATA=ON + -DUSE_DISCORD_PRESENCE=ON + -DSIRIT_USE_SYSTEM_SPIRV_HEADERS=OFF + -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON + + -DBUILD_REPOSITORY=yuzu-emu/yuzu + -DTITLE_BAR_FORMAT_IDLE="yuzu | ${pkgver} | {}" + -DTITLE_BAR_FORMAT_RUNNING="yuzu | ${pkgver} | {}" + + -DYUZU_TESTS=OFF + -Wno-dev + ) + + if [[ "${_build_clang::1}" == "t" ]] ; then + export AR=llvm-ar + export NM=llvm-nm + + _cmake_options+=( + -DCMAKE_C_COMPILER=clang + -DCMAKE_CXX_COMPILER=clang++ + + -DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" + -DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" + -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" + + -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON + -DCMAKE_POLICY_DEFAULT_CMP0069=NEW + -DYUZU_ENABLE_LTO=ON + ) + else + _cmake_options+=( + -DYUZU_ENABLE_LTO=ON + ) + fi + + if [[ "${_build_avx::1}" == "t" ]] ; then + export CFLAGS="$(echo "$CFLAGS" | sed -E 's@(\s*-(march|mtune)=\S+\s*)@ @g;s@\s*-O[0-9]\s*@ @g;s@\s+@ @g') -march=x86-64-v3 -mtune=generic -O3" + export CXXFLAGS="$(echo "$CXXFLAGS" | sed -E 's@(\s*-(march|mtune)=\S+\s*)@ @g;s@\s*-O[0-9]\s*@ @g;s@\s+@ @g') -march=x86-64-v3 -mtune=generic -O3" + fi + + cmake "${_cmake_options[@]}" + cmake --build build } package() { - cd "$srcdir/$_pkgname/build" - make DESTDIR="$pkgdir/" install + DESTDIR="${pkgdir:?}" cmake --install build + + install -Dm644 "$_pkgsrc/dist/72-yuzu-input.rules" -t "$pkgdir/usr/lib/udev/rules.d/" } + +# execute +_main_package |