[bug#75966,v2,1/2] gnu: qtwebengine: Fix default path for QtWebEngineProcess.

Message ID 64b2f94cf05195646d5076df6bd67a8538001e00.1738382284.git.iyzsong@member.fsf.org
State New
Headers
Series [bug#75966,v2,1/2] gnu: qtwebengine: Fix default path for QtWebEngineProcess. |

Commit Message

vasilii.smirnov--- via Guix-patches" via Feb. 1, 2025, 3:58 a.m. UTC
  From: 宋文武 <iyzsong@member.fsf.org>

Since qtwebengine and qtbase are not installed into the same prefix,
the default path for QtWebEngineProcess won't work.  Fix it so that
we no longer need to set QTWEBENGINEPROCESS_PATH anymore.

* gnu/packages/qt.scm (qtwebengine-5, qtwebengine)[arguments]:
Substitute 'QLibraryInfo::LibraryExecutablesPath' in 'substitute-source phase.
[native-search-paths]: Remove QTWEBENGINEPROCESS_PATH.
* gnu/packages/ebook.scm (calibre)
* gnu/packages/education.scm (anki)
* gnu/packages/kde-internet.scm (falkon)
* gnu/packages/kde-systemtools.scm (khelpcenter)
* gnu/packages/kde.scm (akregator)
* gnu/packages/video.scm (openshot)
* gnu/packages/vpn.scm (openconnect-sso)
* gnu/packages/web-browsers.scm (qutebrowser)
* gnu/packages/web.scm (kiwix-desktop): Remove wrapper for QTWEBENGINEPROCESS_PATH.

Change-Id: I43745969ce80daa0f077da37671d1b44a468c953
---
 gnu/packages/ebook.scm           | 21 +--------------------
 gnu/packages/education.scm       | 13 +++----------
 gnu/packages/kde-internet.scm    | 13 -------------
 gnu/packages/kde-systemtools.scm | 10 +---------
 gnu/packages/kde.scm             | 13 +------------
 gnu/packages/qt.scm              | 22 ++++++++--------------
 gnu/packages/video.scm           | 14 +-------------
 gnu/packages/vpn.scm             | 12 +-----------
 gnu/packages/web-browsers.scm    | 10 ++--------
 gnu/packages/web.scm             | 10 +---------
 10 files changed, 19 insertions(+), 119 deletions(-)


base-commit: d48da2d21610f9cf5f76cd846703b12beedb1fd5
  

Comments

Maxim Cournoyer Feb. 1, 2025, 2:44 p.m. UTC | #1
Hello,

iyzsong@envs.net writes:

> From: 宋文武 <iyzsong@member.fsf.org>
>
> Since qtwebengine and qtbase are not installed into the same prefix,
> the default path for QtWebEngineProcess won't work.  Fix it so that
> we no longer need to set QTWEBENGINEPROCESS_PATH anymore.
>
> * gnu/packages/qt.scm (qtwebengine-5, qtwebengine)[arguments]:
> Substitute 'QLibraryInfo::LibraryExecutablesPath' in 'substitute-source phase.
> [native-search-paths]: Remove QTWEBENGINEPROCESS_PATH.
> * gnu/packages/ebook.scm (calibre)
> * gnu/packages/education.scm (anki)
> * gnu/packages/kde-internet.scm (falkon)
> * gnu/packages/kde-systemtools.scm (khelpcenter)
> * gnu/packages/kde.scm (akregator)
> * gnu/packages/video.scm (openshot)
> * gnu/packages/vpn.scm (openconnect-sso)
> * gnu/packages/web-browsers.scm (qutebrowser)
> * gnu/packages/web.scm (kiwix-desktop): Remove wrapper for QTWEBENGINEPROCESS_PATH.

I think it'd be a bit clearer to introduce the change to qt/qt-utils in
a same commit, and then proceed to remove the wrappers in one commit per
package, since it doesn't break anything to do it this way and it
matches our usual 1 package per commit change convention.

Would you mind to split you series this way?  Or if it's too much work,
at least extract the core qt change as a prerequisite commit, and the
adjustment of the packages as a 2nd commit on top of it.
  
宋文武 Feb. 2, 2025, 4:36 a.m. UTC | #2
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> I think it'd be a bit clearer to introduce the change to qt/qt-utils in
> a same commit, and then proceed to remove the wrappers in one commit per
> package.

Done and sent as v3, thanks.
  

Patch

diff --git a/gnu/packages/ebook.scm b/gnu/packages/ebook.scm
index 0cd2b31724..73fea2f66a 100644
--- a/gnu/packages/ebook.scm
+++ b/gnu/packages/ebook.scm
@@ -320,26 +320,7 @@  (define-public calibre
                      (string-append #$(this-package-input "font-liberation")
                                     "/share/fonts/truetype")))
                 (delete-file-recursively font-dest)
-                (symlink font-src font-dest))))
-          ;; Make run-time dependencies available to the binaries.
-          (add-after 'wrap 'wrap-program
-            (lambda* (#:key inputs #:allow-other-keys)
-              (with-directory-excursion (string-append #$output "/bin")
-                (for-each
-                 (lambda (binary)
-                   (wrap-program binary
-                     ;; Make QtWebEngineProcess available.
-                     `("QTWEBENGINEPROCESS_PATH" =
-                       ,(list
-                         (search-input-file
-                          inputs "/lib/qt5/libexec/QtWebEngineProcess")))))
-                 ;; Wrap all the binaries shipping with the package, except
-                 ;; for the wrappings created during the 'wrap standard
-                 ;; phase.  This extends existing .calibre-real wrappers
-                 ;; rather than create ..calibre-real-real-s.  For more
-                 ;; information see: https://issues.guix.gnu.org/43249.
-                 (find-files "." (lambda (file stat)
-                                   (not (wrapped-program? file)))))))))))
+                (symlink font-src font-dest)))))))
     (home-page "https://calibre-ebook.com/")
     (synopsis "E-book library management software")
     (description "Calibre is an e-book library manager.  It can view, convert
diff --git a/gnu/packages/education.scm b/gnu/packages/education.scm
index f42a216972..f0c0e931bf 100644
--- a/gnu/packages/education.scm
+++ b/gnu/packages/education.scm
@@ -836,18 +836,11 @@  (define-public anki
                          (filter (match-lambda
                                    ((label . _)
                                     (string-prefix? "python-" label)))
-                                 inputs)))
-                   (qtwebengineprocess
-                    (search-input-file inputs
-                                       "lib/qt5/libexec/QtWebEngineProcess")))
-               ;; The program fails to find the QtWebEngineProcess program, so
-               ;; we set QTWEBENGINEPROCESS_PATH to help it.  PYTHONPATH is
-               ;; wrapped to avoid declaring Python libraries as propagated
-               ;; inputs.
+                                 inputs))))
+               ;; PYTHONPATH is wrapped to avoid declaring Python libraries as
+               ;; propagated inputs.
                (for-each (lambda (program)
                            (wrap-program program
-                             `("QTWEBENGINEPROCESS_PATH" =
-                               (,qtwebengineprocess))
                              `("PATH" prefix (,(string-append
                                                 (assoc-ref inputs "mpv")
                                                 "/bin")))
diff --git a/gnu/packages/kde-internet.scm b/gnu/packages/kde-internet.scm
index 4bf40afe88..d54126ed12 100644
--- a/gnu/packages/kde-internet.scm
+++ b/gnu/packages/kde-internet.scm
@@ -130,19 +130,6 @@  (define-public falkon
         (base32
          "0j930i2nvg71p05z881inbk59c54gx8dzhyjb8iaqkw8i5s5r983"))))
     (build-system qt-build-system)
-    (arguments
-     (list #:phases
-           #~(modify-phases %standard-phases
-               (add-after 'install 'wrap
-                 (lambda* (#:key inputs outputs #:allow-other-keys)
-                   (let ((qtwebengineprocess
-                          (search-input-file inputs
-                                             "lib/qt6/libexec/QtWebEngineProcess")))
-                     ;; The program fails to find the QtWebEngineProcess program, so
-                     ;; we set QTWEBENGINEPROCESS_PATH to help it.
-                     (wrap-program (string-append #$output "/bin/falkon")
-                       `("QTWEBENGINEPROCESS_PATH" =
-                         (,qtwebengineprocess)))))))))
     (native-inputs
      (list extra-cmake-modules pkg-config qttools))
     (inputs
diff --git a/gnu/packages/kde-systemtools.scm b/gnu/packages/kde-systemtools.scm
index 4923854a7c..a86b550a7f 100644
--- a/gnu/packages/kde-systemtools.scm
+++ b/gnu/packages/kde-systemtools.scm
@@ -178,15 +178,7 @@  (define-public khelpcenter
     PrintSupport")
                      (("Qt6::WebEngineWidgets")
                       "Qt6::PrintSupport
-    Qt6::WebEngineWidgets"))))
-               (add-after 'install 'wrap-executable
-                 (lambda* (#:key inputs #:allow-other-keys)
-                   (wrap-program (string-append #$output
-                                                "/bin/khelpcenter")
-                     `("QTWEBENGINEPROCESS_PATH" =
-                       (,(search-input-file
-                          inputs
-                          "lib/qt6/libexec/QtWebEngineProcess")))))))))
+    Qt6::WebEngineWidgets")))))))
     (home-page "https://apps.kde.org/khelpcenter/")
     (synopsis "KDE documentation viewer")
     (description "KHelpCenter uses meta data files which describe the
diff --git a/gnu/packages/kde.scm b/gnu/packages/kde.scm
index 765176f42b..9a4115eda6 100644
--- a/gnu/packages/kde.scm
+++ b/gnu/packages/kde.scm
@@ -205,18 +205,7 @@  (define-public akregator
         (base32 "07flc3617px9w1c729p0lsixf1g0h297hkbip259ykkbwxizn71q"))))
     (build-system qt-build-system)
     (arguments
-     (list #:qtbase qtbase
-           #:phases
-           #~(modify-phases %standard-phases
-             (add-after 'install 'wrap-qt-process-path
-               (lambda* (#:key inputs outputs #:allow-other-keys)
-                 (let* ((out (assoc-ref outputs "out"))
-                        (bin (string-append out "/bin/akregator"))
-                        (qt-process-path
-                         (search-input-file
-                          inputs "/lib/qt6/libexec/QtWebEngineProcess")))
-                   (wrap-program bin
-                     `("QTWEBENGINEPROCESS_PATH" = (,qt-process-path)))))))))
+     (list #:qtbase qtbase))
     (native-inputs
      (list extra-cmake-modules kdoctools))
     (inputs
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 76c11af543..c29f8e14e7 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -3415,7 +3415,10 @@  (define-public qtwebengine-5
                                   "/share/qt5/translations\")"))
                   (("QLibraryInfo::location\\(QLibraryInfo::DataPath\\)")
                    (string-append "QLatin1String(\"" #$output
-                                  "/share/qt5\")")))
+                                  "/share/qt5\")"))
+                  (("QLibraryInfo::location\\(QLibraryInfo::LibraryExecutablesPath)")
+                   (string-append "QLatin1String(\"" #$output
+                                  "/lib/qt5/libexec\")")))
                 ;; Substitute full dynamic library path for nss.
                 (substitute* "src/3rdparty/chromium/crypto/nss_util.cc"
                   (("libnssckbi.so")
@@ -3453,12 +3456,6 @@  (define-public qtwebengine-5
        ;; It's possible this can be fixed by setting QTWEBENGINEPROCESS_PATH
        ;; before running tests.
        ((#:tests? _ #f) #f)))
-    (native-search-paths
-     (list (search-path-specification
-            (file-type 'regular)
-            (separator #f)
-            (variable "QTWEBENGINEPROCESS_PATH")
-            (files '("lib/qt5/libexec/QtWebEngineProcess")))))
     (home-page "https://wiki.qt.io/QtWebEngine")
     (synopsis "Qt WebEngine module")
     (description "The Qt5WebEngine module provides support for web applications
@@ -3824,7 +3821,10 @@  (define-public qtwebengine
                                 "/share/qt6/translations\")"))
                 (("QLibraryInfo::path\\(QLibraryInfo::DataPath)")
                  (string-append "QLatin1String(\"" #$output
-                                "/share/qt6\")")))
+                                "/share/qt6\")"))
+                (("QLibraryInfo::path\\(QLibraryInfo::LibraryExecutablesPath)")
+                 (string-append "QLatin1String(\"" #$output
+                                "/lib/qt6/libexec\")")))
               ;; Substitute full dynamic library path for nss.
               (substitute* "src/3rdparty/chromium/crypto/nss_util.cc"
                 (("libnssckbi.so")
@@ -3884,12 +3884,6 @@  (define-public qtwebengine
        (replace "qtbase" qtbase)
        (replace "qtdeclarative" qtdeclarative)
        (replace "qtwebchannel" qtwebchannel)))
-    (native-search-paths
-     (list (search-path-specification
-            (file-type 'regular)
-            (separator #f)
-            (variable "QTWEBENGINEPROCESS_PATH")
-            (files '("lib/qt6/libexec/QtWebEngineProcess")))))
     (home-page "https://wiki.qt.io/QtWebEngine")
     (synopsis "Qt WebEngine module")
     (description "The Qt WebEngine module provides support for web
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index d0b5907bdd..4881f6ba64 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -6049,19 +6049,7 @@  (define-public openshot
                     (lambda _
                       ;; src/classes/info.py "needs" to create several
                       ;; directories in $HOME when loaded during build
-                      (setenv "HOME" "/tmp")))
-                  (add-after 'install 'wrap-program
-                    (lambda* (#:key outputs inputs #:allow-other-keys)
-                      (let ((out (assoc-ref outputs "out"))
-                            (qtwebengine-process-path
-                             (search-input-file
-                              inputs "/lib/qt5/libexec/QtWebEngineProcess")))
-                        (wrap-qt-program "openshot-qt"
-                                         #:output out #:inputs inputs)
-                        ;; Help the program discover QtWebEngine at runtime.
-                        (wrap-program (string-append out "/bin/openshot-qt")
-                          `("QTWEBENGINEPROCESS_PATH" =
-                            (,qtwebengine-process-path)))))))))
+                      (setenv "HOME" "/tmp"))))))
     (home-page "https://www.openshot.org/")
     (synopsis "Video editor")
     (description "OpenShot takes your videos, photos, and music files and
diff --git a/gnu/packages/vpn.scm b/gnu/packages/vpn.scm
index 0b62e8c7cf..b64617c5df 100644
--- a/gnu/packages/vpn.scm
+++ b/gnu/packages/vpn.scm
@@ -800,17 +800,7 @@  (define-public openconnect-sso
                (("\"openconnect\"")
                 (string-append "\""
                                (search-input-file inputs "/sbin/openconnect")
-                               "\"")))))
-         (add-after 'check 'wrap-qt-process-path
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (bin (string-append out "/bin/openconnect-sso"))
-                    (qt-process-path
-                     (search-input-file inputs
-                                        "/lib/qt5/libexec/QtWebEngineProcess")))
-               (wrap-program bin
-                 #:sh (search-input-file inputs "bin/bash")
-                 `("QTWEBENGINEPROCESS_PATH" = (,qt-process-path)))))))))
+                               "\""))))))))
     (inputs
      (list openconnect
            poetry
diff --git a/gnu/packages/web-browsers.scm b/gnu/packages/web-browsers.scm
index c0138eea17..5159a3b76d 100644
--- a/gnu/packages/web-browsers.scm
+++ b/gnu/packages/web-browsers.scm
@@ -490,10 +490,7 @@  (define-public qutebrowser
            python-pyyaml
            python-pyqt-6
            python-pyqtwebengine-6
-           python-tldextract
-           ;; While qtwebengine is provided by python-pyqtwebengine-6, it's
-           ;; included here so we can wrap QTWEBENGINEPROCESS_PATH.
-           qtwebengine))
+           python-tldextract))
     (arguments
      `(;; FIXME: With the existence of qtwebengine, tests can now run.  But
        ;; they are still disabled because test phase hangs.  It's not readily
@@ -547,10 +544,7 @@  (define-public qutebrowser
              (wrap-program (search-input-file outputs "bin/qutebrowser")
                `("QTWEBENGINE_RESOURCES_PATH" =
                  (,(search-input-directory
-                    inputs "/share/qt6/resources")))
-               `("QTWEBENGINEPROCESS_PATH" =
-                 (,(search-input-file
-                    inputs "/lib/qt6/libexec/QtWebEngineProcess")))))))))
+                    inputs "/share/qt6/resources")))))))))
     (home-page "https://qutebrowser.org/")
     (synopsis "Minimal, keyboard-focused, vim-like web browser")
     (description "qutebrowser is a keyboard-focused browser with a minimal
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index a23a0f3dcd..0cf1c18a56 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -9404,15 +9404,7 @@  (define-public kiwix-desktop
            (lambda* (#:key outputs #:allow-other-keys)
              (invoke "qmake"
                      (string-append "PREFIX="
-                                    (assoc-ref outputs "out")))))
-         (add-after 'install 'wrap-qt-process-path
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (bin (string-append out "/bin/kiwix-desktop"))
-                    (qt-process-path (search-input-file
-                                      inputs "/lib/qt5/libexec/QtWebEngineProcess")))
-               (wrap-program bin
-                 `("QTWEBENGINEPROCESS_PATH" = (,qt-process-path)))))))))
+                                    (assoc-ref outputs "out"))))))))
     (inputs
      (list bash-minimal
            curl