From patchwork Thu Aug 18 21:09:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 41761 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5932B27BBE9; Thu, 18 Aug 2022 22:11:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B8DA227BBEA for ; Thu, 18 Aug 2022 22:11:12 +0100 (BST) Received: from localhost ([::1]:42800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOmnH-0005QL-Qi for patchwork@mira.cbaines.net; Thu, 18 Aug 2022 17:11:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOmn9-0005Q3-4o for guix-patches@gnu.org; Thu, 18 Aug 2022 17:11:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oOmn8-0005rc-Mn for guix-patches@gnu.org; Thu, 18 Aug 2022 17:11:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oOmn8-00026m-Ct for guix-patches@gnu.org; Thu, 18 Aug 2022 17:11:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57288] [PATCH] gnu: Add turbovnc. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 18 Aug 2022 21:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57288 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57288@debbugs.gnu.org Cc: Maxim Cournoyer X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16608570058013 (code B ref -1); Thu, 18 Aug 2022 21:11:02 +0000 Received: (at submit) by debbugs.gnu.org; 18 Aug 2022 21:10:05 +0000 Received: from localhost ([127.0.0.1]:56836 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oOmmC-00025A-3o for submit@debbugs.gnu.org; Thu, 18 Aug 2022 17:10:05 -0400 Received: from lists.gnu.org ([209.51.188.17]:45466) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oOmm6-00024b-T1 for submit@debbugs.gnu.org; Thu, 18 Aug 2022 17:10:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOmm6-0005Fc-O7 for guix-patches@gnu.org; Thu, 18 Aug 2022 17:09:58 -0400 Received: from mail-qv1-xf2c.google.com ([2607:f8b0:4864:20::f2c]:39772) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oOmm2-0005VW-2o for guix-patches@gnu.org; Thu, 18 Aug 2022 17:09:58 -0400 Received: by mail-qv1-xf2c.google.com with SMTP id p5so556191qvz.6 for ; Thu, 18 Aug 2022 14:09:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=9vk0093/XQsh2Y23uCS1Odjf+BnmTyRPrCtG0voe5ig=; b=b5dRmhM5r/bOjCnWTbyHYmmFvE6ftK34UljtwiYiEF7RMDE0VL9MiZlvcIoSZxQaCX p3di82AUfZLLcN8Gu0YM4ADyt/QLUXu13kon37Ex0f0xzNp8hg7QRDKNXMe10AcjbDk4 C8Bei481Ztt1+KlfHU5/5J4HX8RA9POdwGcnKmJC+nZRTQQ7jMWrj2BKR0ZdQTYt5WYS dGmSWMrf5l4iqRiitJuINCQoxW/F0+GCGyhsJpkZ4GJB1gT80WYmu/+jpO5AshfDJZRq +r06pbkVCy1fTVomsTQ+ymWAu+6Rk6538d2MFEUba6MbfsGX6pcAAmgxxg4AImZ8lPI1 jBuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=9vk0093/XQsh2Y23uCS1Odjf+BnmTyRPrCtG0voe5ig=; b=saLz/7AMSlKBuTwOSzYuYcNeDjy15vfu8+3m8EG+UTXd1fVU8aUJCAAcW764TebhRy 1gW+cETIEqCY2sPzmDgk68iY0Cslvgc55jHULRtKOyZ5bJbMmfvzqe/U3KUtuv9tU2Vh /gKylvGup7tN1B7hAYQ2V26Eo91ax9dUdeoc3znlmMHV9ovtXhlpDLo0HIHVZipiiVFQ /l4dHZgi7kof5Ah6wDniI0ndqvaGLDvQKzrFDrOJ4lamqvgZivdFw+XicHuRyTvEYkU7 ECbiqIRYAFns0tfEZ76Qhe0HyZxDSMZUJwva/PAb7+5BpVtPFVqJzbrIkaCfu/EGYX0K liFw== X-Gm-Message-State: ACgBeo0k9K7gamlYahBR9SbQ+jPE4NegzgbnFpbxBYU7KrfbOSoZKKaK +cKJ8Hesa8WRSNjPDnESWuACmNcs2go= X-Google-Smtp-Source: AA6agR5LxWSVBuGSY8a85s1rBwgUV7oLezwT+oUr+piTnIKaaoPq/0UL26o3lQKL6IuwOcxZWRafMQ== X-Received: by 2002:a0c:f303:0:b0:474:80c9:34f8 with SMTP id j3-20020a0cf303000000b0047480c934f8mr4237802qvl.73.1660856992179; Thu, 18 Aug 2022 14:09:52 -0700 (PDT) Received: from localhost.localdomain (dsl-10-149-103.b2b2c.ca. [72.10.149.103]) by smtp.gmail.com with ESMTPSA id 26-20020a05620a079a00b006b8f4ade2c9sm2149443qka.19.2022.08.18.14.09.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 14:09:51 -0700 (PDT) From: Maxim Cournoyer Date: Thu, 18 Aug 2022 17:09:37 -0400 Message-Id: <20220818210937.19275-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f2c; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qv1-xf2c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/vnc.scm (turbovnc): New variable. --- gnu/packages/vnc.scm | 243 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 243 insertions(+) base-commit: ceacf8e32f3671ab598c71e691b580a72af4e16e diff --git a/gnu/packages/vnc.scm b/gnu/packages/vnc.scm index c0fabe848b..f3920e03b0 100644 --- a/gnu/packages/vnc.scm +++ b/gnu/packages/vnc.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2020 Marius Bakke ;;; Copyright © 2020 Vincent Legoll ;;; Copyright © 2021, 2022 Tobias Geerinckx-Rice +;;; Copyright © 2022 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -26,6 +27,7 @@ (define-module (gnu packages vnc) #:use-module (guix download) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix utils) #:use-module (gnu packages) @@ -37,17 +39,22 @@ (define-module (gnu packages vnc) #:use-module (gnu packages crypto) #:use-module (gnu packages cups) #:use-module (gnu packages fltk) + #:use-module (gnu packages fontutils) #:use-module (gnu packages freedesktop) #:use-module (gnu packages gettext) + #:use-module (gnu packages gl) #:use-module (gnu packages glib) #:use-module (gnu packages gnome) #:use-module (gnu packages gnupg) #:use-module (gnu packages gtk) + #:use-module (gnu packages guile) #:use-module (gnu packages image) + #:use-module (gnu packages java) #:use-module (gnu packages linux) #:use-module (gnu packages pcre) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) + #:use-module (gnu packages python) #:use-module (gnu packages rdesktop) #:use-module (gnu packages sdl) #:use-module (gnu packages spice) @@ -318,6 +325,242 @@ (define-public tigervnc-server enable users with VNC clients to log into a graphical session on the machine where the server is installed."))) +(define-public turbovnc + (package + (name "turbovnc") + (version "3.0.1") + (source + (origin + (method url-fetch) + (uri (string-append "mirror://sourceforge/turbovnc/" version + "/turbovnc-" version ".tar.gz")) + (modules '((guix build utils) + (ice-9 ftw) + (srfi srfi-26))) + (snippet + #~(begin + ;; TODO: Unbundle jsch and jzlib, bundled under java/com/jcraft/ as + ;; well as mindrot and spf4j, bundled under java/org. These are + ;; used by the 'vncviewer' program. + (define (directory? x) + (and=> (stat x #f) (compose (cut eq? 'directory <>) stat:type))) + + (define (delete-all-but directory . preserve) + (with-directory-excursion directory + (let* ((pred (negate (cut member <> (append '("." "..") + preserve)))) + (items (scandir "." pred))) + (for-each (lambda (item) + (if (directory? item) + (delete-file-recursively item) + (delete-file item))) + items)))) + + ;; d3des, rfb (headers) and turbojpeg-jni are preserved, since they + ;; are not packaged and fairly small. + (delete-all-but "common" "d3des" "rfb" "turbojpeg-jni") + ;; Delete bundled headers which aren't used. + (delete-all-but "unix/Xvnc/include" "tvnc_version.h.in") + ;; This 243 lines of code C library is used by + ;; unix/Xvnc/programs/Xserver/os/xsha1.c. + (delete-all-but "unix/Xvnc/lib" "CMakeLists.txt" "libsha1") + (delete-file-recursively "unix/Xvnc/extras"))) + (sha256 + (base32 + "182amp471qvr2cn2rbw97zpbkh9q7mf92w1r25cg4apx5k26m7c3")))) + (build-system cmake-build-system) + (arguments + (list + #:tests? #f ;no test suite + #:configure-flags + ;; Use system libraries. + #~(list "-DTVNC_SYSTEMLIBS=1" + "-DTVNC_SYSTEMX11=1" + "-DTVNC_DLOPENSSL=0" + (string-append "-DDRI_DRIVER_PATH=" + (search-input-directory %build-inputs "lib/dri")) + (string-append "-DXKB_BASE_DIRECTORY=" + (search-input-directory %build-inputs + "share/X11/xkb")) + ;; Help the build system to find the system pixman headers. + (string-append "-DCMAKE_C_FLAGS=-I" + (search-input-directory %build-inputs + "include/pixman-1"))) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-build-system + (lambda* (#:key inputs #:allow-other-keys) + ;; The build system wrongly assumes that the Xfont2, fontenc and + ;; pixman-1 libraries are installed in the same prefix as + ;; libx11. + (substitute* "unix/Xvnc/CMakeLists.txt" + (("string\\(REGEX REPLACE.*X11_Xfont2_LIB.*") + (format #f "set(X11_Xfont2_LIB ~a)~%" + (search-input-file inputs "lib/libXfont2.so"))) + (("string\\(REGEX REPLACE.*X11_Fontenc_LIB.*") + (format #f "set(X11_Fontenc_LIB ~a)~%" + (search-input-file inputs "lib/libfontenc.so"))) + (("string\\(REGEX REPLACE.*X11_Pixman_LIB.*") + (format #f "set(X11_Pixman_LIB ~a)~%" + (search-input-file inputs "lib/libpixman-1.so")))) + (substitute* "unix/Xvnc/programs/Xserver/CMakeLists.txt" + ;; The default rule file name must have changed from 'xorg' to + ;; 'base' for xkeyboard-config. Without this change, running + ;; Xvnc would fail with the error "XKB: Failed to compile + ;; keymap" + (("set\\(DEFAULT_XKB_DFLT_RULES.*)") + "set(DEFAULT_XKB_DFLT_RULES \"base\")") + ;; XXX: This somehow overrides the user-specified + ;; XKB_BASE_DIRECTORY. + (("set\\(DEFAULT_XKB_BASE_DIRECTORY .*)") + (format #f "set(DEFAULT_XKB_BASE_DIRECTORY \"~a\")" + (search-input-directory inputs "share/X11/xkb"))) + (("set\\(DEFAULT_XKB_BIN_DIRECTORY .*)") + (format #f "set(DEFAULT_XKB_BIN_DIRECTORY \"~a\")" + (dirname (search-input-file inputs + "bin/xkbcomp"))))) + (substitute* "unix/Xvnc/programs/Xserver/dix/CMakeLists.txt" + ;; This is needed, otherwise the same error as above would + ;; occur. Mimic xorg-server's "--with-xkb-output=/tmp" + ;; configuration. + (("-DCOMPILEDDEFAULTFONTPATH=\".*\"") + "-DCOMPILEDDEFAULTFONTPATH=/tmp")))) + (add-after 'unpack 'patch-vncviewer + (lambda* (#:key inputs #:allow-other-keys) + (define openjdk #$(this-package-input "openjdk")) + (substitute* "unix/vncviewer/vncviewer.in" + (("\\$BINDIR/../java/jre") + openjdk) + ;; Avoid resorting to grep and sed to locate libjawt.so. + (("^_TMP=.*") + (string-append "_TMP=" openjdk "/lib\n"))))) + (add-after 'unpack 'patch-vncserver + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "unix/vncserver.in" + ;; Add sane Guix System default locations for X11 fonts. + (("'/usr/share/X11/fonts'" all) + (format #f "'~a', '~a', ~a" + "/run/current-system/profile/share/fonts/X11" + (string-append #$(this-package-input "font-alias") + "share/fonts/X11") + all)) + ;; Add sane Guix System default locations for XKB layouts. + ;; Note: the directory must be appended to the list, as the + ;; last one to be searched wins. + (("'/opt/X11/share/X11/xkb'" all) + (format #f "~a, '~a/share/X11/xkb', '~a'" + all #$(this-package-input "xkeyboard-config") + "/run/current-system/profile/share/X11/xkb")) + ;; Likewise for the xkbcompdirs. + (("'/opt/X11/bin'" all) + (format #f "~a, '~a'" all + (dirname (search-input-file inputs "bin/xkbcomp")))) + ;; Likewise for dridirs. + (("push\\(@dridirs, '/usr/local/lib/dri').*" all) + (format #f "~apush(@dridirs, '~a');~%" all + (dirname (search-input-file + inputs "lib/dri/swrast_dri.so")))) + ;; Likewise for registrydirs. + (("push\\(@registrydirs, '/opt/X11/lib/xorg').*" all) + (format #f "~apush(@registrydirs, '~a');~%" all + (dirname (search-input-file + inputs "lib/xorg/protocol.txt"))))))) + (add-after 'unpack 'patch-xstartup.turbovnc + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "unix/xstartup.turbovnc" + (("DBUS_LAUNCH=[[:graph:]]+") + (format #f "DBUS_LAUNCH=~a" + (search-input-file inputs "bin/dbus-launch"))) + (("XSESSIONSDIR=[[:graph:]]+") + (format #f "XSESSIONSDIR=~a" + "/run/current-system/profile/share/xsessions")) + (("GREP=[[:graph:]]+") + (format #f "GREP=~a" + (search-input-file inputs "bin/grep"))) + (("SED=[[:graph:]]+") + (format #f "SED=~a" + (search-input-file inputs "bin/sed"))) + ;; There's no /etc/X11/xinit/Xsession file on Guix System, so + ;; attempt a better guess. + (("XSESSION=[[:graph:]]+") + "XSESSION=$HOME/.xsession") + (("TVNC_SSHAGENT=[[:graph:]]+") + (format #f "TVNC_SSHAGENT=~a" + (search-input-file inputs "bin/ssh-agent"))) + (("TVNC_VGLRUN=\"vglrun" all) + (string-append "TVNC_VGLRUN=" + (search-input-file inputs "bin/vglrun") all))))) + (add-after 'install 'wrap-vncserver + (lambda* (#:key inputs outputs #:allow-other-keys) + (wrap-script (search-input-file outputs "bin/vncserver") + (list "PATH" 'prefix + (map (lambda (p) + (dirname (search-input-file inputs p))) + '("bin/uname" ;coreutils + "bin/xauth" + "bin/xdpyinfo")))))) + (add-after 'install 'wrap-xstartup.turbovnc + (lambda* (#:key inputs outputs #:allow-other-keys) + (wrap-script (search-input-file outputs "bin/xstartup.turbovnc") + (list "PATH" 'prefix + (map (lambda (p) + (dirname (search-input-file inputs p))) + '("bin/uname" ;coreutils + ;; These are used as the fallback when no desktop + ;; session was found. + "bin/twm" + "bin/xsetroot" + "bin/xterm"))))))))) + (native-inputs (list `(,openjdk "jdk") python)) + (inputs + (list dbus + font-alias + freetype + guile-3.0 + libfontenc + libjpeg-turbo + libx11 + libxdamage + libxext + libxfont2 + libxi + libxkbfile + linux-pam + mesa + openjdk + openssh + openssl + perl + pixman + twm + virtualgl + xauth + xdpyinfo + xkbcomp + xkeyboard-config + xorg-server + xorgproto + xsetroot + xterm + xtrans + zlib)) + (home-page "https://turbovnc.org/") + (synopsis "TightVNC-compatible remote desktop software") + (description "TurboVNC is a high-speed version of VNC derived from +TightVNC. It contains a variant of Tight encoding that is tuned to maximize +performance for image-intensive applications (such as VirtualGL, video +applications, and image editors) while still providing excellent performance +for other types of applications. Some of its unique features are: +@itemize +@item a user-facing @command{vncserver} command; +@item the ability to capture keyboard keys even when not in full screen mode; +@item a full screen mode that is compatible with ratpoison* +@end itemize +*Although due to a quirk in Java, you'll want to set the +@env{_JAVA_AWT_WM_NONREPARENTING} environment variable when using it with +ratpoison.") + (license license:gpl2+))) + (define-public libvnc (package (name "libvnc")