gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[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 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages vnc)
24 #:use-module (guix build-system cmake)
25 #:use-module (guix download)
26 #:use-module (guix git-download)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix packages)
29 #:use-module (guix utils)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages cmake)
34 #:use-module (gnu packages commencement)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages fltk)
37 #:use-module (gnu packages gettext)
38 #:use-module (gnu packages gnupg)
39 #:use-module (gnu packages image)
40 #:use-module (gnu packages linux)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages sdl)
44 #:use-module (gnu packages tls)
45 #:use-module (gnu packages xdisorg)
46 #:use-module (gnu packages xorg))
47
48 (define-public tigervnc-client
49 (package
50 (name "tigervnc-client")
51 (version "1.11.0")
52 (source (origin
53 (method git-fetch)
54 (uri
55 (git-reference
56 (url "https://github.com/TigerVNC/tigervnc")
57 (commit (string-append "v" version))))
58 (sha256
59 (base32
60 "1bg79ahr4mzy48ak0caxy3ckdsxmhpchypggaz6lxjjk92hgsz91"))
61 (file-name (git-file-name name version))))
62 (build-system cmake-build-system)
63 (arguments
64 '(#:tests? #f ; Tests that do exists are not automated.
65 #:phases (modify-phases %standard-phases
66 (replace 'install
67 (lambda* (#:key outputs #:allow-other-keys)
68 (with-directory-excursion "vncviewer"
69 (invoke "make" "install")))))))
70 (native-inputs
71 `(("autoconf" ,autoconf)
72 ("gettext-minimal" ,gettext-minimal)
73 ("automake" ,automake)))
74 (inputs
75 `(("zlib" ,zlib)
76 ("gnutls" ,gnutls)
77 ("libjpeg-turbo" ,libjpeg-turbo)
78 ("fltk" ,fltk)
79 ("linux-pam" ,linux-pam)
80 ("libx11" ,libx11)
81 ("libxext" ,libxext)
82 ("libxtst" ,libxtst)
83 ("libxrandr" ,libxrandr)
84 ("libxdamage" ,libxdamage)
85 ("pixman" ,pixman)))
86 (home-page "https://tigervnc.org/")
87 (synopsis "High-performance, platform-neutral
88 implementation of VNC (client)")
89 (description "TigerVNC is a client/server implementation of VNC (Virtual
90 Network Computing). It provides enough performance to run even 3D and video
91 applications. It also provides extensions for advanced authentication methods
92 and TLS encryption. This package installs only the VNC client, the
93 application which is needed to connect to VNC servers.")
94 (license license:gpl2)))
95
96 ;; A VNC server is, in fact, an X server so it seems like a good idea
97 ;; to build on the work already done for xorg-server package. This is
98 ;; not entirely compatible with the recommendation in BUILDING.txt
99 ;; where the client is built first, then the source code of the X
100 ;; server is copied into a subdir of the build directory, patched with
101 ;; VNC additions and then build and installed as Xvnc. The procedure
102 ;; was turned around, where TigerVNC code is downloaded and built
103 ;; inside the Guix X server build dir. Also, the VNC patching process
104 ;; for the X server is automated in a straightforward manner.
105 (define-public tigervnc-server
106 (package
107 (inherit xorg-server)
108 (name "tigervnc-server")
109 (version (package-version tigervnc-client))
110 (native-inputs
111 `(("tigervnc-src" ,(package-source tigervnc-client))
112 ("autoconf" ,autoconf)
113 ("automake" ,automake)
114 ("libtool" ,libtool)
115 ("gettext-minimal" ,gettext-minimal)
116 ("font-util" ,font-util)
117 ("cmake" ,cmake)
118 ("gcc-toolchain" ,gcc-toolchain)
119 ("perl" ,perl)
120 ,@(package-native-inputs tigervnc-client)
121 ,@(package-inputs tigervnc-client)
122 ,@(package-native-inputs xorg-server)))
123 (inputs
124 `(("perl" ,perl)
125 ("coreutils" ,coreutils)
126 ("xauth" ,xauth)
127 ,@(package-inputs xorg-server)))
128 (propagated-inputs
129 `(("xauth" ,xauth)
130 ,@(package-propagated-inputs xorg-server)))
131 (arguments
132 (substitute-keyword-arguments
133 (package-arguments xorg-server)
134 ((#:configure-flags flags)
135 `(append '("--with-pic" ; Taken from BUILDING.txt
136 "--without-dtrace"
137 "--disable-static"
138 "--disable-dri2"
139 "--disable-xinerama"
140 "--disable-xvfb"
141 "--disable-xnest"
142 "--disable-xorg"
143 "--disable-dmx"
144 "--disable-xwin"
145 "--disable-xephyr"
146 "--disable-kdrive"
147 ;; "--disable-config-dbus" ; This was a warning.
148 "--disable-config-hal"
149 "--disable-config-udev"
150 "--disable-dri2"
151 ;; "--enable-install-libxf86config" ; This, too, was a warning.
152 "--enable-glx")
153 (delete "--enable-xephyr" ,flags)))
154 ((#:modules modules)
155 `(append '((ice-9 ftw)
156 (ice-9 match)
157 (guix build utils)
158 (guix build gnu-build-system))
159 modules))
160 ((#:phases phases)
161 `(modify-phases ,phases
162 (delete 'check) ;)
163 (add-after 'unpack 'copy-tvnc-xserver
164 (lambda _
165 (let*
166 ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
167 (tvnc-xserver (string-append tvnc-src "/unix/xserver")))
168 (copy-recursively tvnc-xserver ".")
169 #t)))
170 (add-after 'copy-tvnc-xserver 'patch-xserver
171 (lambda _
172 (let*
173 ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
174 (xorg-server-version ,(package-version xorg-server))
175 (which-patch (lambda ()
176 (let*
177 ((patch-num (apply string-append
178 (list-head (string-split xorg-server-version
179 #\.)
180 2)))
181 (fn (format #f "~a/unix/xserver~a.patch" tvnc-src patch-num)))
182 (when (not (file-exists? fn))
183 (error (format #f "Patch file, ~a,
184 corresponding to the input xorg-server version, does not exist. Installation
185 will fail. " fn)))
186
187 fn))) ; VNC patches for xserver have the
188 ; form xserverXY[Y].patch, where
189 ; X.Y[Y].Z is the Xorg server
190 ; version.
191 (xserver-patch (which-patch)))
192 (invoke "patch" "-p1" "-i" xserver-patch)
193 (invoke "autoreconf" "-fiv"))))
194 (add-before 'build 'build-tigervnc
195 (lambda _
196 (let* ((out (assoc-ref %outputs "out"))
197 (tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
198 (tvnc-build (string-append (getcwd) "/tigervnc-build")))
199 (mkdir-p tvnc-build)
200 (with-directory-excursion tvnc-build
201 (invoke "cmake" "-G" "Unix Makefiles"
202 (string-append "-DCMAKE_INSTALL_PREFIX=" out)
203 tvnc-src)
204 (invoke "make" "-j" (number->string (parallel-job-count)))))))
205 (replace 'build
206 (lambda _
207 (let* ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
208 (tvnc-build (string-append (getcwd) "/tigervnc-build"))
209 (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
210 (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
211 (invoke "make" srcarg buildarg "-j"
212 (number->string (parallel-job-count))))))
213 (add-before 'install 'install-tigervnc-aux
214 (lambda _
215 (let* ((out (assoc-ref %outputs 'out))
216 (tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
217 (tvnc-build (string-append (getcwd) "/tigervnc-build"))
218 (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
219 (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
220 (with-directory-excursion (string-append tvnc-build "/unix")
221 (invoke "make" srcarg buildarg "install")))))
222 (replace 'install
223 (lambda* _
224 (let* ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
225 (tvnc-build (string-append (getcwd) "/tigervnc-build"))
226 (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
227 (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
228 (invoke "make" "install" srcarg buildarg))))))))
229 (description "TigerVNC is a client/server implementation of VNC (Virtual
230 Network Computing). It provides enough performance to run even 3D and video
231 applications. It also provides extensions for advanced authentication methods
232 and TLS encryption. This package installs the VNC server, a program that will
233 enable users with VNC clients to log into a graphical session on the machine
234 where the server is installed.")))
235
236 (define-public libvnc
237 (package
238 (name "libvnc")
239 (version "0.9.13")
240 (source
241 (origin
242 (method git-fetch)
243 (uri (git-reference
244 (url "https://github.com/LibVNC/libvncserver")
245 (commit (string-append "LibVNCServer-" version))))
246 (file-name (git-file-name name version))
247 (sha256
248 (base32 "0zz0hslw8b1p3crnfy3xnmrljik359h83dpk64s697dqdcrzy141"))))
249 (build-system cmake-build-system)
250 (arguments
251 '(#:phases (modify-phases %standard-phases
252 (add-after 'unpack 'patch-cc-reference
253 (lambda _
254 (substitute* "test/includetest.sh"
255 (("^cc -I")
256 "gcc -I"))
257 #t)))))
258 (native-inputs
259 `(("pkg-config" ,pkg-config)))
260 (inputs
261 `(("gnutls" ,gnutls)
262 ("libgcrypt" ,libgcrypt)
263 ("libjpeg" ,libjpeg-turbo)
264 ("libpng" ,libpng)
265 ("lzo" ,lzo)
266 ("sdl2" ,sdl2)))
267 (home-page "https://libvnc.github.io/")
268 (synopsis "Cross-platform C libraries for implementing VNC server or
269 client")
270 (description "This package provides @code{LibVNCServer} and
271 @code{LibVNCClient}. These are cross-platform C libraries that allow you to
272 easily implement VNC server or client functionality in your program.")
273 (license ;; GPL for programs, FDL for documentation
274 (list license:gpl2+ license:fdl1.2+))))