aur-ryujinx/PKGBUILD

132 lines
3.3 KiB
Bash
Raw Normal View History

2024-02-18 23:33:29 +00:00
# Maintainer:
# Contributor: Marco Rubin <marco.rubin@protonmail.com>
2022-12-10 16:56:29 +00:00
2024-02-18 23:33:29 +00:00
## options
2024-07-28 03:16:38 +00:00
if [ -z "$_srcinfo" ] && [ -z "$_pkgver" ]; then
2024-02-18 23:33:29 +00:00
: ${_autoupdate:=true}
fi
## basic info
_pkgname="ryujinx"
2024-07-28 03:16:38 +00:00
pkgname="$_pkgname"
2024-09-02 04:49:55 +00:00
pkgver=1.1.1385
2023-02-18 14:08:47 +00:00
pkgrel=1
2022-12-10 14:42:18 +00:00
pkgdesc="Experimental Nintendo Switch Emulator written in C#"
url="https://github.com/Ryujinx/Ryujinx"
license=('MIT')
2024-07-28 03:16:38 +00:00
arch=('x86_64')
2024-02-18 23:33:29 +00:00
2024-07-28 03:16:38 +00:00
depends=(
'gcc-libs'
'zlib'
)
makedepends=(
'desktop-file-utils'
'dotnet-sdk>=8.0.7.sdk303' # aur/dotnet-core-bin
)
2024-02-18 23:33:29 +00:00
2024-07-28 03:16:38 +00:00
options=('!strip' '!debug' 'emptydirs')
install="$_pkgname.install"
2024-02-18 23:33:29 +00:00
2024-07-28 03:16:38 +00:00
_source_ryujinx() {
2024-02-18 23:33:29 +00:00
_pkgsrc="Ryujinx-$_pkgver"
_pkgext="tar.gz"
source=("$_pkgname-$_pkgver.$_pkgext"::"$url/archive/$_pkgver.$_pkgext")
sha256sums=('SKIP')
}
2024-07-28 03:16:38 +00:00
pkgver() {
echo "${_pkgver:?}"
2024-02-18 23:33:29 +00:00
}
2022-12-10 14:42:18 +00:00
build() {
2024-02-18 23:33:29 +00:00
cd "$_pkgsrc"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
dotnet clean
dotnet nuget locals all -c
local _args=(
-c Release
-r linux-x64
--nologo
--self-contained true
2024-03-03 03:28:40 +00:00
-p:DebugType=none
-p:ExtraDefineConstants=DISABLE_UPDATER
2024-02-18 23:33:29 +00:00
-p:Version=${pkgver%%.r*}
)
2024-03-03 03:28:40 +00:00
dotnet publish "${_args[@]}" -o publish_ava src/Ryujinx
dotnet publish "${_args[@]}" -o publish_gtk src/Ryujinx.Gtk3
2024-07-28 03:16:38 +00:00
dotnet publish "${_args[@]}" -o publish_sdl src/Ryujinx.Headless.SDL2
2022-12-10 14:42:18 +00:00
}
package() {
2024-02-18 23:33:29 +00:00
cd "$_pkgsrc"
# program
install -dm755 "$pkgdir/opt/ryujinx"
2024-07-28 03:16:38 +00:00
cp -a --update=none --reflink=auto publish_ava/* "$pkgdir/opt/ryujinx/"
cp -a --update=none --reflink=auto publish_gtk/* "$pkgdir/opt/ryujinx/"
cp -a --update=none --reflink=auto publish_sdl/* "$pkgdir/opt/ryujinx/"
2024-02-18 23:33:29 +00:00
# symlinks
install -dm755 "$pkgdir/usr/bin"
2024-03-03 03:28:40 +00:00
ln -s "/opt/ryujinx/Ryujinx" "$pkgdir/usr/bin/ryujinx"
ln -s "/opt/ryujinx/Ryujinx.Gtk3" "$pkgdir/usr/bin/ryujinx.gtk"
2024-07-28 03:16:38 +00:00
ln -s "/opt/ryujinx/Ryujinx.Headless.SDL2" "$pkgdir/usr/bin/ryujinx.sdl"
2024-02-18 23:33:29 +00:00
# .desktop
2024-04-19 06:45:43 +00:00
install -Dm644 distribution/linux/Ryujinx.desktop "$pkgdir/usr/share/applications/ryujinx.desktop"
2022-12-10 14:42:18 +00:00
2024-02-18 23:33:29 +00:00
# icon
2024-04-19 06:45:43 +00:00
install -Dm644 distribution/misc/Logo.svg "$pkgdir/usr/share/pixmaps/ryujinx.svg"
2022-12-10 16:56:29 +00:00
2024-02-18 23:33:29 +00:00
# mimetype
install -Dm644 distribution/linux/mime/Ryujinx.xml "$pkgdir/usr/share/mime/packages/ryujinx.xml"
2022-12-10 14:42:18 +00:00
2024-02-18 23:33:29 +00:00
# license
2024-07-28 03:16:38 +00:00
install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
2023-06-22 08:01:12 +00:00
2024-02-18 23:33:29 +00:00
# fix permissions
find "$pkgdir" -type d -exec chmod 755 {} \;
find "$pkgdir" -type f -exec chmod 644 {} \;
chmod 755 "$pkgdir/opt/ryujinx/Ryujinx"
2024-03-03 03:28:40 +00:00
chmod 755 "$pkgdir/opt/ryujinx/Ryujinx.Gtk3"
2024-07-28 03:16:38 +00:00
chmod 755 "$pkgdir/opt/ryujinx/Ryujinx.Headless.SDL2"
2024-02-18 23:33:29 +00:00
chmod 755 "$pkgdir/opt/ryujinx/Ryujinx.sh"
# writable log directory
install -dm777 "$pkgdir/opt/ryujinx/Logs"
# fix desktop file
desktop-file-edit --set-key="Exec" --set-value="ryujinx %f" "$pkgdir/usr/share/applications/ryujinx.desktop"
desktop-file-edit --set-icon="ryujinx" "$pkgdir/usr/share/applications/ryujinx.desktop"
}
_update_version() {
: ${_pkgver:=${pkgver%%.r*}}
2024-04-19 06:45:43 +00:00
if [[ "${_autoupdate::1}" != "t" ]]; then
2024-02-18 23:33:29 +00:00
return
fi
local _response=$(curl -Ssf "$url/releases.atom")
local _tag=$(
printf '%s' "$_response" \
| grep '"https://.*/releases/tag/.*"' \
| sed -E 's@^.*/releases/tag/(.*)".*$@\1@' \
| grep -Ev '[a-z]{2}' | sort -rV | head -1
)
local _pkgver_new="${_tag#v}"
# update _pkgver
2024-04-19 06:45:43 +00:00
if [ "$_pkgver" != "${_pkgver_new:?}" ]; then
2024-02-18 23:33:29 +00:00
_pkgver="${_pkgver_new:?}"
fi
2022-12-10 14:42:18 +00:00
}
2024-02-18 23:33:29 +00:00
2024-07-28 03:16:38 +00:00
_update_version
_source_ryujinx