Commit | Line | Data |
---|---|---|
0992cfa1 TK |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2019 Todor Kondić <tk.code@protonmail.com> | |
3d4bf400 | 3 | ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com> |
a789f654 | 4 | ;;; Copyright © 2020 Hartmut Goebel <h.goebel@crazy-compilers.com> |
0992cfa1 TK |
5 | ;;; |
6 | ;;; This file is part of GNU Guix. | |
7 | ;;; | |
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. | |
12 | ;;; | |
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. | |
17 | ;;; | |
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/>. | |
20 | ||
94c7ef93 HG |
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) | |
a789f654 | 28 | #:use-module (gnu packages) |
0992cfa1 | 29 | #:use-module (gnu packages autotools) |
94c7ef93 HG |
30 | #:use-module (gnu packages base) |
31 | #:use-module (gnu packages cmake) | |
32 | #:use-module (gnu packages commencement) | |
0992cfa1 | 33 | #:use-module (gnu packages compression) |
0992cfa1 | 34 | #:use-module (gnu packages fltk) |
94c7ef93 | 35 | #:use-module (gnu packages gettext) |
a789f654 | 36 | #:use-module (gnu packages gnupg) |
0992cfa1 | 37 | #:use-module (gnu packages image) |
94c7ef93 | 38 | #:use-module (gnu packages linux) |
0992cfa1 | 39 | #:use-module (gnu packages perl) |
a789f654 HG |
40 | #:use-module (gnu packages pkg-config) |
41 | #:use-module (gnu packages sdl) | |
94c7ef93 HG |
42 | #:use-module (gnu packages tls) |
43 | #:use-module (gnu packages xorg)) | |
0992cfa1 TK |
44 | |
45 | (define-public tigervnc-client | |
d58c9574 OP |
46 | (let ((commit "920d9c4d6562ecabf79497bc901d50522d4bc661")) |
47 | (package | |
48 | (name "tigervnc-client") | |
49 | (version (git-version "1.10.1" "1" commit)) | |
50 | (source (origin | |
51 | (method git-fetch) | |
52 | (uri | |
53 | (git-reference | |
54 | (url "https://github.com/TigerVNC/tigervnc.git") | |
55 | (commit commit))) | |
56 | (sha256 | |
57 | (base32 | |
58 | "1lp6mxl5dqlkrzx0q145jzgpbwvhsni3fj6x9ngf8v5s63x82q1p")) | |
59 | (file-name (git-file-name name version)))) | |
60 | (build-system cmake-build-system) | |
61 | (arguments | |
62 | '(#:tests? #f ; Tests that do exists are not automated. | |
63 | #:phases (modify-phases %standard-phases | |
64 | (replace 'install | |
65 | (lambda* (#:key outputs #:allow-other-keys) | |
66 | (with-directory-excursion "vncviewer" | |
67 | (invoke "make" "install"))))))) | |
68 | (native-inputs | |
69 | `(("autoconf" ,autoconf) | |
70 | ("gettext-minimal" ,gettext-minimal) | |
71 | ("automake" ,automake))) | |
72 | (inputs | |
73 | `(("zlib" ,zlib) | |
74 | ("gnutls" ,gnutls) | |
75 | ("libjpeg-turbo" ,libjpeg-turbo) | |
76 | ("fltk" ,fltk) | |
77 | ("linux-pam" ,linux-pam) | |
78 | ("libx11" ,libx11) | |
79 | ("libxext" ,libxext) | |
80 | ("libxtst" ,libxtst) | |
81 | ("libxrandr" ,libxrandr) | |
82 | ("libxdamage" ,libxdamage))) | |
83 | (home-page "https://tigervnc.org/") | |
84 | (synopsis "High-performance, platform-neutral | |
0992cfa1 | 85 | implementation of VNC (client)") |
d58c9574 | 86 | (description "TigerVNC is a client/server implementation of VNC (Virtual |
0992cfa1 TK |
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.") | |
d58c9574 | 91 | (license license:gpl2)))) |
04784d21 TK |
92 | |
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 | |
103 | (package | |
104 | (inherit xorg-server) | |
105 | (name "tigervnc-server") | |
d58c9574 | 106 | (version (package-version tigervnc-client)) |
04784d21 | 107 | (native-inputs |
d58c9574 | 108 | `(("tigervnc-src" ,(package-source tigervnc-client)) |
04784d21 TK |
109 | ("autoconf" ,autoconf) |
110 | ("automake" ,automake) | |
111 | ("libtool" ,libtool) | |
112 | ("gettext-minimal" ,gettext-minimal) | |
113 | ("font-util" ,font-util) | |
114 | ("cmake" ,cmake) | |
115 | ("gcc-toolchain" ,gcc-toolchain) | |
116 | ("perl" ,perl) | |
117 | ,@(package-native-inputs tigervnc-client) | |
118 | ,@(package-inputs tigervnc-client) | |
119 | ,@(package-native-inputs xorg-server))) | |
120 | (inputs | |
121 | `(("perl" ,perl) | |
122 | ("coreutils" ,coreutils) | |
123 | ("xauth" ,xauth) | |
124 | ,@(package-inputs xorg-server))) | |
125 | (propagated-inputs | |
126 | `(("xauth" ,xauth) | |
127 | ,@(package-propagated-inputs xorg-server))) | |
128 | (arguments | |
129 | (substitute-keyword-arguments | |
130 | (package-arguments xorg-server) | |
131 | ((#:configure-flags flags) | |
132 | `(append '("--with-pic" ; Taken from BUILDING.txt | |
133 | "--without-dtrace" | |
134 | "--disable-static" | |
135 | "--disable-dri2" | |
136 | "--disable-xinerama" | |
137 | "--disable-xvfb" | |
138 | "--disable-xnest" | |
139 | "--disable-xorg" | |
140 | "--disable-dmx" | |
141 | "--disable-xwin" | |
d8de3856 | 142 | "--disable-xephyr" |
04784d21 TK |
143 | "--disable-kdrive" |
144 | ;; "--disable-config-dbus" ; This was a warning. | |
145 | "--disable-config-hal" | |
146 | "--disable-config-udev" | |
147 | "--disable-dri2" | |
148 | ;; "--enable-install-libxf86config" ; This, too, was a warning. | |
149 | "--enable-glx") | |
d8de3856 | 150 | (delete "--enable-xephyr" ,flags))) |
04784d21 TK |
151 | ((#:modules modules) |
152 | `(append '((ice-9 ftw) | |
153 | (ice-9 match) | |
154 | (guix build utils) | |
155 | (guix build gnu-build-system)) | |
156 | modules)) | |
157 | ((#:phases phases) | |
158 | `(modify-phases ,phases | |
159 | (delete 'check) ;) | |
160 | (add-after 'unpack 'copy-tvnc-xserver | |
161 | (lambda _ | |
162 | (let* | |
163 | ((tvnc-src (assoc-ref %build-inputs "tigervnc-src")) | |
164 | (tvnc-xserver (string-append tvnc-src "/unix/xserver"))) | |
165 | (copy-recursively tvnc-xserver ".") | |
166 | #t))) | |
167 | (add-after 'copy-tvnc-xserver 'patch-xserver | |
168 | (lambda _ | |
169 | (let* | |
170 | ((tvnc-src (assoc-ref %build-inputs "tigervnc-src")) | |
171 | (xorg-server-version ,(package-version xorg-server)) | |
172 | (which-patch (lambda () | |
173 | (let* | |
174 | ((patch-num (apply string-append | |
175 | (list-head (string-split xorg-server-version | |
176 | #\.) | |
177 | 2))) | |
d58c9574 | 178 | (fn (format #f "~a/unix/xserver~a.patch" tvnc-src patch-num))) |
04784d21 | 179 | (when (not (file-exists? fn)) |
d58c9574 | 180 | (error (format #f "Patch file, ~a, |
04784d21 TK |
181 | corresponding to the input xorg-server version, does not exist. Installation |
182 | will fail. " fn))) | |
183 | ||
184 | fn))) ; VNC patches for xserver have the | |
185 | ; form xserverXY[Y].patch, where | |
186 | ; X.Y[Y].Z is the Xorg server | |
187 | ; version. | |
188 | (xserver-patch (which-patch))) | |
189 | (invoke "patch" "-p1" "-i" xserver-patch) | |
190 | (invoke "autoreconf" "-fiv")))) | |
191 | (add-before 'build 'build-tigervnc | |
192 | (lambda _ | |
193 | (let* ((out (assoc-ref %outputs "out")) | |
194 | (tvnc-src (assoc-ref %build-inputs "tigervnc-src")) | |
195 | (tvnc-build (string-append (getcwd) "/tigervnc-build"))) | |
196 | (mkdir-p tvnc-build) | |
197 | (with-directory-excursion tvnc-build | |
198 | (invoke "cmake" "-G" "Unix Makefiles" | |
199 | (string-append "-DCMAKE_INSTALL_PREFIX=" out) | |
200 | tvnc-src) | |
201 | (invoke "make" "-j" (number->string (parallel-job-count))))))) | |
202 | (replace 'build | |
203 | (lambda _ | |
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 | |
211 | (lambda _ | |
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"))))) | |
219 | (replace 'install | |
220 | (lambda* _ | |
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."))) | |
a789f654 HG |
232 | |
233 | (define-public libvnc | |
234 | (package | |
235 | (name "libvnc") | |
236 | (version "0.9.12") | |
237 | (source | |
238 | (origin | |
239 | (method git-fetch) | |
240 | (uri (git-reference | |
241 | (url "https://github.com/LibVNC/libvncserver.git") | |
242 | (commit (string-append "LibVNCServer-" version)))) | |
243 | (file-name (git-file-name name version)) | |
244 | (sha256 | |
245 | (base32 "1226hb179l914919f5nm2mlf8rhaarqbf48aa649p4rwmghyx9vm")) | |
246 | (patches (search-patches "libvnc-CVE-2018-20750.patch" | |
247 | "libvnc-CVE-2019-15681.patch")))) | |
248 | (build-system cmake-build-system) | |
249 | (native-inputs | |
250 | `(("pkg-config" ,pkg-config))) | |
251 | (inputs | |
252 | `(("gnutls" ,gnutls) | |
253 | ("libgcrypt" ,libgcrypt) | |
12d8adbf | 254 | ("libjpeg" ,libjpeg-turbo) |
a789f654 HG |
255 | ("libpng" ,libpng) |
256 | ("lzo" ,lzo) | |
257 | ("sdl2" ,sdl2))) | |
258 | (home-page "https://libvnc.github.io/") | |
259 | (synopsis "Cross-platform C libraries for implementing VNC server or | |
260 | client") | |
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+)))) |