1
1
# Edit on github: https://github.com/LizardByte/Sunshine/blob/master/packaging/linux/Arch/PKGBUILD
2
2
# Reference: https://wiki.archlinux.org/title/PKGBUILD
3
3
4
+ # # options
5
+ : " ${_run_unit_tests:= false} " # if set to true; unit tests will be executed post build; useful in CI
6
+ : " ${_support_headless_testing:= false} "
7
+ : " ${_use_cuda:= detect} " # nvenc
8
+
9
+ : " ${_commit:= 65f14e1003f831e776c170621bd06d8292f65155} "
10
+
4
11
pkgname=' sunshine'
5
12
pkgver=2025.628.4510
6
- pkgrel=5
13
+ pkgrel=6
7
14
pkgdesc=" Self-hosted game stream host for Moonlight"
8
15
arch=(' x86_64' ' aarch64' )
9
16
url=https://app.lizardbyte.dev/Sunshine
@@ -41,7 +48,6 @@ makedepends=(
41
48
' appstream-glib'
42
49
' cmake'
43
50
' desktop-file-utils'
44
- ' cuda'
45
51
" gcc${_gcc_version} "
46
52
' git'
47
53
' make'
@@ -50,45 +56,87 @@ makedepends=(
50
56
)
51
57
52
58
optdepends=(
53
- ' cuda: Nvidia GPU encoding support'
54
59
' libva-mesa-driver: AMD GPU encoding support'
55
- ' xorg-server-xvfb: Virtual X server for headless testing'
56
60
)
57
61
58
62
provides=()
59
63
conflicts=()
60
64
61
- source=(" $pkgname ::git+https://github.com/LizardByte/Sunshine.git#commit=65f14e1003f831e776c170621bd06d8292f65155 " )
65
+ source=(" $pkgname ::git+https://github.com/LizardByte/Sunshine.git#commit=${_commit} " )
62
66
sha256sums=(' SKIP' )
63
67
68
+ # Options Handling
69
+ if [[ " ${_use_cuda:: 1} " == " d" ]] && pacman -Qi cuda & > /dev/null; then
70
+ _use_cuda=true
71
+ fi
72
+
73
+ if [[ " ${_use_cuda:: 1} " == " t" ]]; then
74
+ makedepends+=(' cuda' )
75
+ optdepends+=(
76
+ ' cuda: Nvidia GPU encoding support'
77
+ )
78
+ fi
79
+
80
+ if [[ " ${_support_headless_testing:: 1} " == " t" ]]; then
81
+ optdepends+=(
82
+ ' xorg-server-xvfb: Virtual X server for headless testing'
83
+ )
84
+ fi
85
+
86
+ # Ensure makedepends, checkdepends, optdepends are sorted
87
+ if [ -n " ${makedepends+x} " ]; then
88
+ mapfile -t tmp_array < <( printf ' %s\n' " ${makedepends[@]} " | sort)
89
+ makedepends=(" ${tmp_array[@]} " )
90
+ unset tmp_array
91
+ fi
92
+
93
+ if [ -n " ${optdepends+x} " ]; then
94
+ mapfile -t tmp_array < <( printf ' %s\n' " ${optdepends[@]} " | sort)
95
+ optdepends=(" ${tmp_array[@]} " )
96
+ unset tmp_array
97
+ fi
98
+
64
99
prepare () {
65
100
cd " $pkgname "
66
101
git submodule update --recursive --init
67
102
}
68
103
69
104
build () {
70
- export BRANCH=" master "
71
- export BUILD_VERSION=" v2025.628.4510 "
72
- export COMMIT=" 65f14e1003f831e776c170621bd06d8292f65155 "
105
+ export BRANCH=" @GITHUB_BRANCH@ "
106
+ export BUILD_VERSION=" @BUILD_VERSION@ "
107
+ export COMMIT=" ${_commit} "
73
108
74
109
export CC=" gcc-${_gcc_version} "
75
110
export CXX=" g++-${_gcc_version} "
76
111
77
112
export CFLAGS=" ${CFLAGS/ -Werror=format-security/ } "
78
113
export CXXFLAGS=" ${CXXFLAGS/ -Werror=format-security/ } "
79
114
80
- cmake \
81
- -S " $pkgname " \
82
- -B build \
83
- -Wno-dev \
84
- -D BUILD_DOCS=OFF \
85
- -D BUILD_WERROR=ON \
86
- -D CMAKE_INSTALL_PREFIX=/usr \
87
- -D SUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
88
- -D SUNSHINE_ASSETS_DIR=" share/sunshine" \
89
- -D SUNSHINE_PUBLISHER_NAME=' LizardByte' \
90
- -D SUNSHINE_PUBLISHER_WEBSITE=' https://app.lizardbyte.dev' \
91
- -D SUNSHINE_PUBLISHER_ISSUE_URL=' https://app.lizardbyte.dev/support'
115
+ export MAKEFLAGS=" ${MAKEFLAGS:- -j$(nproc)} "
116
+
117
+ local _cmake_options=(
118
+ -S " $pkgname "
119
+ -B build
120
+ -Wno-dev
121
+ -D BUILD_DOCS=OFF
122
+ -D BUILD_WERROR=ON
123
+ -D CMAKE_INSTALL_PREFIX=/usr
124
+ -D SUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine
125
+ -D SUNSHINE_ASSETS_DIR=" share/sunshine"
126
+ -D SUNSHINE_PUBLISHER_NAME=' LizardByte'
127
+ -D SUNSHINE_PUBLISHER_WEBSITE=' https://app.lizardbyte.dev'
128
+ -D SUNSHINE_PUBLISHER_ISSUE_URL=' https://app.lizardbyte.dev/support'
129
+ )
130
+
131
+ if [[ " ${_use_cuda:: 1} " != " t" ]]; then
132
+ _cmake_options+=(-DSUNSHINE_ENABLE_CUDA=OFF -DCUDA_FAIL_ON_MISSING=OFF)
133
+ fi
134
+
135
+ if [[ " ${_run_unit_tests:: 1} " != " t" ]]; then
136
+ _cmake_options+=(-DBUILD_TESTS=OFF)
137
+ fi
138
+
139
+ cmake " ${_cmake_options[@]} "
92
140
93
141
appstreamcli validate " build/dev.lizardbyte.app.Sunshine.metainfo.xml"
94
142
appstream-util validate " build/dev.lizardbyte.app.Sunshine.metainfo.xml"
@@ -99,13 +147,19 @@ build() {
99
147
}
100
148
101
149
check () {
102
- export CC=" gcc-${_gcc_version} "
103
- export CXX=" g++-${_gcc_version} "
150
+ cd " ${srcdir} /build"
151
+ ./sunshine --version
152
+
153
+ if [[ " ${_run_unit_tests:: 1} " == " t" ]]; then
154
+ export CC=" gcc-${_gcc_version} "
155
+ export CXX=" g++-${_gcc_version} "
104
156
105
- cd " ${srcdir} /build/tests"
106
- ./test_sunshine --gtest_color=yes
157
+ cd " ${srcdir} /build/tests"
158
+ ./test_sunshine --gtest_color=yes
159
+ fi
107
160
}
108
161
109
162
package () {
163
+ export MAKEFLAGS=" ${MAKEFLAGS:- -j$(nproc)} "
110
164
make -C build install DESTDIR=" $pkgdir "
111
165
}
0 commit comments