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>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages vnc)
22 #:use-module (guix build-system cmake)
23 #:use-module (guix download)
24 #:use-module (guix git-download)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix packages)
27 #:use-module (guix utils)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages autotools)
30 #:use-module (gnu packages base)
31 #:use-module (gnu packages cmake)
32 #:use-module (gnu packages commencement)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages fltk)
35 #:use-module (gnu packages gettext)
36 #:use-module (gnu packages gnupg)
37 #:use-module (gnu packages image)
38 #:use-module (gnu packages linux)
39 #:use-module (gnu packages perl)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages sdl)
42 #:use-module (gnu packages tls)
43 #:use-module (gnu packages xorg))
45 (define-public tigervnc-client
47 (name "tigervnc-client")
54 (url "https://github.com/TigerVNC/tigervnc.git")
55 (commit (string-append "v" version))))
56 (file-name (git-file-name name version))
59 "001n189d2f3psn7nxgl8188ml6f7jbk26cxn2835y3mnlk5lmhgr"))))
60 (build-system cmake-build-system)
62 '(#:tests? #f ; Tests that do exists are not automated.
63 #:phases (modify-phases %standard-phases
65 (lambda* (#:key outputs #:allow-other-keys)
66 (with-directory-excursion "vncviewer"
67 (invoke "make" "install")))))))
69 `(("autoconf" ,autoconf)
70 ("gettext-minimal" ,gettext-minimal)
71 ("automake" ,automake)))
75 ("libjpeg-turbo" ,libjpeg-turbo)
77 ("linux-pam" ,linux-pam)
81 ("libxrandr" ,libxrandr)
82 ("libxdamage" ,libxdamage)))
83 (home-page "https://tigervnc.org/")
84 (synopsis "High-performance, platform-neutral
85 implementation of VNC (client)")
86 (description "TigerVNC is a client/server implementation of VNC (Virtual
87 Network Computing). It provides enough performance to run even 3D and video
88 applications. It also provides extensions for advanced authentication methods
89 and TLS encryption. This package installs only the VNC client, the
90 application which is needed to connect to VNC servers.")
91 (license license:gpl2)))
93 ;; A VNC server is, in fact, an X server so it seems like a good idea
94 ;; to build on the work already done for xorg-server package. This is
95 ;; not entirely compatible with the recommendation in BUILDING.txt
96 ;; where the client is built first, then the source code of the X
97 ;; server is copied into a subdir of the build directory, patched with
98 ;; VNC additions and then build and installed as Xvnc. The procedure
99 ;; was turned around, where TigerVNC code is downloaded and built
100 ;; inside the Guix X server build dir. Also, the VNC patching process
101 ;; for the X server is automated in a straightforward manner.
102 (define-public tigervnc-server
104 (inherit xorg-server)
105 (name "tigervnc-server")
108 `(("tigervnc-src" ,(origin
112 (url "https://github.com/TigerVNC/tigervnc.git")
116 "0b47fg3741qs3zdpl2zr0s6jz46dypp2j6gqrappbzm3ywnnmm1x"))))
117 ("autoconf" ,autoconf)
118 ("automake" ,automake)
120 ("gettext-minimal" ,gettext-minimal)
121 ("font-util" ,font-util)
123 ("gcc-toolchain" ,gcc-toolchain)
125 ,@(package-native-inputs tigervnc-client)
126 ,@(package-inputs tigervnc-client)
127 ,@(package-native-inputs xorg-server)))
130 ("coreutils" ,coreutils)
132 ,@(package-inputs xorg-server)))
135 ,@(package-propagated-inputs xorg-server)))
137 (substitute-keyword-arguments
138 (package-arguments xorg-server)
139 ((#:configure-flags flags)
140 `(append '("--with-pic" ; Taken from BUILDING.txt
152 ;; "--disable-config-dbus" ; This was a warning.
153 "--disable-config-hal"
154 "--disable-config-udev"
156 ;; "--enable-install-libxf86config" ; This, too, was a warning.
158 (delete "--enable-xephyr" ,flags)))
160 `(append '((ice-9 ftw)
163 (guix build gnu-build-system))
166 `(modify-phases ,phases
168 (add-after 'unpack 'copy-tvnc-xserver
171 ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
172 (tvnc-xserver (string-append tvnc-src "/unix/xserver")))
173 (copy-recursively tvnc-xserver ".")
175 (add-after 'copy-tvnc-xserver 'patch-xserver
178 ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
179 (xorg-server-version ,(package-version xorg-server))
180 (which-patch (lambda ()
182 ((patch-num (apply string-append
183 (list-head (string-split xorg-server-version
186 (fn (format "~a/unix/xserver~a.patch" tvnc-src patch-num)))
187 (when (not (file-exists? fn))
188 (error (format "Patch file, ~a,
189 corresponding to the input xorg-server version, does not exist. Installation
192 fn))) ; VNC patches for xserver have the
193 ; form xserverXY[Y].patch, where
194 ; X.Y[Y].Z is the Xorg server
196 (xserver-patch (which-patch)))
197 (invoke "patch" "-p1" "-i" xserver-patch)
198 (invoke "autoreconf" "-fiv"))))
199 (add-before 'build 'build-tigervnc
201 (let* ((out (assoc-ref %outputs "out"))
202 (tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
203 (tvnc-build (string-append (getcwd) "/tigervnc-build")))
205 (with-directory-excursion tvnc-build
206 (invoke "cmake" "-G" "Unix Makefiles"
207 (string-append "-DCMAKE_INSTALL_PREFIX=" out)
209 (invoke "make" "-j" (number->string (parallel-job-count)))))))
212 (let* ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
213 (tvnc-build (string-append (getcwd) "/tigervnc-build"))
214 (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
215 (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
216 (invoke "make" srcarg buildarg "-j"
217 (number->string (parallel-job-count))))))
218 (add-before 'install 'install-tigervnc-aux
220 (let* ((out (assoc-ref %outputs 'out))
221 (tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
222 (tvnc-build (string-append (getcwd) "/tigervnc-build"))
223 (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
224 (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
225 (with-directory-excursion (string-append tvnc-build "/unix")
226 (invoke "make" srcarg buildarg "install")))))
229 (let* ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
230 (tvnc-build (string-append (getcwd) "/tigervnc-build"))
231 (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
232 (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
233 (invoke "make" "install" srcarg buildarg))))))))
234 (description "TigerVNC is a client/server implementation of VNC (Virtual
235 Network Computing). It provides enough performance to run even 3D and video
236 applications. It also provides extensions for advanced authentication methods
237 and TLS encryption. This package installs the VNC server, a program that will
238 enable users with VNC clients to log into a graphical session on the machine
239 where the server is installed.")))
241 (define-public libvnc
249 (url "https://github.com/LibVNC/libvncserver.git")
250 (commit (string-append "LibVNCServer-" version))))
251 (file-name (git-file-name name version))
253 (base32 "1226hb179l914919f5nm2mlf8rhaarqbf48aa649p4rwmghyx9vm"))
254 (patches (search-patches "libvnc-CVE-2018-20750.patch"
255 "libvnc-CVE-2019-15681.patch"))))
256 (build-system cmake-build-system)
258 `(("pkg-config" ,pkg-config)))
261 ("libgcrypt" ,libgcrypt)
262 ("libjpeg" ,libjpeg-turbo)
266 (home-page "https://libvnc.github.io/")
267 (synopsis "Cross-platform C libraries for implementing VNC server or
269 (description "This package provides @code{LibVNCServer} and
270 @code{LibVNCClient}. These are cross-platform C libraries that allow you to
271 easily implement VNC server or client functionality in your program.")
272 (license ;; GPL for programs, FDL for documentation
273 (list license:gpl2+ license:fdl1.2+))))