Subject: Re: [bug#67257] [PATCH v2 2/2] gnu: Add x2goclient.

From: Maxim Cournoyer <[email-masked]>
Date: Sat, 09 Mar 2024 19:45:27 -0500

Hi,

Ludovic Courtès <[email-masked]> writes:

> Steve George <[email-masked]> skribis:
>
>> From: nicodebo <[email-masked]>
>>
>> * gnu/packages/nx.scm (x2goclient): New variable.
>>
>> Reviewed-by: Steve George <[email-masked]>
>>
>> Change-Id: Ib0ff6328ede3fb4a0b48462ac1a003438c53c862
>
> [...]
>
>> +                        (substitute* "src/onmainwindow.cpp"
>> +                          (("/usr/sbin/sshd")
>> +                           (which "sshd"))))))
>
> Rather use ‘search-input-file’ here, as mentioned in my other message.

Done.

>> +    (native-inputs (list pkg-config
>> +                         qttools-5
>> +                         qtbase-5
>> +                         qtx11extras
>> +                         qtsvg-5
>> +                         libssh
>> +                         cups
>> +                         libxpm
>> +                         openldap
>> +                         gcc-toolchain))
>
> You can omit ‘gcc-toolchain’.  Most likely, everything but ‘pkg-config’
> and ‘qttools-5’ shold be in ‘inputs’ rather than ‘native-inputs’.

Done.

>> +    (propagated-inputs (list nx-libs
>> +                             openssh))
>
> Don’t propagate OpenSSH: it should be up to the user to install it if
> they want it, to avoid being too intrusive.

I've moved it to inputs; its sshd command is substituted in a phase.

> ‘nx-libs’ probably doesn’t need to be propagated either and can be in
> ‘inputs’, no?

Agreed.

Here's the diff I've now applied:

--8<---------------cut here---------------start------------->8---
modified   gnu/packages/nx.scm
@@ -35,6 +35,7 @@ (define-module (gnu packages nx)
   #:use-module (gnu packages patchutils)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages ssh)
@@ -172,61 +173,72 @@ (define-public x2goclient
         (base32 "0g6aba8kpsixq4486a8mga945lp31y0mzwa2krs5qqiiip3v72xb"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:tests? #f ; there aren't any tests
-       #:phases (modify-phases %standard-phases
-                  (delete 'configure)
-                  (add-before 'build 'fix-makefile
-                    (lambda* (#:key outputs #:allow-other-keys)
-                      (let* ((out (assoc-ref outputs "out"))
-                             (etc (string-append out "/etc")))
-                        (mkdir-p etc)
-                        (substitute* "Makefile"
-                          (("= 4")
-                           "= 5") ;use qt5 instead of qt4
-                          (("-o root -g root") ;from archlinux
-                           "")
-                          (("/usr/local")
-                           out)
-                          (("/etc/x2go")
-                           etc)
-                          ;; Workaround to turn off invoking lrelease because
-                          ;; it fails with a warning about qmake spec
-                          (("lrelease")
-                           "true")
-                          (("qmake")
-                           (which "qmake")))
-                        (substitute* "src/onmainwindow.cpp"
-                          (("/usr/sbin/sshd")
-                           (which "sshd"))))))
-                  ;; Avoid man2html by calling build_client then install_man
-                  (replace 'build
-                    (lambda _
-                      (invoke "make" "build_client")))
-                  (add-after 'build 'build-man
-                    (lambda _
-                      (invoke "make" "install_man")))
-                  ;; Due to lrelease workaround above: run lrelease on each
-                  ;; individual .ts file
-                  (add-after 'build 'compile-ts-files
-                    (lambda _
-                      (for-each (lambda (file)
-                                  (invoke "lrelease" file))
-                                (find-files "./" "\\.ts$")))))))
-    (native-inputs (list pkg-config
-                         qttools-5
-                         qtbase-5
-                         qtx11extras
-                         qtsvg-5
-                         libssh
-                         cups
-                         libxpm
-                         openldap
-                         gcc-toolchain))
-    (propagated-inputs (list nx-libs
-                             openssh))
+     (list
+      #:tests? #f                       ;no test suite
+      #:make-flags
+      #~(list (string-append "SHELL="
+                             (search-input-file %build-inputs "bin/bash"))
+              "QT_VERSION=5"
+              "INSTALL_DIR=install -d -m 755"
+              "INSTALL_FILE=install -m 644"
+              "INSTALL_PROGRAM=install -m 755"
+              (string-append "PREFIX=" #$output)
+              (string-append "ETCDIR=" #$output "/etc"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'configure)
+          (add-before 'build 'patch-paths
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "src/onmainwindow.cpp"
+                (("/usr/sbin/sshd")
+                 (search-input-file inputs "sbin/sshd"))))))))
+    (native-inputs
+     (list man2html
+           pkg-config
+           qtbase-5
+           qttools-5))
+    (inputs
+     (list cups
+           libssh
+           libxpm
+           nx-libs
+           openldap
+           openssh
+           pulseaudio
+           qtbase-5
+           qtx11extras
+           qtsvg-5))
     (synopsis "Remote desktop and application solution")
     (description
-     "X2goclient allows you to connect to a remote graphical desktop over the
-network through SSH.")
-    (home-page "http://x2go.org/")
+     "X2Go enables you to access a graphical desktop of a computer via
+SSH (Secure Shell).  This package provides the X2Go Client, which can connect
+to the X2Go Server.  Basic features of X2Go include:
+@itemize
+@item
+Graphical remote desktop that works well over both low bandwidth and high
+bandwidth connections
+@item
+The ability to disconnect and reconnect to a session, even from another
+client
+@item
+Support for sound
+@item
+Support for as many simultaneous users as the computer's resources will
+allow
+@item
+Traffic is securely tunneled over SSH
+@item
+File sharing from client to server
+@item
+Printer sharing from client to server
+@item
+Easily select from multiple desktop environments (e.g., MATE, GNOME, KDE)
+@item
+Remote support possible via desktop sharing
+@item
+The ability to access single applications by specifying the name of the
+desired executable in the client configuration or selecting one of the
+pre-defined common applications.
+@end itemize")
+    (home-page "https://wiki.x2go.org/doku.php")
     (license license:gpl2)))
--8<---------------cut here---------------end--------------->8---

Some changes:

1. Use gexps.
2. Use https home-page.
3. Expand description.
4. Add pulseaudio
5. Use make flags instead of modifying the build system
6. Add pulseaudio to inputs
7. Remove workarounds for lrelease; the qttools package is now fixed to
avoid this problem

I think that's it!

Now all that's left is to add x2goserver and an accompanying system
service :-).

-- 
Thanks,
Maxim