Skip to content

citron-git: Add package #4246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 157 additions & 0 deletions archlinuxcn/citron-git/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Maintainer: username227 <gfrank227 [at] gmail [dot] com>
_pkgname=Citron
_xbyak_tag=7.24.2
pkgname=${_pkgname,,}-git
pkgver=0.6.1.canary.refresh.r53
pkgrel=1
pkgdesc="Nintendo Switch emulator forked from yuzu"
arch=(x86_64)
url=https://git.citron-emu.org/citron/emu
license=(GPL-3.0-or-later)
provides=('citron')
conflicts=('citron')
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'
'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=(
Citron::git+${url}.git
git+https://github.com/yuzu-mirror/sirit.git#commit=ab75463
git+https://github.com/herumi/xbyak.git#tag=v${_xbyak_tag:-7.22}
# citron use xbyak v6.68 by default, but v7.22 is okay
git+https://github.com/brofield/simpleini.git#commit=6048871ea9
"https://github.com/lat9nq/tzdb_to_nx/releases/download/221202/221202.zip"
)
noextract=('221202.zip')
b2sums=('SKIP'
'91e4cd03d67c930b6d751ca19cf6fbaaba86084412bd13b172186387ea27b461457a3e19bc0af315c807839e64f91c865298678af748e2d6e07df2abc85430ed'
'c3cd6fdac08d04ff996a082d51b87c98a46a0c07b17cf1c9e794c4fbb284860e6355c7c4d7b41a66293d8181ec17a18dac772fac384a324b6e7e144540430ac5'
'fae42bb13f180ab991f6bfc8a45ea3df08ced1d77db77f54cf5a222f93ea468bd6fc0d36d65f9f3739e9813d77dbae31931948dc9afa28e884c53b8128c13c94'
'7bd0ff5ca80cf560344ae7edbfeb7c9466c096dc499a7348276cff5d30aa07464f7e2ea391ca9cedac0e21ba6f563169a8b38f2df729a230a0acfb1125ea1b66')
pkgver() {
cd "$srcdir/$_pkgname"
git describe --long --abbrev=7 --tags | sed 's/\([^-]*\)-g.*/r\1/;s/-/./g;s/^v//g'
}

prepare() {
local submods=(
sirit
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

cd $srcdir/$_pkgname
sed -i CMakeLists.txt \
-e '/-DBOOST_ASIO_DISABLE_CONCEPTS/d' \
-e 's/1.4.313/1.4.309/g' \
-e '/target_compile_options/d' \
-e '/add_subdirectory(externals)/d' \
-e 's|^add\_subdirectory(src)|add_subdirectory(externals)\n add_subdirectory(src)#|g'
sed -i src/CMakeLists.txt \
-e 's|-Werror=shadow$|-Wno-error=shadow|g' \
-e 's|-Werror=unused$|-Wno-error=unused|g' \
-e 's|include_directories(.|include_directories(. /usr/include/mbedtls2|g' \
-e '/include_directories/a link_directories(/usr/lib/mbedtls2)'
sed -i src/${_pkgname,,}_cmd/CMakeLists.txt \
-e "/target_include_directories(${_pkgname,,}-cmd/a target_link_libraries(${_pkgname,,}-cmd PRIVATE mbedtls mbedcrypto)"
sed -i src/${_pkgname,,}/CMakeLists.txt \
-e "/target_sources(${_pkgname,,}/i target_link_libraries(${_pkgname,,} PRIVATE mbedtls mbedcrypto)"
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 's| (%2)||' src/${_pkgname,,}/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|u64|std::uint64_t|g' src/${_pkgname,,}/discord_impl.h
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
# see dynarmic 6.7.0 changelog
sed -i src/core/arm/dynarmic/arm_dynarmic_{32,64}.cpp \
-e '/fastmem_pointer/s/nullptr/std::nullopt/g' \
-e 's|page_table->fastmem_arena;|(page_table->fastmem_arena != nullptr) ? std::optional<uintptr_t>{reinterpret_cast<uintptr_t>(page_table->fastmem_arena)} : std::nullopt;|g'

# this line causes crash, introduced in commit 54173384271
sed -i externals/xbyak/xbyak/xbyak.h \
-e '/if (!(type & T_ALLOW_DIFF_SIZE) && r1.isREG() && r2.isREG() && r1.getBit() != r2.getBit()) XBYAK_THROW(ERR_BAD_SIZE_OF_REGISTER)/d'
# system mbedtls
sed -i externals/CMakeLists.txt \
-e '/add_subdirectory(mbedtls)/c pkg_check_modules(MbedTLS REQUIRED IMPORTED_TARGET GLOBAL mbedtls mbedcrypto)' \
-e '/target_include_directories(mbedtls/d' \
-e '/^ *target_compile_options(mbedcrypto/,/)/ { s/^/#/ }'
# boost 1.88
sed -i src/core/debugger/debugger.cpp \
-e 's|#include *<boost/process/async_pipe.hpp>|#include <boost/process/v1/async_pipe.hpp>|g' \
-e 's/\bboost::process::async_pipe\b/boost::process::v1::async_pipe/g'
# no member named 'use_nce' in 'Settings::Values', so we just use false to replace this in a || expression
sed -i src/citron/configuration/configure_system.cpp \
-e 's|setting->Id() == Settings::values.use_nce.Id()|false|g'

}

build() {
export CC=clang
export CXX=clang++
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/usr/lib/mbedtls2/pkgconfig

local cmake_args=(
-GNinja
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
-DTITLE_BAR_FORMAT_IDLE="$_pkgname $pkgver"
-DTITLE_BAR_FORMAT_RUNNING="$_pkgname $pkgver | {3}"
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_BUILD_TYPE=Release
-DCITRON_ENABLE_COMPATIBILITY_REPORTING=OFF
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF
-DCITRON_USE_QT_WEB_ENGINE=ON
-DUSE_DISCORD_PRESENCE=ON
-DENABLE_QT_TRANSLATION=ON
-DCITRON_USE_BUNDLED_FFMPEG=OFF
-DCITRON_USE_BUNDLED_QT=OFF
-DCITRON_USE_EXTERNAL_SDL2=OFF
-DCITRON_CHECK_SUBMODULES=OFF
-DCITRON_USE_EXTERNAL_VULKAN_HEADERS=OFF
-DCITRON_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES=OFF
-DCITRON_USE_FASTER_LD=OFF
-DCITRON_USE_PRECOMPILED_HEADERS=OFF
-DCITRON_USE_QT_MULTIMEDIA=ON
# download timezone data from our zip file.
-DCITRON_DOWNLOAD_TIME_ZONE_DATA=ON
-DCITRON_TESTS=OFF
-DSIRIT_USE_SYSTEM_SPIRV_HEADERS=ON
-DUSE_SYSTEM_QT=ON
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
)
install -d build
cmake -S ${_pkgname} -B build "${cmake_args[@]}"
ninja -C build

}

package() {
install -Dm644 $srcdir/${_pkgname}/dist/72-${_pkgname,,}-input.rules -t ${pkgdir}/usr/lib/udev/rules.d/
DESTDIR="$pkgdir/" ninja -C $srcdir/build install

}
30 changes: 30 additions & 0 deletions archlinuxcn/citron-git/lilac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file is auto-generated by n2y

maintainers:
- github: sukanka
email: [email protected]

build_prefix: extra-x86_64

pre_build: vcs_update

post_build: git_pkgbuild_commit

repo_depends:
- discord-rpc-git
- cubeb-git
- cpp-httplib
- cpp-jwt
- vulkan-memory-allocator-git
- xbyak
- dynarmic

update_on:
- source: alpm
alpm: fmt
repo: extra
- source: alpm
alpm: openssl
- alias: boost
- source: vcs
vcs: git+https://git.citron-emu.org/Citron/Citron.git