vnc.scm 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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. ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
  8. ;;;
  9. ;;; This file is part of GNU Guix.
  10. ;;;
  11. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  12. ;;; under the terms of the GNU General Public License as published by
  13. ;;; the Free Software Foundation; either version 3 of the License, or (at
  14. ;;; your option) any later version.
  15. ;;;
  16. ;;; GNU Guix is distributed in the hope that it will be useful, but
  17. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. ;;; GNU General Public License for more details.
  20. ;;;
  21. ;;; You should have received a copy of the GNU General Public License
  22. ;;; 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 avahi)
  33. #:use-module (gnu packages base)
  34. #:use-module (gnu packages cmake)
  35. #:use-module (gnu packages compression)
  36. #:use-module (gnu packages crypto)
  37. #:use-module (gnu packages cups)
  38. #:use-module (gnu packages fltk)
  39. #:use-module (gnu packages freedesktop)
  40. #:use-module (gnu packages gettext)
  41. #:use-module (gnu packages glib)
  42. #:use-module (gnu packages gnome)
  43. #:use-module (gnu packages gnupg)
  44. #:use-module (gnu packages gtk)
  45. #:use-module (gnu packages image)
  46. #:use-module (gnu packages linux)
  47. #:use-module (gnu packages pcre)
  48. #:use-module (gnu packages perl)
  49. #:use-module (gnu packages pkg-config)
  50. #:use-module (gnu packages rdesktop)
  51. #:use-module (gnu packages sdl)
  52. #:use-module (gnu packages spice)
  53. #:use-module (gnu packages ssh)
  54. #:use-module (gnu packages tls)
  55. #:use-module (gnu packages video)
  56. #:use-module (gnu packages webkit)
  57. #:use-module (gnu packages xdisorg)
  58. #:use-module (gnu packages xorg))
  59. (define-public remmina
  60. (package
  61. (name "remmina")
  62. (version "1.4.20")
  63. (source
  64. (origin
  65. (method git-fetch)
  66. (uri
  67. (git-reference
  68. (url "https://gitlab.com/Remmina/Remmina")
  69. (commit (string-append "v" version))))
  70. (file-name (git-file-name name version))
  71. (sha256
  72. (base32 "0apm4lqcmqskdp2fjxl8dbg3686cm4w0b5806fqj7w43hdmd8w4v"))))
  73. (build-system cmake-build-system)
  74. (arguments
  75. `(#:tests? #f ; No target
  76. #:configure-flags
  77. (list
  78. ;; Disable online version checking.
  79. "-DWITH_NEWS=OFF")
  80. #:imported-modules
  81. ((guix build glib-or-gtk-build-system)
  82. ,@%cmake-build-system-modules)
  83. #:modules
  84. (((guix build glib-or-gtk-build-system)
  85. #:prefix glib-or-gtk:)
  86. (guix build cmake-build-system)
  87. (guix build utils))
  88. #:phases
  89. (modify-phases %standard-phases
  90. (add-after 'install 'glib-or-gtk-compile-schemas
  91. (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
  92. (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
  93. (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
  94. (add-after 'glib-or-gtk-wrap 'wrap-typelibs
  95. (lambda* (#:key outputs #:allow-other-keys)
  96. (let ((out (assoc-ref outputs "out")))
  97. (for-each
  98. (lambda (name)
  99. (let ((file (string-append out "/bin/" name))
  100. (gi-typelib-path (getenv "GI_TYPELIB_PATH")))
  101. (wrap-program file
  102. `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path)))))
  103. '("remmina" "remmina-file-wrapper")))
  104. #t)))))
  105. (native-inputs
  106. `(("gettext" ,gettext-minimal)
  107. ("glib:bin" ,glib "bin")
  108. ("gobject-introspection" ,gobject-introspection)
  109. ("gtk+:bin" ,gtk+ "bin")
  110. ("intl" ,intltool)
  111. ("pkg-config" ,pkg-config)))
  112. (inputs
  113. `(("app-indicator" ,libappindicator)
  114. ("atk" ,atk)
  115. ("avahi" ,avahi)
  116. ("cairo" ,cairo)
  117. ("cups" ,cups)
  118. ("ffmpeg" ,ffmpeg)
  119. ("freerdp" ,freerdp) ; for rdp plugin
  120. ("gcrypt" ,libgcrypt)
  121. ("gdk-pixbuf" ,gdk-pixbuf+svg)
  122. ("glib" ,glib)
  123. ("gnome-keyring" ,gnome-keyring)
  124. ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
  125. ("gtk+" ,gtk+)
  126. ("harfbuzz" ,harfbuzz)
  127. ("json-glib" ,json-glib)
  128. ("libsecret" ,libsecret) ; for secret plugin
  129. ("libsoup" ,libsoup)
  130. ("libssh" ,libssh) ; for ssh plugin
  131. ("libvnc" ,libvnc) ; for vnc plugin
  132. ("openssl" ,openssl)
  133. ("pango" ,pango)
  134. ("pcre2" ,pcre2) ; for exec plugin
  135. ("shared-mime-info" ,shared-mime-info)
  136. ("sodium" ,libsodium)
  137. ("spice-client-gtk" ,spice-gtk) ; for spice plugin
  138. ("telepathy" ,telepathy-glib)
  139. ("vte" ,vte) ; for st plugin
  140. ("wayland" ,wayland)
  141. ("webkitgtk" ,webkitgtk) ; for www plugin
  142. ("x11" ,libx11)
  143. ("xext" ,libxext) ; for xdmcp plugin
  144. ("xdg-utils" ,xdg-utils)
  145. ("xkbfile" ,libxkbfile))) ; for nx plugin
  146. (propagated-inputs
  147. `(("dconf" ,dconf)))
  148. (home-page "https://remmina.org/")
  149. (synopsis "Remote Desktop Client")
  150. (description "Remmina is a client to use other desktops remotely.
  151. RDP, VNC, SPICE, NX, XDMCP, SSH and EXEC network protocols are supported.")
  152. (license license:gpl2+)))
  153. (define-public tigervnc-client
  154. (package
  155. (name "tigervnc-client")
  156. (version "1.11.0")
  157. (source (origin
  158. (method git-fetch)
  159. (uri
  160. (git-reference
  161. (url "https://github.com/TigerVNC/tigervnc")
  162. (commit (string-append "v" version))))
  163. (sha256
  164. (base32
  165. "1bg79ahr4mzy48ak0caxy3ckdsxmhpchypggaz6lxjjk92hgsz91"))
  166. (file-name (git-file-name name version))))
  167. (build-system cmake-build-system)
  168. (arguments
  169. '(#:tests? #f ; Tests that do exists are not automated.
  170. #:phases (modify-phases %standard-phases
  171. (replace 'install
  172. (lambda* (#:key outputs #:allow-other-keys)
  173. (with-directory-excursion "vncviewer"
  174. (invoke "make" "install")))))))
  175. (native-inputs
  176. `(("autoconf" ,autoconf)
  177. ("gettext-minimal" ,gettext-minimal)
  178. ("automake" ,automake)))
  179. (inputs
  180. `(("zlib" ,zlib)
  181. ("gnutls" ,gnutls)
  182. ("libjpeg-turbo" ,libjpeg-turbo)
  183. ("fltk" ,fltk)
  184. ("linux-pam" ,linux-pam)
  185. ("libx11" ,libx11)
  186. ("libxext" ,libxext)
  187. ("libxtst" ,libxtst)
  188. ("libxrandr" ,libxrandr)
  189. ("libxdamage" ,libxdamage)
  190. ("pixman" ,pixman)))
  191. (home-page "https://tigervnc.org/")
  192. (synopsis "High-performance, platform-neutral
  193. implementation of VNC (client)")
  194. (description "TigerVNC is a client/server implementation of VNC (Virtual
  195. Network Computing). It provides enough performance to run even 3D and video
  196. applications. It also provides extensions for advanced authentication methods
  197. and TLS encryption. This package installs only the VNC client, the
  198. application which is needed to connect to VNC servers.")
  199. (license license:gpl2)))
  200. ;; A VNC server is, in fact, an X server so it seems like a good idea
  201. ;; to build on the work already done for xorg-server package. This is
  202. ;; not entirely compatible with the recommendation in BUILDING.txt
  203. ;; where the client is built first, then the source code of the X
  204. ;; server is copied into a subdir of the build directory, patched with
  205. ;; VNC additions and then build and installed as Xvnc. The procedure
  206. ;; was turned around, where TigerVNC code is downloaded and built
  207. ;; inside the Guix X server build dir. Also, the VNC patching process
  208. ;; for the X server is automated in a straightforward manner.
  209. (define-public tigervnc-server
  210. (package
  211. (inherit xorg-server)
  212. (name "tigervnc-server")
  213. (version (package-version tigervnc-client))
  214. (native-inputs
  215. `(("tigervnc-src" ,(package-source tigervnc-client))
  216. ("autoconf" ,autoconf)
  217. ("automake" ,automake)
  218. ("libtool" ,libtool)
  219. ("gettext-minimal" ,gettext-minimal)
  220. ("font-util" ,font-util)
  221. ("cmake" ,cmake)
  222. ("perl" ,perl)
  223. ,@(package-native-inputs tigervnc-client)
  224. ,@(package-inputs tigervnc-client)
  225. ,@(package-native-inputs xorg-server)))
  226. (inputs
  227. `(("perl" ,perl)
  228. ("coreutils" ,coreutils)
  229. ("xauth" ,xauth)
  230. ,@(package-inputs xorg-server)))
  231. (propagated-inputs
  232. `(("xauth" ,xauth)
  233. ,@(package-propagated-inputs xorg-server)))
  234. (arguments
  235. (substitute-keyword-arguments
  236. (package-arguments xorg-server)
  237. ((#:configure-flags flags)
  238. `(append '("--with-pic" ; Taken from BUILDING.txt
  239. "--without-dtrace"
  240. "--disable-static"
  241. "--disable-dri2"
  242. "--disable-xinerama"
  243. "--disable-xvfb"
  244. "--disable-xnest"
  245. "--disable-xorg"
  246. "--disable-dmx"
  247. "--disable-xwin"
  248. "--disable-xephyr"
  249. "--disable-kdrive"
  250. ;; "--disable-config-dbus" ; This was a warning.
  251. "--disable-config-hal"
  252. "--disable-config-udev"
  253. "--disable-dri2"
  254. ;; "--enable-install-libxf86config" ; This, too, was a warning.
  255. "--enable-glx")
  256. (delete "--enable-xephyr" ,flags)))
  257. ((#:modules modules)
  258. `(append '((ice-9 ftw)
  259. (ice-9 match)
  260. (guix build utils)
  261. (guix build gnu-build-system))
  262. modules))
  263. ((#:phases phases)
  264. `(modify-phases ,phases
  265. (delete 'check) ;)
  266. (add-after 'unpack 'copy-tvnc-xserver
  267. (lambda _
  268. (let*
  269. ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
  270. (tvnc-xserver (string-append tvnc-src "/unix/xserver")))
  271. (copy-recursively tvnc-xserver ".")
  272. #t)))
  273. (add-after 'copy-tvnc-xserver 'patch-xserver
  274. (lambda _
  275. (let*
  276. ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
  277. (xorg-server-version ,(package-version xorg-server))
  278. (which-patch (lambda ()
  279. (let*
  280. ((patch-num (apply string-append
  281. (list-head (string-split xorg-server-version
  282. #\.)
  283. 2)))
  284. (fn (format #f "~a/unix/xserver~a.patch" tvnc-src patch-num)))
  285. (when (not (file-exists? fn))
  286. (error (format #f "Patch file, ~a,
  287. corresponding to the input xorg-server version, does not exist. Installation
  288. will fail. " fn)))
  289. fn))) ; VNC patches for xserver have the
  290. ; form xserverXY[Y].patch, where
  291. ; X.Y[Y].Z is the Xorg server
  292. ; version.
  293. (xserver-patch (which-patch)))
  294. (invoke "patch" "-p1" "-i" xserver-patch)
  295. (invoke "autoreconf" "-fiv"))))
  296. (add-before 'build 'build-tigervnc
  297. (lambda _
  298. (let* ((out (assoc-ref %outputs "out"))
  299. (tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
  300. (tvnc-build (string-append (getcwd) "/tigervnc-build")))
  301. (mkdir-p tvnc-build)
  302. (with-directory-excursion tvnc-build
  303. (invoke "cmake" "-G" "Unix Makefiles"
  304. (string-append "-DCMAKE_INSTALL_PREFIX=" out)
  305. tvnc-src)
  306. (invoke "make" "-j" (number->string (parallel-job-count)))))))
  307. (replace 'build
  308. (lambda _
  309. (let* ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
  310. (tvnc-build (string-append (getcwd) "/tigervnc-build"))
  311. (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
  312. (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
  313. (invoke "make" srcarg buildarg "-j"
  314. (number->string (parallel-job-count))))))
  315. (add-before 'install 'install-tigervnc-aux
  316. (lambda _
  317. (let* ((out (assoc-ref %outputs 'out))
  318. (tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
  319. (tvnc-build (string-append (getcwd) "/tigervnc-build"))
  320. (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
  321. (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
  322. (with-directory-excursion (string-append tvnc-build "/unix")
  323. (invoke "make" srcarg buildarg "install")))))
  324. (replace 'install
  325. (lambda* _
  326. (let* ((tvnc-src (assoc-ref %build-inputs "tigervnc-src"))
  327. (tvnc-build (string-append (getcwd) "/tigervnc-build"))
  328. (srcarg (string-append "TIGERVNC_SRCDIR=" tvnc-src))
  329. (buildarg (string-append "TIGERVNC_BUILDDIR=" tvnc-build)))
  330. (invoke "make" "install" srcarg buildarg))))))))
  331. (description "TigerVNC is a client/server implementation of VNC (Virtual
  332. Network Computing). It provides enough performance to run even 3D and video
  333. applications. It also provides extensions for advanced authentication methods
  334. and TLS encryption. This package installs the VNC server, a program that will
  335. enable users with VNC clients to log into a graphical session on the machine
  336. where the server is installed.")))
  337. (define-public libvnc
  338. (package
  339. (name "libvnc")
  340. (version "0.9.13")
  341. (source
  342. (origin
  343. (method git-fetch)
  344. (uri (git-reference
  345. (url "https://github.com/LibVNC/libvncserver")
  346. (commit (string-append "LibVNCServer-" version))))
  347. (file-name (git-file-name name version))
  348. (sha256
  349. (base32 "0zz0hslw8b1p3crnfy3xnmrljik359h83dpk64s697dqdcrzy141"))))
  350. (build-system cmake-build-system)
  351. (arguments
  352. '(#:phases (modify-phases %standard-phases
  353. (add-after 'unpack 'patch-cc-reference
  354. (lambda _
  355. (substitute* "test/includetest.sh"
  356. (("^cc -I")
  357. "gcc -I"))
  358. #t)))))
  359. (native-inputs
  360. `(("pkg-config" ,pkg-config)))
  361. (inputs
  362. `(("gnutls" ,gnutls)
  363. ("libgcrypt" ,libgcrypt)
  364. ("libjpeg" ,libjpeg-turbo)
  365. ("libpng" ,libpng)
  366. ("lzo" ,lzo)
  367. ("sdl2" ,sdl2)))
  368. (home-page "https://libvnc.github.io/")
  369. (synopsis "Cross-platform C libraries for implementing VNC server or
  370. client")
  371. (description "This package provides @code{LibVNCServer} and
  372. @code{LibVNCClient}. These are cross-platform C libraries that allow you to
  373. easily implement VNC server or client functionality in your program.")
  374. (license ;; GPL for programs, FDL for documentation
  375. (list license:gpl2+ license:fdl1.2+))))