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
46 (let ((commit "920d9c4d6562ecabf79497bc901d50522d4bc661"))
48 (name "tigervnc-client")
49 (version (git-version "1.10.1" "1" commit))
54 (url "https://github.com/TigerVNC/tigervnc.git")
58 "1lp6mxl5dqlkrzx0q145jzgpbwvhsni3fj6x9ngf8v5s63x82q1p"))
59 (file-name (git-file-name name version))))
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")
106 (version (package-version tigervnc-client))
108 `(("tigervnc-src" ,(package-source tigervnc-client))
109 ("autoconf" ,autoconf)
110 ("automake" ,automake)
112 ("gettext-minimal" ,gettext-minimal)
113 ("font-util" ,font-util)
115 ("gcc-toolchain" ,gcc-toolchain)
117 ,@(package-native-inputs tigervnc-client)
118 ,@(package-inputs tigervnc-client)
119 ,@(package-native-inputs xorg-server)))
122 ("coreutils" ,coreutils)
124 ,@(package-inputs xorg-server)))
127 ,@(package-propagated-inputs xorg-server)))
129 (substitute-keyword-arguments
130 (package-arguments xorg-server)
131 ((#:configure-flags flags)
132 `(append '("--with-pic" ; Taken from BUILDING.txt
144 ;; "--disable-config-dbus" ; This was a warning.
145 "--disable-config-hal"
146 "--disable-config-udev"
148 ;; "--enable-install-libxf86config" ; This, too, was a warning.
150 (delete "--enable-xephyr" ,flags)))
152 `(append '((ice-9 ftw)
155 (guix build gnu-build-system))
158 `(modify-phases ,phases
160 (add-after 'unpack 'copy-tvnc-xserver
163 ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
164 (tvnc-xserver (string-append tvnc-src "/unix/xserver")))
165 (copy-recursively tvnc-xserver ".")
167 (add-after 'copy-tvnc-xserver 'patch-xserver
170 ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
171 (xorg-server-version ,(package-version xorg-server))
172 (which-patch (lambda ()
174 ((patch-num (apply string-append
175 (list-head (string-split xorg-server-version
178 (fn (format #f "~a/unix/xserver~a.patch" tvnc-src patch-num)))
179 (when (not (file-exists? fn))
180 (error (format #f "Patch file, ~a,
181 corresponding to the input xorg-server version, does not exist. Installation
184 fn))) ; VNC patches for xserver have the
185 ; form xserverXY[Y].patch, where
186 ; X.Y[Y].Z is the Xorg server
188 (xserver-patch (which-patch)))
189 (invoke "patch" "-p1" "-i" xserver-patch)
190 (invoke "autoreconf" "-fiv"))))
191 (add-before 'build 'build-tigervnc
193 (let* ((out (assoc-ref %outputs "out"))
194 (tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
195 (tvnc-build (string-append (getcwd) "/tigervnc-build")))
197 (with-directory-excursion tvnc-build
198 (invoke "cmake" "-G" "Unix Makefiles"
199 (string-append "-DCMAKE_INSTALL_PREFIX=" out)
201 (invoke "make" "-j" (number->string (parallel-job-count)))))))
204 (let* ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
205 (tvnc-build (string-append (getcwd) "/tigervnc-build"))
206 (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
207 (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
208 (invoke "make" srcarg buildarg "-j"
209 (number->string (parallel-job-count))))))
210 (add-before 'install 'install-tigervnc-aux
212 (let* ((out (assoc-ref %outputs 'out))
213 (tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
214 (tvnc-build (string-append (getcwd) "/tigervnc-build"))
215 (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
216 (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
217 (with-directory-excursion (string-append tvnc-build "/unix")
218 (invoke "make" srcarg buildarg "install")))))
221 (let* ((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 (invoke "make" "install" srcarg buildarg))))))))
226 (description "TigerVNC is a client/server implementation of VNC (Virtual
227 Network Computing). It provides enough performance to run even 3D and video
228 applications. It also provides extensions for advanced authentication methods
229 and TLS encryption. This package installs the VNC server, a program that will
230 enable users with VNC clients to log into a graphical session on the machine
231 where the server is installed.")))
233 (define-public libvnc
241 (url "https://github.com/LibVNC/libvncserver.git")
242 (commit (string-append "LibVNCServer-" version))))
243 (file-name (git-file-name name version))
245 (base32 "1226hb179l914919f5nm2mlf8rhaarqbf48aa649p4rwmghyx9vm"))
246 (patches (search-patches "libvnc-CVE-2018-20750.patch"
247 "libvnc-CVE-2019-15681.patch"))))
248 (build-system cmake-build-system)
250 `(("pkg-config" ,pkg-config)))
253 ("libgcrypt" ,libgcrypt)
254 ("libjpeg" ,libjpeg-turbo)
258 (home-page "https://libvnc.github.io/")
259 (synopsis "Cross-platform C libraries for implementing VNC server or
261 (description "This package provides @code{LibVNCServer} and
262 @code{LibVNCClient}. These are cross-platform C libraries that allow you to
263 easily implement VNC server or client functionality in your program.")
264 (license ;; GPL for programs, FDL for documentation
265 (list license:gpl2+ license:fdl1.2+))))