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