blob: f12c884f828062c9d018398200ca2ab58d7ea937 (
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
# Maintainer: Jesus Alvarez <jesus@ironandcode.com>
# Modified to include CUDA for nvenc from apollo-git
## options
: ${_use_sodeps:=false}
: ${_use_cuda:=true} # nvenc
: ${_cuda_gcc_version:=$(LC_ALL=C pacman -Si cuda | grep -Pom1 '^Depends On\s*:.*\bgcc\K[0-9]+\b')}
: ${_commit=}
_pkgname="apollo"
pkgname="$_pkgname-cuda-git"
pkgver=0.4.8.r20.gdd99a82
pkgrel=1
pkgdesc="A self-hosted game stream server with CUDA support (nvenc) for best performance"
url="https://github.com/ClassicOldSong/Apollo"
license=('GPL-3.0-only')
arch=('x86_64')
depends=(
'boost-libs'
'cuda'
'gtk3'
'icu'
'libayatana-appindicator'
'libcap'
'libdrm'
'libevdev'
'libnotify'
'libpulse'
'libva'
'miniupnpc'
'numactl'
'openssl'
'opus'
'wayland'
)
makedepends=(
'cuda'
"gcc${_cuda_gcc_version:-}"
'boost'
'cmake'
'git'
'ninja'
'npm'
)
optdepends=(
'intel-media-driver: Intel GPU encoding support'
'libva-mesa-driver: AMD GPU encoding support'
)
if pacman -Qi cuda &> /dev/null; then
_use_cuda=true
fi
if [[ "${_use_cuda::1}" == "t" ]]; then
makedepends+=('cuda')
checkdepends+=('nvidia-utils')
optdepends+=(
'cuda: Nvidia GPU encoding support'
'nvidia-utils: Nvidia GPU encoding support'
)
fi
provides=("$_pkgname" "$_pkgname-git")
conflicts=("$_pkgname" "$_pkgname-git")
install="$_pkgname.install"
_pkgsrc="$_pkgname"
source=(
"$_pkgsrc"::"git+$url.git${_commit:+#commit=$_commit}"
"boost-1.90.patch"
)
sha256sums=('SKIP' 'SKIP')
prepare() {
cd "$_pkgsrc"
local i _unwanted=(
packaging/linux/flatpak/deps/flatpak-builder-tools
packaging/linux/flatpak/deps/shared-modules
third-party/doxyconfig
third-party/nv-codec-headers
)
for i in "${_unwanted[@]}"; do
if [ -e "$i" ]; then
git rm -r "$i"
fi
done
git submodule update --init --depth 1
git -C third-party/moonlight-common-c submodule update --init --depth 1
## fix some names
sed -E -e 's&\bsunshine\b&"'${_pkgname}'"&g' -i cmake/prep/init.cmake cmake/packaging/unix.cmake
sed -E -e '/set\(PROJECT_FQDN/s&^.*$&set(PROJECT_FQDN "'${_pkgname}'")&' -i cmake/compile_definitions/linux.cmake
sed -E -e 's&\bsunshine\b&'${_pkgname}'&g' -i cmake/targets/common.cmake
## fix for Boost 1.90
patch -Np1 -i "$srcdir/boost-1.90.patch"
}
pkgver() {
cd "$_pkgsrc"
git describe --long --tags --abbrev=7 --exclude='*[a-zA-Z][a-zA-Z]*' \
| sed -E 's/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g'
}
build() (
export BRANCH="master"
export BUILD_VERSION="${pkgver%%.r*}"
export COMMIT="$(git -C "$_pkgsrc" rev-parse HEAD)"
export CC="gcc${_cuda_gcc_version:+-$_cuda_gcc_version}"
export CXX="g++${_cuda_gcc_version:+-$_cuda_gcc_version}"
export CUDA_PATH=/opt/cuda
export NVCC_CCBIN="/usr/bin/g++${_cuda_gcc_version:+-$_cuda_gcc_version}"
local _cmake_options=(
-B build
-S "$_pkgsrc"
-G Ninja
-DCMAKE_BUILD_TYPE=None
-DCMAKE_INSTALL_PREFIX='/usr'
-DBUILD_DOCS=OFF
-DBUILD_TESTS=OFF
-Wno-dev
-DSUNSHINE_ASSETS_DIR="share/$_pkgname"
-DSUNSHINE_EXECUTABLE_PATH="/usr/bin/$_pkgname"
-DSUNSHINE_PUBLISHER_NAME="AUR"
-DSUNSHINE_PUBLISHER_WEBSITE="https://aur.archlinux.org/packages/$pkgname"
-DSUNSHINE_PUBLISHER_ISSUE_URL="https://aur.archlinux.org/packages/$pkgname"
-DSUNSHINE_ENABLE_CUDA=ON
-DSUNSHINE_ENABLE_DRM=ON
-DSUNSHINE_ENABLE_TRAY=ON
-DSUNSHINE_ENABLE_VAAPI=ON
-DSUNSHINE_ENABLE_WAYLAND=ON
-DSUNSHINE_ENABLE_X11=ON
)
if [[ "${_use_cuda::1}" == "t" ]]; then
_cmake_options+=(-DCUDA_FAIL_ON_MISSING=ON)
else
_cmake_options+=(-DCUDA_FAIL_ON_MISSING=OFF)
fi
cmake "${_cmake_options[@]}"
cmake --build build
)
package() {
depends+=(
'avahi'
'libx11'
'libxcb'
'libxfixes'
'libxrandr'
'mesa' # libgbm
)
if [[ "$_use_sodeps::1}" == "t" ]]; then
eval "depends+=(
'libboost_filesystem.so'
'libboost_locale.so'
'libboost_log.so'
'libboost_program_options.so'
'libboost_thread.so'
'libevdev.so'
'libglib-2.0.so'
'libgobject-2.0.so'
'libgtk-3.so'
'libminiupnpc.so'
'libnotify.so'
'libnuma.so'
'libopus.so'
'libpulse-simple.so'
'libpulse.so'
'libssl.so'
'libva-drm.so'
'libva.so'
'libwayland-client.so'
)"
fi
DESTDIR="$pkgdir" cmake --install build
# unwanted
rm -rf "$pkgdir/usr/lib/systemd"
rm -rf "$pkgdir/usr/share/applications"
rm -rf "$pkgdir/usr/share/metainfo"
install -Dm644 /dev/stdin "$pkgdir/usr/lib/systemd/user/$_pkgname.service" << END
[Unit]
Description=$pkgdesc
StartLimitIntervalSec=500
StartLimitBurst=5
[Service]
# Avoid starting ${_pkgname^} before the desktop is fully initialized.
ExecStartPre=/bin/sleep 5
ExecStart=/usr/bin/apollo
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=xdg-desktop-autostart.target
END
install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/$_pkgname.desktop" << END
[Desktop Entry]
Type=Application
Name=${_pkgname^}
Comment=$pkgdesc
Exec=/usr/bin/env systemctl start --user $_pkgname
Icon=$_pkgname
Categories=RemoteAccess;Network;
Keywords=gamestream;stream;moonlight;remote play;
Actions=RunInTerminal;
[Desktop Action RunInTerminal]
Name=Run in Terminal
Exec=$_pkgname
Terminal=true
Icon=application-x-executable
END
}
|