Subject: [bug#77155] [PATCH] Add package for styling Qt-5 based applications in LXQt

From: Marcel Steinbeck <[email-masked]>
Date: Fri, 21 Mar 2025 14:49:13 +0000

Hey everyone,

According to
https://github.com/lxqt/lxqt/wiki/Building-from-source#qt5-support LXQt
requires the libraries added in this patch file to style Qt5-based
applications. I extracted the package definitions from the Git history
and updated the minor versions to the latest available. To make package
lxqt not dependent on Qt5, I have added an additional package: lxqt-
qt5-styling.
From 566c44d0f750ccccf7b7f6f8f2481afb8912ac44 Mon Sep 17 00:00:00 2001
From: Marcel Steinbeck <[email-masked]>
Date: Fri, 21 Mar 2025 15:29:41 +0100
Subject: [PATCH] gnu: lxqt: add lxqt-qt5-styling

---
 gnu/packages/lxqt.scm | 193 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 193 insertions(+)

diff --git a/gnu/packages/lxqt.scm b/gnu/packages/lxqt.scm
index 2662235679..61349e07d9 100644
--- a/gnu/packages/lxqt.scm
+++ b/gnu/packages/lxqt.scm
@@ -1068,6 +1068,177 @@ (define-public lxqt-archiver
 like @command{tar} and @command{zip}.")
     (license license:gpl2+)))
 
+;; Qt5-styling
+
+(define-public lxqt-build-tools-qt5
+  (package
+    (name "lxqt-build-tools")
+    (version "0.13.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/lxqt/lxqt-build-tools/releases"
+                           "/download/" version
+                           "/lxqt-build-tools-" version ".tar.xz"))
+       (sha256
+        (base32 "1kjrxc1aj7yfn3v72lwryn58hkwsribsspm480qg4qbw1nfijg7x"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:tests? #f                       ; no tests
+      #:modules `((ice-9 regex)
+                  (guix build cmake-build-system)
+                  (guix build utils))
+      ;; In phases and configure-flags: Set LXQT_TRANSLATIONS_DIR,
+      ;; LXQT_DATA_DIR, etc. to relative paths, so that packages using
+      ;; LXQtConfigVars.cmake from lxqt-build-tools will install translations
+      ;; and data files into their outputs, remove the need to patch their
+      ;; cmake files.
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'patch-LXQtConfigVars.cmake
+            (lambda _
+              (substitute* (string-append #$output
+                                          "/share/cmake/lxqt-build-tools"
+                                          "/modules/LXQtConfigVars.cmake")
+                (((regexp-quote (string-append #$output "/"))) "")))))
+      #:configure-flags
+      #~(list "-DLXQT_ETC_XDG_DIR=etc/xdg")))
+    (native-inputs
+     (list pkg-config glib))
+    (inputs
+     (list qtbase-5))
+    (propagated-inputs
+     ;; Dependent projects require Perl via the CMake files.
+     (list perl))
+    (synopsis "LXQt Build tools")
+    (description
+     "Lxqt-build-tools is providing several tools needed to build LXQt
+itself as well as other components maintained by the LXQt project.")
+    (home-page "https://lxqt-project.org")
+    (license license:lgpl2.1+)))
+
+(define-public libqtxdg-qt5
+  (package
+    (name "libqtxdg")
+    (version "3.12.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://github.com/lxqt/libqtxdg/releases/download/" version
+             "/libqtxdg-" version ".tar.xz"))
+       (sha256
+        (base32 "1p6l0sapz6izxxjm0sijdi67i3ija6qh0626hif5f83j8kzmcs3j"))))
+    (build-system cmake-build-system)
+    (arguments
+     '(#:configure-flags '("-DBUILD_TESTS=ON"
+                           "-DQTXDGX_ICONENGINEPLUGIN_INSTALL_PATH=lib/qt5/plugins/iconengines")
+       #:phases (modify-phases %standard-phases
+                  (add-before 'check 'pre-check
+                    (lambda _
+                      ;; Run the tests offscreen.
+                      (setenv "QT_QPA_PLATFORM" "offscreen") #t)))))
+    (propagated-inputs
+     ;; required by Qt5XdgIconLoader.pc
+     (list glib qtbase-5 qtsvg-5))
+    (native-inputs (list lxqt-build-tools-qt5 pkg-config))
+    (home-page "https://github.com/lxqt/libqtxdg")
+    (synopsis "Qt implementation of freedesktop.org xdg specifications")
+    (description "Libqtxdg implements the freedesktop.org xdg specifications
+in Qt.")
+    (license license:lgpl2.1+)))
+
+(define-public lxqt-menu-data-qt5
+  (package
+    (name "lxqt-menu-data")
+    (version "1.4.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://github.com/lxqt/lxqt-menu-data/releases/download/"
+             version "/lxqt-menu-data-" version ".tar.xz"))
+       (sha256
+        (base32 "15nmf85ralkb8iarl8sv7sksin3km3dyxdfff8ifqqfgmxrd7d47"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:tests? #f)) ;no tests
+    (inputs (list qtbase-5))
+    (native-inputs (list lxqt-build-tools-qt5 qttools-5))
+    (home-page "https://lxqt-project.org")
+    (synopsis "LXQt menu files")
+    (description "This package provides freedesktop compliant menu files for
+LXQt Panel, Configuration Center and PCManFM-Qt/libfm-qt.")
+    (license license:lgpl2.1+)))
+
+(define-public libfm-qt-qt5
+  (package
+    (name "libfm-qt")
+    (version "1.4.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://github.com/lxqt/libfm-qt/releases/download/" version
+             "/libfm-qt-" version ".tar.xz"))
+       (sha256
+        (base32 "0lvpdw6p7qzx8yd9xhxycfm690ykarc5f0rzllqxzw9x08p8iqrf"))))
+    (build-system cmake-build-system)
+    (arguments
+     '(#:tests? #f)) ;no tests
+    (inputs (list glib
+                  libexif
+                  libfm
+                  libxcb
+                  lxqt-menu-data-qt5
+                  menu-cache
+                  pcre
+                  qtbase-5
+                  qtx11extras))
+    (native-inputs (list pkg-config lxqt-build-tools-qt5 qttools-5))
+    (home-page "https://lxqt-project.org")
+    (synopsis "Qt binding for libfm")
+    (description
+     "libfm-qt is the Qt port of libfm, a library providing
+components to build desktop file managers which belongs to LXDE.")
+    (license license:lgpl2.1+)))
+
+(define-public lxqt-qtplugin-qt5
+  (package
+    (name "lxqt-qtplugin")
+    (version "1.4.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://github.com/lxqt/lxqt-qtplugin/releases/download/"
+             version "/lxqt-qtplugin-" version ".tar.xz"))
+       (sha256
+        (base32 "1m7cfx39wmd0cdfdidgsc6y6kivbqpaxwh062kcq2wmwap6j0d4m"))))
+    (build-system cmake-build-system)
+    (inputs (list libdbusmenu-qt
+                  libfm-qt-qt5
+                  libqtxdg-qt5
+                  qtbase-5
+                  qtsvg-5
+                  qtx11extras))
+    (native-inputs (list lxqt-build-tools-qt5 qttools-5))
+    (arguments
+     '(#:tests? #f ;no tests
+       #:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'patch-source
+                    (lambda _
+                      (substitute* '("src/CMakeLists.txt")
+                        (("DESTINATION \"\\$\\{QT_PLUGINS_DIR\\}")
+                         "DESTINATION \"lib/qt5/plugins")) #t)))))
+    (home-page "https://lxqt-project.org")
+    (synopsis "LXQt Qt platform integration plugin")
+    (description "lxqt-qtplugin is providing a library libqtlxqt to integrate
+Qt with LXQt.")
+    (license license:lgpl2.1+)))
+
 ;; The LXQt Desktop Environment
 
 (define-public lxqt
@@ -1122,3 +1293,25 @@ (define-public lxqt
     (description "LXQt is a lightweight Qt desktop environment.")
     (home-page "https://lxqt-project.org")
     (license license:gpl2+)))
+
+(define-public lxqt-qt5-styling
+  (package
+    (name "lxqt-qt5-styling")
+    (version (package-version lxqt))
+    (source
+     #f)
+    (build-system trivial-build-system)
+    (arguments
+     '(#:builder (begin
+                   (mkdir %output) #t)))
+    (propagated-inputs (list libqtxdg-qt5 libfm-qt-qt5 lxqt-qtplugin-qt5))
+    (native-search-paths
+     (list (search-path-specification
+            ;; For finding lxqt-qtplugin-qt5 etc.
+            (variable "QT_PLUGIN_PATH")
+            (files '("lib/qt5/plugins")))))
+    (synopsis "LXQt Qt5-styling")
+    (description "Libraries for styling Qt5-based applications and allowing
+them to use the LXQt file dialog.")
+    (home-page "https://lxqt-project.org")
+    (license license:gpl2+)))
-- 
2.48.1