blob: 07b728a850396fd2facc6e5c6475fe1032c7d915 (
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
|
# Maintainer:
# Contributor: Tom Bebbington <tophattedcoder@gmail.com>
# options
if [ -n "$_srcinfo" ] || [ -n "$_pkgver" ] ; then
: ${_autoupdate:=false}
else
: ${_autoupdate:=true}
fi
# basic info
_pkgname='citra-nightly'
pkgname="$_pkgname-bin"
pkgrel=1
pkgver=2062.20231226.602f4f6
pkgdesc="Nintendo 3DS emulator"
url="https://github.com/citra-emu/citra-nightly"
license=('GPL-2.0-or-later')
arch=('x86_64')
# main package
_main_package() {
_update_version
makedepends=(
'gendesk'
)
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+=("$_pkgsrc-$_pkgver.$_pkgext"::"$url/releases/download/nightly-$_version/$_pkgsrc.$_pkgext")
sha256sums+=('SKIP')
}
# common functions
pkgver() {
printf '%s' "${_pkgver:?}"
}
build() {
local _app
for _app in citra-qt citra-room citra ; do
local _appimage="$_pkgsrc/$_app.AppImage"
chmod +x "$_appimage"
"$_appimage" --appimage-extract
done
rm -rf "squashfs-root/usr/optional"
}
package() {
install -dm755 "$pkgdir/usr/bin"
install -dm755 "$pkgdir/usr/share/applications/"
local _app
for _app in citra-qt citra-room citra ; do
# symlink
ln -sf "/opt/citra/bin/$_app" "$pkgdir/usr/bin/$_app"
# desktop file
mv "squashfs-root/$_app.desktop" "$pkgdir/usr/share/applications/"
done
# icon
install -Dm644 "$_pkgsrc/dist/citra.png" -t "$pkgdir/usr/share/pixmaps/"
# move main files
install -dm755 "$pkgdir/opt"
mv "$srcdir/squashfs-root/usr" "$pkgdir/opt/citra"
}
# update version
_update_version() {
: ${_pkgver:=${pkgver%%.r*}}
if [[ "${_autoupdate::1}" != "t" ]] ; then
return
fi
local _response=$(curl -Ssf "$url/releases")
local _regex='<a href="(.*/nightly-([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
|