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