gnu: emacs-scratch-el: Update source and homepage.
[jackhill/guix/guix.git] / gnu / packages / vnc.scm
1 ;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Todor Kondić <tk.code@protonmail.com>
3 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
4 ;;; Copyright © 2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
5 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
6 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
7 ;;; Copyright © 2021, 2022 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
9 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
16 ;;;
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25 (define-module (gnu packages vnc)
26 #:use-module (guix build-system cmake)
27 #:use-module (guix download)
28 #:use-module (guix git-download)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix gexp)
31 #:use-module (guix packages)
32 #:use-module (guix utils)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages avahi)
36 #:use-module (gnu packages base)
37 #:use-module (gnu packages cmake)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages crypto)
40 #:use-module (gnu packages cups)
41 #:use-module (gnu packages fltk)
42 #:use-module (gnu packages fontutils)
43 #:use-module (gnu packages freedesktop)
44 #:use-module (gnu packages gettext)
45 #:use-module (gnu packages gl)
46 #:use-module (gnu packages glib)
47 #:use-module (gnu packages gnome)
48 #:use-module (gnu packages gnupg)
49 #:use-module (gnu packages gtk)
50 #:use-module (gnu packages guile)
51 #:use-module (gnu packages image)
52 #:use-module (gnu packages java)
53 #:use-module (gnu packages linux)
54 #:use-module (gnu packages pcre)
55 #:use-module (gnu packages perl)
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages python)
58 #:use-module (gnu packages rdesktop)
59 #:use-module (gnu packages sdl)
60 #:use-module (gnu packages spice)
61 #:use-module (gnu packages ssh)
62 #:use-module (gnu packages tls)
63 #:use-module (gnu packages video)
64 #:use-module (gnu packages webkit)
65 #:use-module (gnu packages xdisorg)
66 #:use-module (gnu packages xorg))
67
68 (define-public remmina
69 (package
70 (name "remmina")
71 (version "1.4.23")
72 (source
73 (origin
74 (method git-fetch)
75 (uri
76 (git-reference
77 (url "https://gitlab.com/Remmina/Remmina")
78 (commit (string-append "v" version))))
79 (file-name (git-file-name name version))
80 (sha256
81 (base32 "1j0fiz76z4y08w136vs8igqxxg42hx61r5hf6sylcr0c424sc9rk"))))
82 (build-system cmake-build-system)
83 (arguments
84 `(#:tests? #f ; No target
85 #:configure-flags
86 (list
87 ;; Disable online version checking.
88 "-DWITH_NEWS=OFF")
89 #:imported-modules
90 ((guix build glib-or-gtk-build-system)
91 ,@%cmake-build-system-modules)
92 #:modules
93 (((guix build glib-or-gtk-build-system)
94 #:prefix glib-or-gtk:)
95 (guix build cmake-build-system)
96 (guix build utils))
97 #:phases
98 (modify-phases %standard-phases
99 (add-after 'install 'glib-or-gtk-compile-schemas
100 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
101 (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
102 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
103 (add-after 'glib-or-gtk-wrap 'wrap-typelibs
104 (lambda* (#:key outputs #:allow-other-keys)
105 (let ((out (assoc-ref outputs "out")))
106 (for-each
107 (lambda (name)
108 (let ((file (string-append out "/bin/" name))
109 (gi-typelib-path (getenv "GI_TYPELIB_PATH")))
110 (wrap-program file
111 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path)))))
112 '("remmina" "remmina-file-wrapper"))))))))
113 (native-inputs
114 (list gettext-minimal
115 `(,glib "bin")
116 gobject-introspection
117 `(,gtk+ "bin")
118 intltool
119 pkg-config))
120 (inputs
121 (list libappindicator
122 atk
123 avahi
124 cairo
125 cups
126 ffmpeg
127 freerdp ; for rdp plugin
128 libgcrypt
129 librsvg
130 glib
131 gnome-keyring
132 gsettings-desktop-schemas
133 gtk+
134 harfbuzz
135 json-glib
136 libsecret ; for secret plugin
137 libsoup-minimal-2
138 libssh ; for ssh plugin
139 libvnc ; for vnc plugin
140 openssl
141 pango
142 pcre2 ; for exec plugin
143 shared-mime-info
144 libsodium
145 spice-gtk ; for spice plugin
146 telepathy-glib
147 vte ; for st plugin
148 wayland
149 webkitgtk ; for www plugin
150 libx11
151 libxext ; for xdmcp plugin
152 xdg-utils
153 libxkbfile)) ; for nx plugin
154 (propagated-inputs
155 (list dconf))
156 (home-page "https://remmina.org/")
157 (synopsis "Remote Desktop Client")
158 (description "Remmina is a client to use other desktops remotely.
159 RDP, VNC, SPICE, NX, XDMCP, SSH and EXEC network protocols are supported.")
160 (license license:gpl2+)))
161
162 (define-public tigervnc-client
163 ;; xorg-server 21 support was merged 2 weeks after the last (1.12.0) release.
164 (let ((revision "0")
165 (commit "b484c229853a08c7f254a4c6efbaf3c9e85b5074"))
166 (package
167 (name "tigervnc-client")
168 (version (git-version "1.12.0" revision commit))
169 (source
170 (origin
171 (method git-fetch)
172 (uri (git-reference
173 (url "https://github.com/TigerVNC/tigervnc")
174 (commit commit)))
175 (sha256
176 (base32 "125dnn05ps7vfsxlxmzm05w99lhm8hk8j4hpxl1mlzb5j0hp1061"))
177 (file-name (git-file-name name version))))
178 (build-system cmake-build-system)
179 (arguments
180 '(#:tests? #f ; Tests that do exists are not automated.
181 #:phases (modify-phases %standard-phases
182 (replace 'install
183 (lambda* (#:key outputs #:allow-other-keys)
184 (with-directory-excursion "vncviewer"
185 (invoke "make" "install")))))))
186 (native-inputs
187 (list autoconf gettext-minimal automake))
188 (inputs
189 (list zlib
190 gnutls
191 libjpeg-turbo
192 fltk
193 linux-pam
194 libx11
195 libxext
196 libxtst
197 libxrandr
198 libxdamage
199 pixman))
200 (home-page "https://tigervnc.org/")
201 (synopsis "High-performance, platform-neutral
202 implementation of VNC (client)")
203 (description "TigerVNC is a client/server implementation of VNC (Virtual
204 Network Computing). It provides enough performance to run even 3D and video
205 applications. It also provides extensions for advanced authentication methods
206 and TLS encryption. This package installs only the VNC client, the
207 application which is needed to connect to VNC servers.")
208 (license license:gpl2))))
209
210 ;; A VNC server is, in fact, an X server so it seems like a good idea
211 ;; to build on the work already done for xorg-server package. This is
212 ;; not entirely compatible with the recommendation in BUILDING.txt
213 ;; where the client is built first, then the source code of the X
214 ;; server is copied into a subdir of the build directory, patched with
215 ;; VNC additions and then build and installed as Xvnc. The procedure
216 ;; was turned around, where TigerVNC code is downloaded and built
217 ;; inside the Guix X server build dir. Also, the VNC patching process
218 ;; for the X server is automated in a straightforward manner.
219 (define-public tigervnc-server
220 (package
221 (inherit xorg-server)
222 (name "tigervnc-server")
223 (version (package-version tigervnc-client))
224 (native-inputs
225 `(("tigervnc-src" ,(package-source tigervnc-client))
226 ("autoconf" ,autoconf)
227 ("automake" ,automake)
228 ("libtool" ,libtool)
229 ("gettext-minimal" ,gettext-minimal)
230 ("font-util" ,font-util)
231 ("cmake" ,cmake)
232 ("perl" ,perl)
233 ,@(package-native-inputs tigervnc-client)
234 ,@(package-inputs tigervnc-client)
235 ,@(package-native-inputs xorg-server)))
236 (inputs
237 (modify-inputs (package-inputs xorg-server)
238 (prepend perl coreutils xauth)))
239 (propagated-inputs
240 (modify-inputs (package-propagated-inputs xorg-server)
241 (prepend xauth)))
242 (arguments
243 (substitute-keyword-arguments
244 (package-arguments xorg-server)
245 ((#:configure-flags flags)
246 `(append '("--with-pic" ; Taken from BUILDING.txt
247 "--without-dtrace"
248 "--disable-static"
249 "--disable-dri2"
250 "--disable-xinerama"
251 "--disable-xvfb"
252 "--disable-xnest"
253 "--disable-xorg"
254 "--disable-dmx"
255 "--disable-xwin"
256 "--disable-xephyr"
257 "--disable-kdrive"
258 ;; "--disable-config-dbus" ; This was a warning.
259 "--disable-config-hal"
260 "--disable-config-udev"
261 "--disable-dri2"
262 ;; "--enable-install-libxf86config" ; This, too, was a warning.
263 "--enable-glx")
264 (delete "--enable-xephyr" ,flags)))
265 ((#:modules modules)
266 `(append '((ice-9 ftw)
267 (ice-9 match)
268 (guix build utils)
269 (guix build gnu-build-system))
270 modules))
271 ((#:phases phases)
272 `(modify-phases ,phases
273 (delete 'check) ;)
274 (add-after 'unpack 'copy-tvnc-xserver
275 (lambda _
276 (let*
277 ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
278 (tvnc-xserver (string-append tvnc-src "/unix/xserver")))
279 (copy-recursively tvnc-xserver "."))))
280 (add-after 'copy-tvnc-xserver 'patch-xserver
281 (lambda _
282 (invoke "patch" "-p1" "-i"
283 (string-append (assoc-ref %build-inputs "tigervnc-src")
284 "/unix/xserver21.1.1.patch"))
285 (invoke "autoreconf" "-fiv")))
286 (add-before 'build 'build-tigervnc
287 (lambda _
288 (let* ((out (assoc-ref %outputs "out"))
289 (tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
290 (tvnc-build (string-append (getcwd) "/tigervnc-build")))
291 (mkdir-p tvnc-build)
292 (with-directory-excursion tvnc-build
293 (invoke "cmake" "-G" "Unix Makefiles"
294 (string-append "-DCMAKE_INSTALL_PREFIX=" out)
295 tvnc-src)
296 (invoke "make" "-j" (number->string (parallel-job-count)))))))
297 (replace 'build
298 (lambda _
299 (let* ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
300 (tvnc-build (string-append (getcwd) "/tigervnc-build"))
301 (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
302 (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
303 (invoke "make" srcarg buildarg "-j"
304 (number->string (parallel-job-count))))))
305 (add-before 'install 'install-tigervnc-aux
306 (lambda _
307 (let* ((out (assoc-ref %outputs 'out))
308 (tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
309 (tvnc-build (string-append (getcwd) "/tigervnc-build"))
310 (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
311 (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
312 (with-directory-excursion (string-append tvnc-build "/unix")
313 (invoke "make" srcarg buildarg "install")))))
314 (replace 'install
315 (lambda* _
316 (let* ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
317 (tvnc-build (string-append (getcwd) "/tigervnc-build"))
318 (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
319 (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
320 (invoke "make" "install" srcarg buildarg))))))))
321 (description "TigerVNC is a client/server implementation of VNC (Virtual
322 Network Computing). It provides enough performance to run even 3D and video
323 applications. It also provides extensions for advanced authentication methods
324 and TLS encryption. This package installs the VNC server, a program that will
325 enable users with VNC clients to log into a graphical session on the machine
326 where the server is installed.")))
327
328 (define-public turbovnc
329 (package
330 (name "turbovnc")
331 (version "3.0.1")
332 (source
333 (origin
334 (method url-fetch)
335 (uri (string-append "mirror://sourceforge/turbovnc/" version
336 "/turbovnc-" version ".tar.gz"))
337 (modules '((guix build utils)
338 (ice-9 ftw)
339 (srfi srfi-26)))
340 (snippet
341 #~(begin
342 ;; There are a few bundled Java libraries, such as jsch and jzlib,
343 ;; bundled under java/com/jcraft/ as well as mindrot and spf4j,
344 ;; bundled under java/org. These are used by the 'vncviewer'
345 ;; program. The jsch copy is modified and integrates changes from
346 ;; https://github.com/mwiede/jsch, so cannot easily be un-bundled.
347 (define (directory? x)
348 (and=> (stat x #f) (compose (cut eq? 'directory <>) stat:type)))
349
350 (define (delete-all-but directory . preserve)
351 (with-directory-excursion directory
352 (let* ((pred (negate (cut member <> (append '("." "..")
353 preserve))))
354 (items (scandir "." pred)))
355 (for-each (lambda (item)
356 (if (directory? item)
357 (delete-file-recursively item)
358 (delete-file item)))
359 items))))
360
361 ;; d3des, rfb (headers) and turbojpeg-jni are small and not
362 ;; packaged in Guix, so preserve them.
363 (delete-all-but "common" "d3des" "rfb" "turbojpeg-jni")
364 ;; Delete bundled headers which aren't used.
365 (delete-all-but "unix/Xvnc/include" "tvnc_version.h.in")
366 ;; This 243 lines of code C library is used by
367 ;; unix/Xvnc/programs/Xserver/os/xsha1.c.
368 (delete-all-but "unix/Xvnc/lib" "CMakeLists.txt" "libsha1")
369 (delete-file-recursively "unix/Xvnc/extras")))
370 (sha256
371 (base32
372 "182amp471qvr2cn2rbw97zpbkh9q7mf92w1r25cg4apx5k26m7c3"))
373 (patches (search-patches "turbovnc-find-system-packages.patch"
374 "turbovnc-custom-paths.patch"))))
375 (build-system cmake-build-system)
376 (arguments
377 (list
378 #:tests? #f ;no test suite
379 #:configure-flags
380 ;; Use system libraries.
381 #~(list "-DTVNC_SYSTEMLIBS=ON"
382 "-DTVNC_SYSTEMX11=ON"
383 "-DTVNC_DLOPENSSL=OFF"
384 (string-append "-DXORG_DRI_DRIVER_PATH="
385 (search-input-directory %build-inputs "lib/dri"))
386 (string-append "-DXORG_FONT_PATH="
387 "/run/current-system/profile/share/fonts/X11,"
388 (string-append #$(this-package-input "font-alias")
389 "share/fonts/X11"))
390 (string-append "-DXORG_REGISTRY_PATH="
391 (dirname (search-input-file
392 %build-inputs "lib/xorg/protocol.txt")))
393 (string-append "-DXKB_BASE_DIRECTORY="
394 (search-input-directory %build-inputs
395 "share/X11/xkb"))
396 (string-append "-DXKB_BIN_DIRECTORY="
397 (dirname (search-input-file %build-inputs
398 "bin/xkbcomp")))
399 ;; The default rule is 'xorg', which doesn't match the 'base'
400 ;; rule file installed by our version of xkeyboard-config.
401 ;; Without this change, running Xvnc would fail with the error
402 ;; "XKB: Failed to compile keymap"
403 "-DXKB_DFLT_RULES=base"
404 ;; Mimic xorg-server's "--with-xkb-output=/tmp" configuration.
405 "-DCOMPILEDDEFAULTFONTPATH=/tmp"
406 "-DTVNC_STATIC_XORG_PATHS=ON")
407 #:phases
408 #~(modify-phases %standard-phases
409 (add-after 'unpack 'patch-vncviewer
410 (lambda* (#:key inputs #:allow-other-keys)
411 (define openjdk #$(this-package-input "openjdk"))
412 (substitute* "unix/vncviewer/vncviewer.in"
413 (("\\$BINDIR/../java/jre")
414 openjdk)
415 ;; Avoid resorting to grep and sed to locate libjawt.so.
416 (("^_TMP=.*")
417 (string-append "_TMP=" openjdk "/lib\n")))))
418 (add-after 'unpack 'patch-xstartup.turbovnc
419 (lambda* (#:key inputs #:allow-other-keys)
420 (substitute* "unix/xstartup.turbovnc"
421 (("DBUS_LAUNCH=[[:graph:]]+")
422 (format #f "DBUS_LAUNCH=~a"
423 (search-input-file inputs "bin/dbus-launch")))
424 (("XSESSIONSDIR=[[:graph:]]+")
425 (format #f "XSESSIONSDIR=~a"
426 "/run/current-system/profile/share/xsessions"))
427 (("GREP=[[:graph:]]+")
428 (format #f "GREP=~a"
429 (search-input-file inputs "bin/grep")))
430 (("SED=[[:graph:]]+")
431 (format #f "SED=~a"
432 (search-input-file inputs "bin/sed")))
433 (("TVNC_SSHAGENT=[[:graph:]]+")
434 (format #f "TVNC_SSHAGENT=~a"
435 (search-input-file inputs "bin/ssh-agent")))
436 (("TVNC_VGLRUN=\"vglrun" all)
437 (string-append "TVNC_VGLRUN="
438 (search-input-file inputs "bin/vglrun") all)))))
439 (add-after 'install 'wrap-vncserver
440 (lambda* (#:key inputs outputs #:allow-other-keys)
441 (wrap-script (search-input-file outputs "bin/vncserver")
442 (list "PATH" 'prefix
443 (map (lambda (p)
444 (dirname (search-input-file inputs p)))
445 '("bin/uname" ;coreutils
446 "bin/xauth"
447 "bin/xdpyinfo"))))))
448 (add-after 'install 'wrap-xstartup.turbovnc
449 (lambda* (#:key inputs outputs #:allow-other-keys)
450 (wrap-script (search-input-file outputs "bin/xstartup.turbovnc")
451 (list "PATH" 'prefix
452 (map (lambda (p)
453 (dirname (search-input-file inputs p)))
454 '("bin/uname" ;coreutils
455 ;; These are used as the fallback when no desktop
456 ;; session was found.
457 "bin/twm"
458 "bin/xsetroot"
459 "bin/xterm")))))))))
460 (native-inputs
461 (list `(,openjdk "jdk")
462 pkg-config
463 python))
464 (inputs
465 (list dbus
466 font-alias
467 freetype
468 guile-3.0
469 libfontenc
470 libjpeg-turbo
471 libx11
472 libxdamage
473 libxext
474 libxfont2
475 libxi
476 libxkbfile
477 linux-pam
478 mesa
479 openjdk
480 openssh
481 openssl
482 perl
483 pixman
484 twm
485 virtualgl
486 xauth
487 xdpyinfo
488 xkbcomp
489 xkeyboard-config
490 xorg-server
491 xorgproto
492 xsetroot
493 xterm
494 xtrans
495 zlib))
496 (home-page "https://turbovnc.org/")
497 (synopsis "Highly-optimized VNC remote desktop software")
498 (description "TurboVNC is a high-speed version of VNC derived from
499 TightVNC, with which it remains compatible. It contains a variant of Tight
500 encoding that is tuned to maximize performance for image-intensive
501 applications (such as VirtualGL, video applications, and image editors) while
502 still providing excellent performance for other types of applications. Some
503 of its unique features are:
504 @itemize
505 @item a user-facing @command{vncserver} command;
506 @item the ability to capture keyboard keys even when not in full screen mode;
507 @item a full screen mode that is compatible with ratpoison*
508 @end itemize
509 *Although due to a quirk in Java, you'll want to set the
510 @env{_JAVA_AWT_WM_NONREPARENTING} environment variable when using it with
511 ratpoison.")
512 (license license:gpl2+)))
513
514 (define-public libvnc
515 (package
516 (name "libvnc")
517 (version "0.9.13")
518 (source
519 (origin
520 (method git-fetch)
521 (uri (git-reference
522 (url "https://github.com/LibVNC/libvncserver")
523 (commit (string-append "LibVNCServer-" version))))
524 (file-name (git-file-name name version))
525 (sha256
526 (base32 "0zz0hslw8b1p3crnfy3xnmrljik359h83dpk64s697dqdcrzy141"))))
527 (build-system cmake-build-system)
528 (arguments
529 '(#:phases (modify-phases %standard-phases
530 (add-after 'unpack 'patch-cc-reference
531 (lambda _
532 (substitute* "test/includetest.sh"
533 (("^cc -I")
534 "gcc -I"))
535 #t)))))
536 (native-inputs
537 (list pkg-config))
538 (inputs
539 `(("gnutls" ,gnutls)
540 ("libgcrypt" ,libgcrypt)
541 ("libjpeg" ,libjpeg-turbo)
542 ("libpng" ,libpng)
543 ("lzo" ,lzo)
544 ("sdl2" ,sdl2)))
545 (home-page "https://libvnc.github.io/")
546 (synopsis "Cross-platform C libraries for implementing VNC server or
547 client")
548 (description "This package provides @code{LibVNCServer} and
549 @code{LibVNCClient}. These are cross-platform C libraries that allow you to
550 easily implement VNC server or client functionality in your program.")
551 (license ;; GPL for programs, FDL for documentation
552 (list license:gpl2+ license:fdl1.2+))))