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>
8 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
48 (define-public tigervnc-client
50 (name "tigervnc-client")
56 (url "https://github.com/TigerVNC/tigervnc")
57 (commit (string-append "v" version))))
60 "1bg79ahr4mzy48ak0caxy3ckdsxmhpchypggaz6lxjjk92hgsz91"))
61 (file-name (git-file-name name version))))
62 (build-system cmake-build-system)
64 '(#:tests? #f ; Tests that do exists are not automated.
65 #:phases (modify-phases %standard-phases
67 (lambda* (#:key outputs #:allow-other-keys)
68 (with-directory-excursion "vncviewer"
69 (invoke "make" "install")))))))
71 `(("autoconf" ,autoconf)
72 ("gettext-minimal" ,gettext-minimal)
73 ("automake" ,automake)))
77 ("libjpeg-turbo" ,libjpeg-turbo)
79 ("linux-pam" ,linux-pam)
83 ("libxrandr" ,libxrandr)
84 ("libxdamage" ,libxdamage)
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)))
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
107 (inherit xorg-server)
108 (name "tigervnc-server")
109 (version (package-version tigervnc-client))
111 `(("tigervnc-src" ,(package-source tigervnc-client))
112 ("autoconf" ,autoconf)
113 ("automake" ,automake)
115 ("gettext-minimal" ,gettext-minimal)
116 ("font-util" ,font-util)
118 ("gcc-toolchain" ,gcc-toolchain)
120 ,@(package-native-inputs tigervnc-client)
121 ,@(package-inputs tigervnc-client)
122 ,@(package-native-inputs xorg-server)))
125 ("coreutils" ,coreutils)
127 ,@(package-inputs xorg-server)))
130 ,@(package-propagated-inputs xorg-server)))
132 (substitute-keyword-arguments
133 (package-arguments xorg-server)
134 ((#:configure-flags flags)
135 `(append '("--with-pic" ; Taken from BUILDING.txt
147 ;; "--disable-config-dbus" ; This was a warning.
148 "--disable-config-hal"
149 "--disable-config-udev"
151 ;; "--enable-install-libxf86config" ; This, too, was a warning.
153 (delete "--enable-xephyr" ,flags)))
155 `(append '((ice-9 ftw)
158 (guix build gnu-build-system))
161 `(modify-phases ,phases
163 (add-after 'unpack 'copy-tvnc-xserver
166 ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
167 (tvnc-xserver (string-append tvnc-src "/unix/xserver")))
168 (copy-recursively tvnc-xserver ".")
170 (add-after 'copy-tvnc-xserver 'patch-xserver
173 ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
174 (xorg-server-version ,(package-version xorg-server))
175 (which-patch (lambda ()
177 ((patch-num (apply string-append
178 (list-head (string-split xorg-server-version
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
187 fn))) ; VNC patches for xserver have the
188 ; form xserverXY[Y].patch, where
189 ; X.Y[Y].Z is the Xorg server
191 (xserver-patch (which-patch)))
192 (invoke "patch" "-p1" "-i" xserver-patch)
193 (invoke "autoreconf" "-fiv"))))
194 (add-before 'build 'build-tigervnc
196 (let* ((out (assoc-ref %outputs "out"))
197 (tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
198 (tvnc-build (string-append (getcwd) "/tigervnc-build")))
200 (with-directory-excursion tvnc-build
201 (invoke "cmake" "-G" "Unix Makefiles"
202 (string-append "-DCMAKE_INSTALL_PREFIX=" out)
204 (invoke "make" "-j" (number->string (parallel-job-count)))))))
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
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")))))
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.")))
236 (define-public libvnc
244 (url "https://github.com/LibVNC/libvncserver")
245 (commit (string-append "LibVNCServer-" version))))
246 (file-name (git-file-name name version))
248 (base32 "0zz0hslw8b1p3crnfy3xnmrljik359h83dpk64s697dqdcrzy141"))))
249 (build-system cmake-build-system)
251 '(#:phases (modify-phases %standard-phases
252 (add-after 'unpack 'patch-cc-reference
254 (substitute* "test/includetest.sh"
259 `(("pkg-config" ,pkg-config)))
262 ("libgcrypt" ,libgcrypt)
263 ("libjpeg" ,libjpeg-turbo)
267 (home-page "https://libvnc.github.io/")
268 (synopsis "Cross-platform C libraries for implementing VNC server or
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+))))