blob: da56db09a3f3157840e08b38f9d15cbefeb2b4ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
# Maintainer:
# Contributor: Tom Bebbington <tophattedcoder@gmail.com>
# options
if [ -n "$_srcinfo" ] || [ -n "$_pkgver" ] ; then
: ${_autoupdate:=false}
else
: ${_autoupdate:=true}
fi
: ${_build_channel:=nightly} # nightly or canary
# basic info
_pkgname="citra-${_build_channel:?}"
pkgname="$_pkgname-bin"
pkgrel=1
pkgver=2093.20240210.de993dc
pkgdesc="Nintendo 3DS emulator"
license=('GPL-2.0-or-later')
arch=('x86_64')
case "$_build_channel" in
canary)
url="https://github.com/citra-emu/citra-canary"
pkgdesc+=" - additional features still under review"
;;
nightly)
url="https://github.com/citra-emu/citra-nightly"
pkgdesc+=" - reviewed and tested features"
;;
*)
echo "Invalid release channel: ${_build_channel}"
return 1
;;
esac
# main package
_main_package() {
_update_version
provides=(
'citra'
'citra-qt'
)
conflicts=(
'citra'
'citra-qt'
'citra-git'
'citra-qt-git'
)
options=(!strip !debug)
local _version=${_pkgver%%.*}
local _date=$(echo "$_pkgver" | cut -d'.' -f2)
local _hash=${_pkgver##*.}
_pkgsrc="citra-linux-appimage-$_date-$_hash"
_pkgext="tar.gz"
source+=("$_pkgname-$_date-$_hash.$_pkgext"::"$url/releases/download/${_build_channel:?}-$_version/$_pkgsrc.$_pkgext")
sha256sums+=('SKIP')
}
# common functions
pkgver() {
printf '%s' "${_pkgver:?}"
}
prepare() {
local _app
for _app in citra-qt citra-room citra ; do
local _appimage="$_pkgsrc/$_app.AppImage"
chmod +x "$_appimage"
"$_appimage" --appimage-extract
done
}
package() {
depends+=(
alsa-lib
e2fsprogs
fontconfig
freetype2
harfbuzz
libdrm
libglvnd
libgpg-error
libice
libsm
libx11
libxcb
mesa
zlib
)
install -dm755 "$pkgdir/opt/citra"
install -dm755 "$pkgdir/usr/bin"
install -dm755 "$pkgdir/usr/share/applications/"
# symlinks
local _app
for _app in citra-qt citra-room citra ; do
ln -sf "/opt/citra/bin/$_app" "$pkgdir/usr/bin/$_app"
done
# desktop file
mv "squashfs-root/usr/share/applications/citra-qt.desktop" "$pkgdir/usr/share/applications/"
# icon
install -Dm644 "squashfs-root/usr/share/icons/hicolor/scalable/apps/citra.svg" -t "$pkgdir/usr/share/pixmaps/"
# move main files
mv "squashfs-root/usr"/{bin,lib,plugins,translations} "$pkgdir/opt/citra/"
# fix permissions
chmod -R u=rwX,go=rX "$pkgdir"
}
# update version
_update_version() {
: ${_pkgver:=${pkgver%%.r*}}
if [[ "${_autoupdate::1}" != "t" ]] ; then
return
fi
local _response=$(curl -Ssf "$url/releases")
local _regex='<a href="(.*/'"${_build_channel:?}"'-([0-9]+)/(citra-linux-appimage-([0-9]+)-(.*)\.tar\.gz))"'
local _dl_path=$(
printf '%s' "$_response" \
| grep -Eio "$_regex" \
| sed -E "s&$_regex&\1&"
)
local _filename=$(
printf '%s' "$_response" \
| grep -Eio "$_regex" \
| sed -E "s&$_regex&\3&"
)
local _version=$(
printf '%s' "$_response" \
| grep -Eio "$_regex" \
| sed -E "s&$_regex&\2&"
)
local _date=$(
printf '%s' "$_response" \
| grep -Eio "$_regex" \
| sed -E "s&$_regex&\4&"
)
local _hash=$(
printf '%s' "$_response" \
| grep -Eio "$_regex" \
| sed -E "s&$_regex&\5&"
)
local _pkgver_new=$(printf '%s.%s.%s' "$_version" "$_date" "$_hash")
# update _pkgver
if [ "$_pkgver" != "${_pkgver_new:?}" ] ; then
_pkgver="${_pkgver_new:?}"
fi
}
# execute
_main_package
|