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>
10 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
68 (define-public remmina
77 (url "https://gitlab.com/Remmina/Remmina")
78 (commit (string-append "v" version))))
79 (file-name (git-file-name name version))
81 (base32 "1j0fiz76z4y08w136vs8igqxxg42hx61r5hf6sylcr0c424sc9rk"))))
82 (build-system cmake-build-system)
84 `(#:tests? #f ; No target
87 ;; Disable online version checking.
90 ((guix build glib-or-gtk-build-system)
91 ,@%cmake-build-system-modules)
93 (((guix build glib-or-gtk-build-system)
94 #:prefix glib-or-gtk:)
95 (guix build cmake-build-system)
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")))
108 (let ((file (string-append out "/bin/" name))
109 (gi-typelib-path (getenv "GI_TYPELIB_PATH")))
111 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path)))))
112 '("remmina" "remmina-file-wrapper"))))))))
114 (list gettext-minimal
116 gobject-introspection
121 (list libappindicator
127 freerdp ; for rdp plugin
132 gsettings-desktop-schemas
136 libsecret ; for secret plugin
138 libssh ; for ssh plugin
139 libvnc ; for vnc plugin
142 pcre2 ; for exec plugin
145 spice-gtk ; for spice plugin
149 webkitgtk ; for www plugin
151 libxext ; for xdmcp plugin
153 libxkbfile)) ; for nx plugin
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+)))
162 (define-public tigervnc-client
163 ;; xorg-server 21 support was merged 2 weeks after the last (1.12.0) release.
165 (commit "b484c229853a08c7f254a4c6efbaf3c9e85b5074"))
167 (name "tigervnc-client")
168 (version (git-version "1.12.0" revision commit))
173 (url "https://github.com/TigerVNC/tigervnc")
176 (base32 "125dnn05ps7vfsxlxmzm05w99lhm8hk8j4hpxl1mlzb5j0hp1061"))
177 (file-name (git-file-name name version))))
178 (build-system cmake-build-system)
180 '(#:tests? #f ; Tests that do exists are not automated.
181 #:phases (modify-phases %standard-phases
183 (lambda* (#:key outputs #:allow-other-keys)
184 (with-directory-excursion "vncviewer"
185 (invoke "make" "install")))))))
187 (list autoconf gettext-minimal automake))
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))))
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
221 (inherit xorg-server)
222 (name "tigervnc-server")
223 (version (package-version tigervnc-client))
225 `(("tigervnc-src" ,(package-source tigervnc-client))
226 ("autoconf" ,autoconf)
227 ("automake" ,automake)
229 ("gettext-minimal" ,gettext-minimal)
230 ("font-util" ,font-util)
233 ,@(package-native-inputs tigervnc-client)
234 ,@(package-inputs tigervnc-client)
235 ,@(package-native-inputs xorg-server)))
237 (modify-inputs (package-inputs xorg-server)
238 (prepend perl coreutils xauth)))
240 (modify-inputs (package-propagated-inputs xorg-server)
243 (substitute-keyword-arguments
244 (package-arguments xorg-server)
245 ((#:configure-flags flags)
246 `(append '("--with-pic" ; Taken from BUILDING.txt
258 ;; "--disable-config-dbus" ; This was a warning.
259 "--disable-config-hal"
260 "--disable-config-udev"
262 ;; "--enable-install-libxf86config" ; This, too, was a warning.
264 (delete "--enable-xephyr" ,flags)))
266 `(append '((ice-9 ftw)
269 (guix build gnu-build-system))
272 `(modify-phases ,phases
274 (add-after 'unpack 'copy-tvnc-xserver
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
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
288 (let* ((out (assoc-ref %outputs "out"))
289 (tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
290 (tvnc-build (string-append (getcwd) "/tigervnc-build")))
292 (with-directory-excursion tvnc-build
293 (invoke "cmake" "-G" "Unix Makefiles"
294 (string-append "-DCMAKE_INSTALL_PREFIX=" out)
296 (invoke "make" "-j" (number->string (parallel-job-count)))))))
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
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")))))
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.")))
328 (define-public turbovnc
335 (uri (string-append "mirror://sourceforge/turbovnc/" version
336 "/turbovnc-" version ".tar.gz"))
337 (modules '((guix build utils)
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)))
350 (define (delete-all-but directory . preserve)
351 (with-directory-excursion directory
352 (let* ((pred (negate (cut member <> (append '("." "..")
354 (items (scandir "." pred)))
355 (for-each (lambda (item)
356 (if (directory? item)
357 (delete-file-recursively item)
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")))
372 "182amp471qvr2cn2rbw97zpbkh9q7mf92w1r25cg4apx5k26m7c3"))
373 (patches (search-patches "turbovnc-find-system-packages.patch"
374 "turbovnc-custom-paths.patch"))))
375 (build-system cmake-build-system)
378 #:tests? #f ;no test suite
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")
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
396 (string-append "-DXKB_BIN_DIRECTORY="
397 (dirname (search-input-file %build-inputs
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")
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")
415 ;; Avoid resorting to grep and sed to locate libjawt.so.
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:]]+")
429 (search-input-file inputs "bin/grep")))
430 (("SED=[[:graph:]]+")
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")
444 (dirname (search-input-file inputs p)))
445 '("bin/uname" ;coreutils
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")
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.
461 (list `(,openjdk "jdk")
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:
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*
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
512 (license license:gpl2+)))
514 (define-public libvnc
522 (url "https://github.com/LibVNC/libvncserver")
523 (commit (string-append "LibVNCServer-" version))))
524 (file-name (git-file-name name version))
526 (base32 "0zz0hslw8b1p3crnfy3xnmrljik359h83dpk64s697dqdcrzy141"))))
527 (build-system cmake-build-system)
529 '(#:phases (modify-phases %standard-phases
530 (add-after 'unpack 'patch-cc-reference
532 (substitute* "test/includetest.sh"
540 ("libgcrypt" ,libgcrypt)
541 ("libjpeg" ,libjpeg-turbo)
545 (home-page "https://libvnc.github.io/")
546 (synopsis "Cross-platform C libraries for implementing VNC server or
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+))))