blob: 723bd5ea424b9e9d8b0455e009ddeace99dc42d2 (
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
# Maintainer: taotieren <admin@taotieren.com>
# Maintainer: Ataraxy
# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com
# 0 for PKGBUILD commands which may go out of date
# 1 for build.py which should stay current
_opt_BUILD_PY=0
# 0 for download vcpkg, set _opt_VCPKG_COMMIT_ID
# 1 for system vcpkg, ignore _opt_VCPKG_COMMIT_ID
_opt_SYS_VCPKG=1
_opt_VCPKG_COMMIT_ID='#commit=14e7bb4ae24616ec54ff6b2f6ef4e8659434ea44'
#_opt_VCPKG_COMMIT_ID=''
# 0 for Sciter
# 1 for Flutter
# Flutter has more advanced UI
_opt_FLUTTER=1
set -u
_pkgname='rustdesk'
pkgname="${_pkgname}-git"
pkgver=1.2.0.r3233.g8e587352
pkgrel=1
pkgdesc='Yet another remote desktop software, written in Rust. Works out of the box, no configuration required. Great alternative to TeamViewer and AnyDesk!'
arch=('x86_64')
url='https://github.com/rustdesk/rustdesk'
license=('GPL3')
_dpr=('gtk3' 'xdotool' 'libxcb' 'libxfixes' 'alsa-lib' 'libva' 'libvdpau' 'libappindicator-gtk3' 'pam' 'gst-plugins-base' 'gst-plugin-pipewire') # from res/PKGBUILD/depends
depends=("${_dpr[@]}" 'pulseaudio' 'gst-plugins-base-libs')
depends+=('hicolor-icon-theme' 'xdg-utils')
depends+=('xdg-user-dirs')
_mdp=('unzip' 'git' 'cmake' 'gcc' 'curl' 'wget' 'yasm' 'nasm' 'zip' 'make' 'pkg-config' 'clang') # from Readme.MD
makedepends=("${_mdp[@]}" 'rust' 'python')
makedepends+=('ninja') # vcpkg build can use the latest ninja
provides=("${_pkgname}=${pkgver%.r*}")
conflicts=("${_pkgname}")
options=('!strip' '!makeflags')
install="${pkgname}.install"
source=("git+${url}.git")
_vcs=(
'https://cmake.org/files/v3.18/cmake-3.18.4-Linux-x86_64.tar.gz'
'ninja-linux-1.10.1.zip::https://github.com/ninja-build/ninja/releases/download/v1.10.1/ninja-linux.zip'
'webmproject-libvpx-v1.11.0.tar.gz::https://github.com/webmproject/libvpx/archive/v1.11.0.tar.gz'
)
if [ "${_opt_SYS_VCPKG}" -ne 0 ]; then
makedepends+=('vcpkg')
_vcs+=(
'libjpeg-turbo-libjpeg-turbo-2.1.4.tar.gz::https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.4.tar.gz'
'webmproject-libvpx-v1.12.0.tar.gz::https://github.com/webmproject/libvpx/archive/v1.12.0.tar.gz'
)
else
source+=("git+https://github.com/microsoft/vcpkg${_opt_VCPKG_COMMIT_ID}")
fi
source+=("${_vcs[@]}")
if [ "${_opt_FLUTTER}" -eq 0 ]; then
source+=("https://raw.github.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so")
else
_FLUVER='3.7.0'
_FRBVER='1.75.0'
source+=(
"https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.7.0-stable.tar.xz"
"flutter_rust_bridge-${_FRBVER}.tar.gz::https://github.com/fzyzcjy/flutter_rust_bridge/archive/refs/tags/v${_FRBVER}.tar.gz"
#"flutter_rust_bridge-${_FRBVER}.tar.gz::https://pub.dev/packages/flutter_rust_bridge/versions/${_FRBVER}.tar.gz" # bad packaging
#"git+https://github.com/SoLongAndThanksForAllThePizza/flutter_rust_bridge.git"
)
fi
md5sums=('SKIP'
'f03d67965c0b747d230df09695447c14'
'93117b3d99986e97628df58f2471c208'
'82e5e527336b41281a582204db1f3457'
'357dc26a802c34387512a42697846d16'
'10cf85debdd07be719a35ca3bfb8ea64'
'9a844a9d6ec89c7da1e3027a5529411c'
'9cb4a6717db959e082db75200e75d3e1')
sha256sums=('SKIP'
'149e0cee002e59e0bb84543cf3cb099f108c08390392605e944daeb6594cbc29'
'7ee7f467a1a747c5b5e02342904af9c24e84df4ca993541f1c4d0f113cab27aa'
'965e51c91ad9851e2337aebcc0f517440c637c506f3a03948062e3d5ea129a83'
'a78b05c0d8427a90eb5b4eb08af25309770c8379592bb0b8a863373128e6143f'
'f1acc15d0fd0cb431f4bf6eac32d5e932e40ea1186fe78e074254d6d003957bb'
'51160abac1d0d82b45647be6b2a6ed2d3827d51c3920f2c8ebf3ea8cebe6f484'
'6efb71ac8086699da74dad6736c32ddb20db5dcabe167c49a8c3a650675eb84b')
_vcs=("${_vcs[@]%%::*}")
_vcs=("${_vcs[@]##*/}")
noextract=("${_vcs[@]}")
pkgver() {
set -u
cd "${srcdir}/${_pkgname}"
local _ver
_ver="$(sed -E -n -e 's/^version = "([^"]+)"$/\1/p' 'Cargo.toml')" # '
#_ver="$(sed -E -n -e 's/^ VERSION: "([^"]+)"$/\1/p' '.github/workflows/flutter-nightly.yml')" # '
local _ver2
_ver2="$(git describe --long --tags | sed -e 's/\([^-]*-g\)/r\1/' -e 's/-/./g')"
_ver2="${_ver2#nightly.}"
printf '%s.%s\n' "${_ver}" "${_ver2}"
set +u
}
_prepare_vc() {
set -u
# rm -rf '/home/chris/.cache/vcpkg/archives'
if [ "${_opt_SYS_VCPKG}" -ne 0 ] && [ ! -d 'vcpkg' ]; then
set +u; msg2 'Copy /opt/vcpkg'; set -u
cp -pr '/opt/vcpkg' .
fi
mkdir -p 'vcpkg/downloads'
cp -p "${_vcs[@]}" 'vcpkg/downloads'
# Check commit ID
if [ "${_opt_SYS_VCPKG}" -eq 0 ] && [ ! -z "${_opt_VCPKG_COMMIT_ID}" ]; then
local _vcc
_vcc="$(sed -E -n -e 's/^.*VCPKG_COMMIT_ID: "([a-z0-9]+)"$/\1/p' 'rustdesk/.github/workflows/flutter-nightly.yml')" # '
if [ "${_vcc}" != "${_opt_VCPKG_COMMIT_ID#*=}" ]; then
echo "Flag package out of date: _opt_VCPKG_COMMIT_ID must be changed to ${_vcc}"
set +u
false
fi
fi
set +u
}
# Same elements in same order
_dpr_check() {
set -u
pushd "${_pkgname}" > /dev/null
(
source 'res/PKGBUILD'
if [ "${#_dpr[@]}" -ne "${#depends[@]}" ]; then
echo 'Flag package out of date: Update _dpr from res/PKGBUILD/depends=()'
false
fi
for((f=0; f<"${#_dpr[@]}"; f++)); do
if [ "${_dpr[f]}" != "${depends[f]}" ]; then
echo 'Flag package out of date: Update _dpr from res/PKGBUILD/depends=()'
fi
done
)
popd > /dev/null
set +u
}
prepare() {
_dpr_check
_prepare_vc
set -u
if [ "${_opt_FLUTTER}" -ne 0 ]; then
if [ ! -d 'flutter_rust_bridge' ]; then
shopt -s failglob
ln -s "flutter_rust_bridge-${_FRBVER}" 'flutter_rust_bridge'
test -d 'flutter_rust_bridge'
shopt -u failglob
fi
fi
cd "${_pkgname}"
if [ "${_opt_FLUTTER}" -ne 0 ]; then
local _FLUTTER_VERSION
_FLUTTER_VERSION="$(source <(grep -e 'FLUTTER_VERSION: ' '.github/workflows/flutter-build.yml' | sed -e 's/: /=/g'); printf '%s' "${FLUTTER_VERSION}")"
if [ "${_FLUTTER_VERSION}" != "${_FLUVER}" ]; then
printf 'Flutter version has changed to %s\n' "${_FLUTTER_VERSION}"
set +u
false
fi
local _flutter_rust_bridge
_flutter_rust_bridge="$(source <(grep -e 'flutter_rust_bridge = "' 'Cargo.toml' | sed -e 's: = :=:g'); printf '%s' "${flutter_rust_bridge}")"
if [ "$(vercmp "${_flutter_rust_bridge}" "${_FRBVER}")" -gt 0 ]; then
printf 'flutter_rust_bridge version has changed to %s\n' "${_flutter_rust_bridge}"
set +u
false
fi
fi
if [ "$(grep -c -F -e 'os.system' 'build.py')" -gt 1 ]; then
local _lf=$'\n'
local _nc='
def systemecho(cmd):
print(cmd)
os.system(cmd)
'
_nc="${_nc//${_lf}/\\n}"
sed -e '# echo all system commands' \
-e 's:os.system:systemecho:g' \
-e "s/^def get_version/${_nc}&/g" \
-e '# Disable makepkg' \
-e '/makepkg/ s:^:#:g' \
-i 'build.py'
fi
set +u
}
build() {
msg2 'Build vcpkg'
set -u
if [ ! -x vcpkg/vcpkg ]; then
vcpkg/bootstrap-vcpkg.sh
fi
nice vcpkg/vcpkg install libvpx libyuv opus
export VCPKG_ROOT="${PWD}/vcpkg"
cd "${_pkgname}"
if [ "${_opt_FLUTTER}" -eq 0 ]; then
set +u; msg2 'Build rustdesk Sciter'; set -u
if [ "${_opt_BUILD_PY}" -ne 0 ]; then
nice ./build.py --hwcodec
else
set -x
git checkout src/ui/common.tis
python3 res/inline-sciter.py
# RUSTUP_TOOLCHAIN=stable cargo build --release --locked --all-features --target-dir=target
nice cargo build --release --features 'inline,hwcodec'
set +x
fi
else
set +u; msg2 'Build rustdesk Flutter'; set -u
set -x
export CPATH="$(clang -v 2>&1 | grep "Selected GCC installation: " | cut -d' ' -f4-)/include"
export PATH="${srcdir}/flutter/bin:$PATH"
dart pub global activate ffigen --version 5.0.1
pushd "${srcdir}/flutter_rust_bridge/frb_codegen"; nice cargo install --path . ; popd
pushd flutter ; flutter pub get ; popd
~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart
if [ "${_opt_BUILD_PY}" -ne 0 ]; then
nice ./build.py --hwcodec --flutter
else
git checkout src/ui/common.tis
nice cargo build --features hwcodec,flutter --lib --release
#ain't there no more
#sed -i "s/ffi.NativeFunction<ffi.Bool Function(DartPort/ffi.NativeFunction<ffi.Uint8 Function(DartPort/g" flutter/lib/generated_bridge.dart
pushd flutter
nice flutter build linux --release # || :
popd
fi
#pushd flutter && flutter build linux --release && popd
set +x
fi
set +u
}
# This rebuilds the entire package
check_disabled() {
cd "${_pkgname}"
nice cargo test --release
}
package() {
set -u
cd "${_pkgname}"
if [ "${_opt_FLUTTER}" -eq 0 ]; then
# install rustdesk
install -Dpm0755 -t "${pkgdir}/usr/bin" "target/release/${_pkgname}"
install -Dm755 -t "${pkgdir}/usr/lib/${_pkgname}" '../libsciter-gtk.so'
else
install -d "${pkgdir}/usr/lib/"
cp -pr 'flutter/build/linux/x64/release/bundle' "${pkgdir}/usr/lib/"
mv "${pkgdir}/usr/lib/"{bundle,${_pkgname}}
# False alarm from ldd
if ! :; then
install -Dm0755 /dev/stdin "${pkgdir}/usr/bin/${_pkgname}" << EOF
#!/usr/bin/bash
LD_LIBRARY_PATH=/usr/lib/${_pkgname}/lib/
exec "/usr/lib/${_pkgname}/${_pkgname}" "\$@"
EOF
else
install -d "${pkgdir}/usr/bin/"
ln -s -t "${pkgdir}/usr/bin/" "/usr/lib/${_pkgname}/${_pkgname}"
fi
fi
install -Dm0644 'res/32x32.png' "${pkgdir}/usr/share/icons/hicolor/32x32/apps/${_pkgname}.png"
install -Dm0644 'res/128x128.png' "${pkgdir}/usr/share/icons/hicolor/128x128/apps/${_pkgname}.png"
install -Dm0644 'res/128x128@2x.png' "${pkgdir}/usr/share/icons/hicolor/256x256/apps/${_pkgname}.png"
install -Dm0644 /dev/stdin "${pkgdir}/usr/lib/systemd/system/${_pkgname}.service" << EOF
[Unit]
Description=RustDesk
Requires=network.target
After=systemd-user-sessions.service
[Service]
Type=simple
ExecStart=/usr/bin/${_pkgname} --service
PIDFile=/var/run/${_pkgname}.pid
KillMode=mixed
TimeoutStopSec=30
User=root
LimitNOFILE=100000
[Install]
WantedBy=multi-user.target
EOF
install -Dm0644 /dev/stdin "${pkgdir}/usr/share/applications/${_pkgname}.desktop" << EOF
[Desktop Entry]
Version=${pkgver%.r*}
Name=RustDesk
GenericName=Remote Desktop
GenericName[zh_CN]=远程桌面
Comment=Remote Desktop
Comment[zh_CN]=远程桌面
Exec=${_pkgname} %u
Icon=${_pkgname}.svg
Terminal=false
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
Categories=Network;RemoteAccess;GTK;
Keywords=internet;
Actions=new-window;
X-Desktop-File-Install-Version=0.23
[Desktop Action new-window]
Name=Open a New Window
EOF
set +u
}
set +u
|