From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QFFbJ+Mz/2L8XAEAbAwnHQ (envelope-from ) for ; Fri, 19 Aug 2022 08:55:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id OMljJ+Mz/2KkKQEA9RJhRA (envelope-from ) for ; Fri, 19 Aug 2022 08:55:31 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 66650361FC for ; Fri, 19 Aug 2022 08:55:31 +0200 (CEST) Received: from localhost ([::1]:39142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOvuk-0008KS-Ih for larch@yhetil.org; Fri, 19 Aug 2022 02:55:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOvuK-0008Jp-Vk for guix-patches@gnu.org; Fri, 19 Aug 2022 02:55:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oOvuI-0007OM-VE for guix-patches@gnu.org; Fri, 19 Aug 2022 02:55:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oOvuI-0002YA-HP for guix-patches@gnu.org; Fri, 19 Aug 2022 02:55:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57288] [PATCH v2] gnu: Add turbovnc. References: <20220818210937.19275-1-maxim.cournoyer@gmail.com> In-Reply-To: <20220818210937.19275-1-maxim.cournoyer@gmail.com> Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 19 Aug 2022 06:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57288 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57288@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 57288-submit@debbugs.gnu.org id=B57288.16608920649741 (code B ref 57288); Fri, 19 Aug 2022 06:55:02 +0000 Received: (at 57288) by debbugs.gnu.org; 19 Aug 2022 06:54:24 +0000 Received: from localhost ([127.0.0.1]:57270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oOvtf-0002X1-5o for submit@debbugs.gnu.org; Fri, 19 Aug 2022 02:54:23 -0400 Received: from mail-qv1-f49.google.com ([209.85.219.49]:37508) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oOvta-0002Wg-SJ for 57288@debbugs.gnu.org; Fri, 19 Aug 2022 02:54:21 -0400 Received: by mail-qv1-f49.google.com with SMTP id mz1so2779376qvb.4 for <57288@debbugs.gnu.org>; Thu, 18 Aug 2022 23:54:18 -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=FhT381RWazebt8MISkbVBJeButuyLo0A4i5IPZGdkrY=; b=GbEmgEhvgvgweQGhraMLe08k1nRIroQMyAqe193ATwGpt2Y+YAbv88AaDJndT9gkhJ J1bNG9h5I83osr28XZef3s8hi6sWy40AIKpAKaeaQzG0cYap3takaMOU541ULxv8ytpy AJqER7/WwsIfpo0PMeq8bUHQWf7awsb0q6LG8Onw8Goec2JZ7tRcFgDG7E4RDf/L5zuh M5v/euT9XjYmsd5hrNmV4J8YTLP3XFLmMvQtL1kkJOcn/eC9PnMSKt2zCrMTzeOcIpyV Ft+S51PFb/JeN9iYEy+HJR1/YHeNW9e7/GpDrTK7NKnbrZ1NqkIYifZFh73d4sVS/QQV +hWg== 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=FhT381RWazebt8MISkbVBJeButuyLo0A4i5IPZGdkrY=; b=JI5eKvXEm32zdrh1nJADqDBgpVFxIzmRza+uh6HZF6UK4baUpDE/j2Yy7D9DKbD/mh diZ3cXuTauB4QFNBi1G0KWcF+bUVccseLqJv9i/iq9gZUn1NeiEjaASnUmzycGeZ3hw/ 0RPwldTgaTU5y71jOhoqNCeHN9QPd3obQNXWN9hWcuXbd/xlhd1z6QjrYlnjgVlYhPxj i8LvmC8BltAveKDSZybwiVwhfZVuY5ohYqL2zWRcPRPxFGSvaB1iLhz4ZlJO5uZvUCpK UGz4UR3byjOanAB59tcWEmD4iealTl/90kqln7XGF65Ildz8b8ohGOXh/uZyH7NmAcsL FzHA== X-Gm-Message-State: ACgBeo3QLRr7o8JIt9ImdUUs5aGXSPkWjzLR8XUl7VdZaV/88zKS7TUU H9RZ6GVIqixpyOZBFsliaXt5nf7gSHU= X-Google-Smtp-Source: AA6agR4gHQ797BbAGbr6i0bcf1aUD/xic5hiqapiRa2wntCGrPWHV9QSYa+I3OJMYKsix2CA4PjWsw== X-Received: by 2002:a05:6214:ccd:b0:496:c459:291b with SMTP id 13-20020a0562140ccd00b00496c459291bmr1527507qvx.109.1660892052335; Thu, 18 Aug 2022 23:54:12 -0700 (PDT) Received: from localhost.localdomain (dsl-10-149-103.b2b2c.ca. [72.10.149.103]) by smtp.gmail.com with ESMTPSA id ga10-20020a05622a590a00b003430589dd34sm2553626qtb.57.2022.08.18.23.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 23:54:11 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 19 Aug 2022 02:54:06 -0400 Message-Id: <20220819065406.27088-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1660892131; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=FhT381RWazebt8MISkbVBJeButuyLo0A4i5IPZGdkrY=; b=aObnn4TB1BunbWs9DAcrwb8ghMyKrni8X+0+tbp75OLBqLYr6RS/Iv8oSPPvJWTKWFIzW7 sscl/ke31q65JmIocz7gKOM3tXBwXd7LnDDXVavC1mlVSV+xyTENEDBLRFp06GQejbCLco aHtSRu7uuO84pdpHXTdMfm01W7Jz9lRby9q8nFHYQ1AOO+saNkx4wInb6dU/QNQWNkByD9 uu0gPaJFpRFZKuaoP3t2ZSD1QS35+N7BF849+adnB0/xppsHuZmys1Zlng4OjOYMWkFFZA ekwSwV+Lv7QHVsDKxQB3X4HCRdXCM1kO4lrBh0uNre3Fsm0kDzQmxE7umM8B1g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1660892131; a=rsa-sha256; cv=none; b=Au8n7jxUEBB4Iuk8INbsR04XDMA3r2+gVWK1jzJ21p9Clem8PLJhASoMQnkGtVkQkT1X3r W6M/n5Pjqy4QoOqA/giUeeF9ASIPV/jSjN2l9MfJpBbtpszZ7+L6K1RFITx4qAWvE2Z8BG 1gqPIHW7hdbLadOabJCl71ocmVHg3LDG+1X0YMW8OM7GlabZ2wbBb4TWvT5DIf906RtBRv 0Yck+8zBK+EzPSIrxzScLWahJY+6bBgm8pSvHMgVWTcCQCPR/qioAVYu7Y+HWBb13peWK4 r61LWkA1eGU4pqmcZCznDABE0/6BONcS4O/3VvuvyL9s6ixMThtw+E4czywM/w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=GbEmgEhv; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 5.35 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=GbEmgEhv; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 66650361FC X-Spam-Score: 5.35 X-Migadu-Scanner: scn0.migadu.com X-TUID: gMrOdCfwStTb * gnu/packages/vnc.scm (turbovnc): New variable. --- gnu/packages/vnc.scm | 241 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 241 insertions(+) diff --git a/gnu/packages/vnc.scm b/gnu/packages/vnc.scm index c0fabe848b..668bdb2134 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,240 @@ (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 + ;; There are a few bundled Java libraries, such as 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. The jsch copy is modified and integrates changes from + ;; https://github.com/mwiede/jsch. + (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")) + ;; The default rule is 'xorg', which doesn't match the 'base' + ;; rule file installed by our version of xkeyboard-config. + ;; Without this change, running Xvnc would fail with the error + ;; "XKB: Failed to compile keymap" + "-DXKB_DFLT_RULES=base" + (string-append "-DXKB_BIN_DIRECTORY=" + (dirname (search-input-file %build-inputs + "bin/xkbcomp"))) + ;; Help the build system to find the system pixman headers. + (string-append "-DCMAKE_C_FLAGS=-I" + (search-input-directory %build-inputs + "include/pixman-1")) + (string-append "-DSERVER_MISC_CONFIG_PATH=" + (dirname (search-input-file + %build-inputs "lib/xorg/protocol.txt")))) + #: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/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)) + ;; Likewise 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 "Highly-optimized VNC remote desktop software") + (description "TurboVNC is a high-speed version of VNC derived from +TightVNC, with which it remains compatible. 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") -- 2.36.1