Last active
May 5, 2025 10:26
-
-
Save sukanka/ea58a629d28cb46287ca41033761d1e5 to your computer and use it in GitHub Desktop.
PKGBUILD for torzu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From eac97f45c088ffcaa34a7e8bc870dfeea6d3fac0 Mon Sep 17 00:00:00 2001 | |
From: sukanka <[email protected]> | |
Date: Mon, 5 May 2025 17:24:17 +0800 | |
Subject: [PATCH 1/2] use system libs | |
5 5 CMakeLists.txt | |
diff --git a/CMakeLists.txt b/CMakeLists.txt | |
index 70e5e0487..c6cc42946 100644 | |
--- a/CMakeLists.txt | |
+++ b/CMakeLists.txt | |
@@ -343,7 +343,7 @@ if (NOT YUZU_USE_CPM) | |
find_package(enet 1.3 MODULE) | |
find_package(fmt REQUIRED) | |
if (YUZU_USE_LLVM_DEMANGLE) | |
- find_package(LLVM 17.0.2 MODULE COMPONENTS Demangle) | |
+ find_package(LLVM MODULE COMPONENTS Demangle) | |
endif() | |
find_package(lz4 REQUIRED) | |
find_package(nlohmann_json 3.8 REQUIRED) | |
@@ -459,7 +459,7 @@ if (ARCHITECTURE_arm64) | |
endif() | |
if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) | |
- find_package(dynarmic 6.4.0 CONFIG) | |
+ find_package(dynarmic CONFIG) | |
endif() | |
if (ENABLE_CUBEB) | |
@@ -472,6 +472,7 @@ endif() | |
if (ENABLE_WEB_SERVICE) | |
find_package(cpp-jwt 1.4 CONFIG) | |
+ find_package(httplib MODULE COMPONENTS OpenSSL) | |
endif() | |
if (YUZU_TESTS) | |
@@ -496,8 +497,6 @@ if(ENABLE_QT6 AND Qt6_LOCATION) | |
list(APPEND CMAKE_PREFIX_PATH "${Qt6_LOCATION}") | |
endif() | |
-# QT6 searches for Vulkan::Headers, too, so we have to define it before QT6 has a chance to do it. | |
-add_subdirectory(externals) | |
function(set_yuzu_qt_components) | |
# Best practice is to ask for all components at once, so they are from the same version | |
@@ -895,7 +894,8 @@ if (YUZU_USE_FASTER_LD AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | |
add_link_options("-fuse-ld=lld") | |
endif() | |
endif() | |
- | |
+# QT6 searches for Vulkan::Headers, too, so we have to define it before QT6 has a chance to do it. | |
+add_subdirectory(externals) | |
add_subdirectory(src) | |
# Set yuzu project or yuzu-cmd project as default StartUp Project in Visual Studio depending on whether QT is enabled or not | |
-- | |
2.49.0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From f22595192d6c33cf83fea637ebeb5a8a0ba79e4a Mon Sep 17 00:00:00 2001 | |
From: sukanka <[email protected]> | |
Date: Mon, 5 May 2025 18:10:21 +0800 | |
Subject: [PATCH 2/2] use system mbedtls | |
2 8 externals/CMakeLists.txt | |
2 1 src/CMakeLists.txt | |
1 0 src/yuzu/CMakeLists.txt | |
2 2 src/yuzu_cmd/CMakeLists.txt | |
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt | |
index 4a45430f2..ba53a92cb 100644 | |
--- a/externals/CMakeLists.txt | |
+++ b/externals/CMakeLists.txt | |
@@ -58,13 +58,8 @@ endif() | |
add_subdirectory(glad) | |
# mbedtls | |
-add_subdirectory(mbedtls) | |
-target_include_directories(mbedtls PUBLIC ./mbedtls/include) | |
-if (NOT MSVC) | |
- target_compile_options(mbedcrypto PRIVATE | |
- -Wno-unused-but-set-variable | |
- -Wno-string-concatenation) | |
-endif() | |
+set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/lib/mbedtls2/pkgconfig") | |
+pkg_check_modules(MbedTLS REQUIRED IMPORTED_TARGET GLOBAL mbedtls mbedcrypto) | |
# MicroProfile | |
add_library(microprofile INTERFACE) | |
@@ -346,4 +341,3 @@ if (ARCHITECTURE_arm64 AND NOT TARGET sse2neon) | |
add_library(sse2neon INTERFACE) | |
target_include_directories(sse2neon INTERFACE sse2neon) | |
endif() | |
- | |
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt | |
index bc8ea21a2..cd0a05c26 100644 | |
--- a/src/CMakeLists.txt | |
+++ b/src/CMakeLists.txt | |
@@ -2,7 +2,8 @@ | |
# SPDX-License-Identifier: GPL-2.0-or-later | |
# Enable modules to include each other's files | |
-include_directories(.) | |
+include_directories(. ${MbedTLS_INCLUDE_DIRS}) | |
+link_directories(${MbedTLS_LIBRARY_DIRS}) | |
# CMake seems to only define _DEBUG on Windows | |
set_property(DIRECTORY APPEND PROPERTY | |
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt | |
index 4bb91cf1c..a42d904ac 100644 | |
--- a/src/yuzu/CMakeLists.txt | |
+++ b/src/yuzu/CMakeLists.txt | |
@@ -384,6 +384,7 @@ endif() | |
target_link_libraries(yuzu PRIVATE common core input_common frontend_common network video_core) | |
target_link_libraries(yuzu PRIVATE Boost::headers httplib::httplib glad Qt${QT_MAJOR_VERSION}::Widgets) | |
target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) | |
+target_link_libraries(yuzu PRIVATE mbedtls mbedcrypto) | |
if (TARGET nlohmann::json) | |
target_link_libraries(yuzu PRIVATE nlohmann::json) | |
endif() | |
diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt | |
index f86d991b8..ab47094f5 100644 | |
--- a/src/yuzu_cmd/CMakeLists.txt | |
+++ b/src/yuzu_cmd/CMakeLists.txt | |
@@ -30,7 +30,7 @@ if (YUZU_CMD) | |
) | |
target_link_libraries(yuzu-cmd PRIVATE common core input_common frontend_common) | |
- target_link_libraries(yuzu-cmd PRIVATE glad) | |
+ target_link_libraries(yuzu-cmd PRIVATE glad mbedtls mbedcrypto) | |
if (MSVC) | |
target_link_libraries(yuzu-cmd PRIVATE getopt) | |
endif() | |
@@ -64,4 +64,4 @@ if (YUZU_CMD) | |
endif() | |
create_target_directory_groups(yuzu-cmd) | |
-endif() | |
\ No newline at end of file | |
+endif() | |
-- | |
2.49.0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: username227 <gfrank227 [at] gmail [dot] com> | |
_pkgname=torzu | |
_branch=main | |
pkgname=torzu-git | |
pkgver=2025.04.16.r0 | |
pkgrel=1 | |
pkgdesc="Torzu is a fork of yuzu, the world's most popular, open-source, Nintendo Switch emulator. It is written in C++ with portability in mind." | |
arch=(x86_64) | |
url=https://notabug.org/litucks/torzu | |
license=(GPL-3.0-or-later) | |
provides=('yuzu' 'torzu') | |
conflicts=('yuzu' 'torzu') | |
depends=('boost-libs' 'hicolor-icon-theme' 'sdl2' 'qt6-base' 'qt6-webengine' 'fmt' 'opus' 'lz4' | |
'openssl' 'zstd' 'cubeb' 'enet' 'discord-rpc' 'cpp-httplib' 'dynarmic' 'mbedtls2' 'ffmpeg' | |
) | |
makedepends=('llvm' 'git' 'glslang' 'cmake' 'ninja' 'perl' 'clang' 'patch' 'unzip' 'dos2unix' | |
'qt6-tools' 'qt6-multimedia' 'libxkbcommon-x11' 'libzip' 'libfdk-aac' 'libinih' | |
'vulkan-memory-allocator' 'vulkan-utility-libraries' 'vulkan-headers' 'spirv-headers' | |
'boost' 'nlohmann-json' 'robin-map' 'cpp-jwt' 'gamemode' 'python' 'renderdoc' | |
# 'xbyak' | |
# with xbyak we get the runtime err: | |
# terminate called after throwing an instance of 'Xbyak::Error' what(): bad size of register | |
# for documentation | |
# 'doxygen' 'python-jinja' 'python-jsonschema' 'graphviz' | |
# for testing | |
# 'catch2' | |
) optdepends=('qt6-wayland: for Wayland support') | |
source=( | |
git+${url}.git | |
git+https://github.com/herumi/xbyak.git#commit=a1ac3750f9 | |
ffmpeg::git+https://github.com/FFmpeg/FFmpeg.git#commit=e0db1f51d6 | |
git+https://github.com/bylaws/libadrenotools.git#commit=5deac9f1ab | |
git+https://github.com/lat9nq/tzdb_to_nx.git#commit=9792969023 | |
git+https://github.com/brofield/simpleini.git#commit=382ddbb4b9 | |
"https://github.com/lat9nq/tzdb_to_nx/releases/download/221202/221202.zip" | |
"0001-use-system-libs.patch" | |
"0002-use-system-mbedtls.patch" | |
) | |
noextract=('221202.zip') | |
b2sums=('SKIP' | |
'10564f981204fe52c4c737a5c98ff4431e156ea0936355ee999656b7564329531fe832dfbf742642c33fbb86ab95b2a082dcd9415ef91b9089e282f535f10057' | |
'ad41c1a684cd86722239020ea3c69bebb81736101b8a1db12cef15f54c6608d6f0327ac56aeff3706e94f8f141276aaddc89ace8da6fb86e67bbce4323934f30' | |
'50ad56f3317223ed855aaf03b3446cfa65e58078bb5b8cf62dae107ef13893240fcaf0e8f036aec1b4867514898b203736933804804cb34367c93443e4c1d152' | |
'03f29026e30be85bdd64331f29538baa9e88731192b5a8b944703c42d43335d42fd9ee7574a3d2dc1856a9f19133feaf4ce1d4e66df6c80005d724e6a152cc31' | |
'1bb5528208c155f148494ae488cef05182eadf0f17881f4b6c2cd7cc00bc4ffbf2612baf85bd29f8eb7053076b014ced34438b3c7a7429a99b75db27f826cbfd' | |
'7bd0ff5ca80cf560344ae7edbfeb7c9466c096dc499a7348276cff5d30aa07464f7e2ea391ca9cedac0e21ba6f563169a8b38f2df729a230a0acfb1125ea1b66' | |
'd29888ed8c87adc1f26ccfc2146e37557296542de053dc4617f86516acdd43a67645d76fcf17d4e48be6635d450b48470ed541827c827fd96d1d6d5b15e56e1f' | |
'fca83db294df1fa1aea5c68819fda80c7d458e36d19bf1f7da4089f99666bf154d29c9da900a281f8c89dc50ee56aad9a9d0fcedc1a7f7c83b5ecb50a14f2586') | |
pkgver() { | |
cd "$srcdir/$_pkgname" | |
git describe --long --abbrev=7 --tags | sed 's/\([^-]*\)-g.*/r\1/;s/-/./g' | |
} | |
prepare() { | |
local submods=( | |
libadrenotools | |
simpleini | |
xbyak | |
) | |
for pro in ${submods[@]}; do | |
if [ -d $srcdir/$_pkgname/externals/${pro} ]; then | |
cp -rf ${srcdir}/${pro}/* $srcdir/$_pkgname/externals/${pro} | |
else | |
cp -rf ${srcdir}/${pro} $srcdir/$_pkgname/externals/${pro} | |
fi | |
done | |
cp -rf tzdb_to_nx $srcdir/$_pkgname/externals/nx_tzdb/ | |
cp -rf ffmpeg/* $srcdir/$_pkgname/externals/ffmpeg/ffmpeg | |
cd $srcdir/${_pkgname} | |
for p in $srcdir/*.patch; do | |
patch -p1 -l <$p | |
done | |
# sed -i CMakeLists.txt \ | |
# -e '/-DBOOST_ASIO_DISABLE_CONCEPTS/d' \ | |
# -e 's/1.3.274/1.4.304/g' \ | |
# -e 's/httplib 0.12/httplib/g' | |
# sed -i src/video_core/host_shaders/CMakeLists.txt \ | |
# -e 's/--quiet //g' \ | |
# -e 's#${SPIRV_HEADER_FILE} ${SOURCE_FILE}#${SPIRV_HEADER_FILE} ${SOURCE_FILE} 2>/dev/null#g' | |
# sed -i -e '1i #include <cstring>' src/video_core/textures/bcn.cpp | |
# sed -i dist/onion.torzu_emu.torzu.desktop \ | |
# -e '/yuzu %f/a StartupWMClass=yuzu' \ | |
# -e 's_^MimeType=.*_&application/x-nx-nsp;application/x-nx-xci;_' | |
# sed -i -e 's| (%2)||' src/yuzu/aboutdialog.ui | |
# sed -i -e 's|io_service|io_context|g' src/input_common/drivers/udp_client.cpp src/tests/input_common/calibration_configuration_job.cpp | |
# sed -i -e "s|https://github.com/lat9nq/tzdb_to_nx/releases/download/\${NX_TZDB_VERSION}|file://${srcdir}|g" externals/nx_tzdb/CMakeLists.txt | |
# perl -0777 -i.original -pe 's/(\s*target_compile_options\(video_core PRIVATE\s*-Wno-sign-conversion)/$1\n -msse4.1/igs' src/video_core/CMakeLists.txt | |
} | |
build() { | |
export CC=clang | |
export CXX=clang++ | |
local cmake_args=( | |
-GNinja | |
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON | |
-DTITLE_BAR_FORMAT_IDLE="torzu $pkgver" | |
-DTITLE_BAR_FORMAT_RUNNING="torzu $pkgver | {3}" | |
-DCMAKE_INSTALL_PREFIX=/usr | |
-DCMAKE_BUILD_TYPE=Release | |
-DYUZU_ENABLE_COMPATIBILITY_REPORTING=OFF | |
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF | |
-DYUZU_USE_QT_WEB_ENGINE=ON | |
-DUSE_DISCORD_PRESENCE=ON | |
-DENABLE_QT_TRANSLATION=ON | |
-DYUZU_USE_BUNDLED_FFMPEG=OFF | |
-DYUZU_USE_BUNDLED_QT=OFF | |
-DYUZU_USE_EXTERNAL_SDL2=OFF | |
-DYUZU_CHECK_SUBMODULES=OFF | |
-DYUZU_USE_EXTERNAL_VULKAN_HEADERS=OFF | |
-DYUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES=OFF | |
-DYUZU_USE_FASTER_LD=OFF | |
-DYUZU_USE_PRECOMPILED_HEADERS=OFF | |
-DYUZU_USE_QT_MULTIMEDIA=ON | |
-DYUZU_DOWNLOAD_TIME_ZONE_DATA=ON | |
-DYUZU_TESTS=OFF | |
-DYUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS=OFF | |
-DYUZU_USE_CPM=OFF | |
-DENABLE_QT6=ON | |
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 | |
) | |
install -d build | |
cmake -S torzu -B build "${cmake_args[@]}" | |
ninja -C build | |
} | |
package() { | |
install -Dm644 $srcdir/${_pkgname}/dist/72-yuzu-input.rules -t ${pkgdir}/usr/lib/udev/rules.d/ | |
DESTDIR="$pkgdir/" ninja -C $srcdir/build install | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: This package crashes sometimes.