diff mbox

[bug#37908,0/2] Remove monolithic qt5 (and other unused package)

Message ID 531d87da-8ad9-e6e9-cfce-9d447e9b5233@crazy-compilers.com
State Accepted
Headers show

Commit Message

Hartmut Goebel Nov. 1, 2019, 12:18 p.m. UTC
Am 01.11.19 um 11:49 schrieb Ludovic Courtès:
>   (define-deprecated qt qtbase qtbase)

Thanks. Attached please find the updated patch deprecating monolithic qt5.

Comments

Ludovic Courtès Nov. 1, 2019, 2:14 p.m. UTC | #1
Hi Hartmut,

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

> From: Hartmut Goebel <h.goebel@crazy-compilers.com>
> Date: Thu, 24 Oct 2019 20:28:26 +0200
> Subject: [Patch v2 2/2] gnu: Deprecate monolithic qt5.
>
> This package was not used anywhere but as a based for qt-4.
>
> * gnu/packages/qt.scm (qt-4): Copy all relevant package definition
>   parts from 'qt'.
>   (qt): Define as a deprecated alias for 'qtbase`.

Please ensure that “guix build qt@4 -nd” returns the same derivation
before and after the change.

> +(define-deprecated qt qtbase qtbase)

Perhaps add a comment above saying that ‘qt’ used to refer to the
monolithic Qt 5.x package?

Otherwise LGTM!  Efraim, can you say if this is fine with you?
When Efraim agrees to the change, I guess you can go ahead.

Thank you,
Ludo’.
Efraim Flashner Nov. 1, 2019, 2:39 p.m. UTC | #2
On Fri, Nov 01, 2019 at 03:14:08PM +0100, Ludovic Courtès wrote:
> Hi Hartmut,
> 
> Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:
> 
> > From: Hartmut Goebel <h.goebel@crazy-compilers.com>
> > Date: Thu, 24 Oct 2019 20:28:26 +0200
> > Subject: [Patch v2 2/2] gnu: Deprecate monolithic qt5.
> >
> > This package was not used anywhere but as a based for qt-4.
> >
> > * gnu/packages/qt.scm (qt-4): Copy all relevant package definition
> >   parts from 'qt'.
> >   (qt): Define as a deprecated alias for 'qtbase`.
> 
> Please ensure that “guix build qt@4 -nd” returns the same derivation
> before and after the change.
> 
> > +(define-deprecated qt qtbase qtbase)
> 
> Perhaps add a comment above saying that ‘qt’ used to refer to the
> monolithic Qt 5.x package?
> 
> Otherwise LGTM!  Efraim, can you say if this is fine with you?
> When Efraim agrees to the change, I guess you can go ahead.
> 

I didn't apply it locally, I can do it in about 36 hours, but it looks
good. IIRC we have qt4 inheriting from qt5, and qtbase was its own
definition so nothing should change on that side.

LGTM
Hartmut Goebel Nov. 1, 2019, 4:09 p.m. UTC | #3
Am 01.11.19 um 15:39 schrieb Efraim Flashner:
>> Please ensure that “guix build qt@4 -nd” returns the same derivation
>> before and after the change.


Done already before submitting the patch :-) But I repeated it now and
this revealed some error. So many thanks for nagging :-)

>>
>> Perhaps add a comment above saying that ‘qt’ used to refer to the
>> monolithic Qt 5.x package?
Done.

> I didn't apply it locally, I can do it in about 36 hours, but it looks
> good. IIRC we have qt4 inheriting from qt5, and qtbase was its own
> definition so nothing should change on that side.


Correct. I added some more explanation to the commit message to make
this more clear.

Pushed as  02511196d99ebc5e385e9dc7f733ffbe848e25ca
diff mbox

Patch

From b412a8d72ea5dc3db70c3082b520eda9959c8624 Mon Sep 17 00:00:00 2001
From: Hartmut Goebel <h.goebel@crazy-compilers.com>
Date: Thu, 24 Oct 2019 20:28:26 +0200
Subject: [Patch v2 2/2] gnu: Deprecate monolithic qt5.

This package was not used anywhere but as a based for qt-4.

* gnu/packages/qt.scm (qt-4): Copy all relevant package definition
  parts from 'qt'.
  (qt): Define as a deprecated alias for 'qtbase`.
---
 gnu/packages/qt.scm | 302 ++++++++------------------------------------
 1 file changed, 51 insertions(+), 251 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index e9dc406328..b1ee8bf559 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -126,66 +126,28 @@  other text such as code.  The syntax uses the syntax of the Django template
 system, and the core design of Django is reused in Grantlee.")
     (license license:lgpl2.0+)))
 
-(define-public qt
+(define-deprecated qt qtbase qtbase)
+
+(define-public qt-4
   (package
     (name "qt")
-    (version "5.11.3")
-    (outputs '("out" "examples"))
+    (version "4.8.7")
     (source (origin
              (method url-fetch)
-             (uri
-               (string-append
-                 "http://download.qt.io/official_releases/qt/"
-                 (version-major+minor version)
-                 "/" version
-                 "/single/qt-everywhere-src-"
-                 version ".tar.xz"))
+             (uri (string-append "http://download.qt-project.org/official_releases/qt/"
+                                 (string-copy version 0 (string-rindex version #\.))
+                                 "/" version
+                                 "/qt-everywhere-opensource-src-"
+                                 version ".tar.gz"))
              (sha256
               (base32
-               "0kgzy32s1fr22fxxfhcyncfryb3qxrznlr737r4y5khk4xj1g545"))
+               "183fca7n7439nlhxyg1z7aky0izgbyll3iwakw4gwivy16aj5272"))
+             (patches (search-patches "qt4-ldflags.patch"))
              (modules '((guix build utils)))
              (snippet
-              '(begin
-                ;; Remove qtwebengine, which relies on a bundled copy of
-                ;; chromium. Not only does it fail compilation in qt 5.5:
-                ;;    3rdparty/chromium/ui/gfx/codec/jpeg_codec.cc:362:10:
-                ;;    error: cannot convert ‘bool’ to ‘boolean’ in return
-                ;; it might also pose security problems.
-                ;; Alternatively, we could use the "-skip qtwebengine"
-                ;; configuration option.
-                (delete-file-recursively "qtwebengine")
-                ;; The following snippets are copied from their mondular-qt counterparts.
-                (for-each
-                  (lambda (dir)
-                    (delete-file-recursively (string-append "qtbase/src/3rdparty/" dir)))
-                  (list "double-conversion" "freetype" "harfbuzz-ng"
-                        "libpng" "libjpeg" "pcre2" "sqlite" "xcb"
-                        "xkbcommon" "zlib"))
-                (for-each
-                  (lambda (dir)
-                    (delete-file-recursively dir))
-                  (list "qtimageformats/src/3rdparty"
-                        "qtmultimedia/examples/multimedia/spectrum/3rdparty"
-                        "qtwayland/examples"
-                        "qtscxml/tests/3rdparty"
-                        "qtcanvas3d/examples/canvas3d/3rdparty"))
-                ;; Tests depend on this example, which depends on the 3rd party code.
-                (substitute* "qtmultimedia/examples/multimedia/multimedia.pro"
-                  (("spectrum") "#"))
-                (substitute* "qtxmlpatterns/tests/auto/auto.pro"
-                  (("qxmlquery") "# qxmlquery")
-                  (("xmlpatterns ") "# xmlpatterns"))
-                (substitute* "qtwebglplugin/tests/plugins/platforms/platforms.pro"
-                  (("webgl") "# webgl"))
-                (substitute* "qtscxml/tests/auto/auto.pro"
-                  (("scion") "#"))
-                (substitute* "qtnetworkauth/tests/auto/auto.pro"
-                  (("oauth1 ") "# oauth1 "))
-                (substitute* "qtremoteobjects/tests/auto/qml/qml.pro"
-                  (("integration") "# integration")
-                  (("usertypes") "# usertypes"))
-                #t))))
-    (build-system gnu-build-system)
+              ;; Remove webkit module, which is not built.
+              '(begin (delete-file-recursively "src/3rdparty/webkit")
+                      #t))))
     (propagated-inputs
      `(("mesa" ,mesa)))
     (inputs
@@ -200,11 +162,9 @@  system, and the core design of Django is reused in Grantlee.")
        ("glib" ,glib)
        ("gstreamer" ,gstreamer)
        ("gst-plugins-base" ,gst-plugins-base)
-       ("harfbuzz" ,harfbuzz)
        ("icu4c" ,icu4c)
        ("jasper" ,jasper)
        ("libinput" ,libinput-minimal)
-       ("libjpeg" ,libjpeg)
        ("libmng" ,libmng)
        ("libpci" ,pciutils)
        ("libpng" ,libpng)
@@ -226,7 +186,6 @@  system, and the core design of Django is reused in Grantlee.")
        ("mtdev" ,mtdev)
        ("mariadb" ,mariadb)
        ("nss" ,nss)
-       ("openssl" ,openssl)
        ("postgresql" ,postgresql)
        ("pulseaudio" ,pulseaudio)
        ("pcre2" ,pcre2)
@@ -239,197 +198,7 @@  system, and the core design of Django is reused in Grantlee.")
        ("xcb-util-keysyms" ,xcb-util-keysyms)
        ("xcb-util-renderutil" ,xcb-util-renderutil)
        ("xcb-util-wm" ,xcb-util-wm)
-       ("zlib" ,zlib)))
-    (native-inputs
-     `(("bison" ,bison)
-       ("flex" ,flex)
-       ("gperf" ,gperf)
-       ("perl" ,perl)
-       ("pkg-config" ,pkg-config)
-       ("python" ,python-2)
-       ("ruby" ,ruby)
-       ("vulkan-headers" ,vulkan-headers)
-       ("which" ,(@ (gnu packages base) which))))
-    (arguments
-     `(#:parallel-build? #f ; Triggers race condition in qtbase module on Hydra.
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'configure 'patch-bin-sh
-           (lambda _
-             (substitute* '("qtbase/configure"
-                            "qtbase/mkspecs/features/qt_functions.prf"
-                            "qtbase/qmake/library/qmakebuiltins.cpp")
-                          (("/bin/sh") (which "sh")))
-             #t))
-         (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out      (assoc-ref outputs "out"))
-                   (examples (assoc-ref outputs "examples")))
-               (substitute* '("configure" "qtbase/configure")
-                 (("/bin/pwd") (which "pwd")))
-               (substitute* "qtbase/src/corelib/global/global.pri"
-                 (("/bin/ls") (which "ls")))
-               ;; do not pass "--enable-fast-install", which makes the
-               ;; configure process fail
-               (invoke
-                 "./configure"
-                 "-verbose"
-                 "-prefix" out
-                 "-docdir" (string-append out "/share/doc/qt5")
-                 "-headerdir" (string-append out "/include/qt5")
-                 "-archdatadir" (string-append out "/lib/qt5")
-                 "-datadir" (string-append out "/share/qt5")
-                 "-examplesdir" (string-append
-                                  examples "/share/doc/qt5/examples") ; 151MiB
-                 "-opensource"
-                 "-confirm-license"
-
-                 ;; These features require higher versions of Linux than the
-                 ;; minimum version of the glibc.  See
-                 ;; src/corelib/global/minimum-linux_p.h.  By disabling these
-                 ;; features Qt5 applications can be used on the oldest
-                 ;; kernels that the glibc supports, including the RHEL6
-                 ;; (2.6.32) and RHEL7 (3.10) kernels.
-                 "-no-feature-getentropy"  ; requires Linux 3.17
-                 "-no-feature-renameat2"   ; requires Linux 3.16
-
-                 ;; Do not build examples; for the time being, we
-                 ;; prefer to save the space and build time.
-                 "-no-compile-examples"
-                 ;; Most "-system-..." are automatic, but some use
-                 ;; the bundled copy by default.
-                 "-system-sqlite"
-                 "-system-harfbuzz"
-                 "-system-pcre"
-                 ;; explicitly link with openssl instead of dlopening it
-                 "-openssl-linked"
-                 ;; explicitly link with dbus instead of dlopening it
-                 "-dbus-linked"
-                 ;; don't use the precompiled headers
-                 "-no-pch"
-                 ;; drop special machine instructions not supported
-                 ;; on all instances of the target
-                 ,@(if (string-prefix? "x86_64"
-                                       (or (%current-target-system)
-                                           (%current-system)))
-                       '()
-                       '("-no-sse2"))
-                 "-no-mips_dsp"
-                 "-no-mips_dspr2"))))
-           (add-after 'install 'patch-mkspecs
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let* ((out (assoc-ref outputs "out"))
-                      (archdata (string-append out "/lib/qt5"))
-                      (mkspecs (string-append archdata "/mkspecs"))
-                      (qt_config.prf (string-append
-                                      mkspecs "/features/qt_config.prf")))
-                 ;; For each Qt module, let `qmake' uses search paths in the
-                 ;; module directory instead of all in QT_INSTALL_PREFIX.
-                 (substitute* qt_config.prf
-                   (("\\$\\$\\[QT_INSTALL_HEADERS\\]")
-                    "$$clean_path($$replace(dir, mkspecs/modules, ../../include/qt5))")
-                   (("\\$\\$\\[QT_INSTALL_LIBS\\]")
-                    "$$clean_path($$replace(dir, mkspecs/modules, ../../lib))")
-                   (("\\$\\$\\[QT_HOST_LIBS\\]")
-                    "$$clean_path($$replace(dir, mkspecs/modules, ../../lib))")
-                   (("\\$\\$\\[QT_INSTALL_BINS\\]")
-                    "$$clean_path($$replace(dir, mkspecs/modules, ../../bin))"))
-
-                 ;; Searches Qt tools in the current PATH instead of QT_HOST_BINS.
-                 (substitute* (string-append mkspecs "/features/qt_functions.prf")
-                   (("cmd = \\$\\$\\[QT_HOST_BINS\\]/\\$\\$2")
-                    "cmd = $$system(which $${2}.pl 2>/dev/null || which $${2})"))
-
-                 ;; Resolve qmake spec files within qtbase by absolute paths.
-                 (substitute*
-                     (map (lambda (file)
-                            (string-append mkspecs "/features/" file))
-                          '("device_config.prf" "moc.prf" "qt_build_config.prf"
-                            "qt_config.prf" "winrt/package_manifest.prf"))
-                   (("\\$\\$\\[QT_HOST_DATA/get\\]") archdata)
-                   (("\\$\\$\\[QT_HOST_DATA/src\\]") archdata))
-                 #t)))
-           (add-after 'unpack 'patch-paths
-             ;; Use the absolute paths for dynamically loaded libs, otherwise
-             ;; the lib will be searched in LD_LIBRARY_PATH which typically is
-             ;; not set in guix.
-             (lambda* (#:key inputs #:allow-other-keys)
-               ;; libresolve
-               (let ((glibc (assoc-ref inputs ,(if (%current-target-system)
-                                                   "cross-libc" "libc"))))
-                 (substitute* '("qtbase/src/network/kernel/qdnslookup_unix.cpp"
-                                "qtbase/src/network/kernel/qhostinfo_unix.cpp")
-                   (("^\\s*(lib.setFileName\\(QLatin1String\\(\")(resolv\"\\)\\);)" _ a b)
-                  (string-append a glibc "/lib/lib" b))))
-               ;; X11/locale (compose path)
-               (substitute* "qtbase/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp"
-                 ;; Don't search in /usr/…/X11/locale, …
-                 (("^\\s*m_possibleLocations.append\\(QStringLiteral\\(\"/usr/.*/X11/locale\"\\)\\);" line)
-                  (string-append "// " line))
-                 ;; … but use libx11's path
-                 (("^\\s*(m_possibleLocations.append\\(QStringLiteral\\()X11_PREFIX \"(/.*/X11/locale\"\\)\\);)" _ a b)
-                  (string-append a "\"" (assoc-ref inputs "libx11") b)))
-               ;; libGL
-               (substitute* "qtbase/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp"
-                 (("^\\s*(QLibrary lib\\(QLatin1String\\(\")(GL\"\\)\\);)" _ a b)
-                  (string-append a (assoc-ref inputs "mesa") "/lib/lib" b)))
-               ;; libXcursor
-               (substitute* "qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp"
-                 (("^\\s*(QLibrary xcursorLib\\(QLatin1String\\(\")(Xcursor\"\\), 1\\);)" _ a b)
-                  (string-append a (assoc-ref inputs "libxcursor") "/lib/lib" b))
-                 (("^\\s*(xcursorLib.setFileName\\(QLatin1String\\(\")(Xcursor\"\\)\\);)" _ a b)
-                  (string-append a (assoc-ref inputs "libxcursor") "/lib/lib" b)))
-               #t)))))
-      (native-search-paths
-       (list (search-path-specification
-              (variable "QMAKEPATH")
-              (files '("lib/qt5")))
-             (search-path-specification
-              (variable "QML2_IMPORT_PATH")
-              (files '("lib/qt5/qml")))
-             (search-path-specification
-              (variable "QT_PLUGIN_PATH")
-              (files '("lib/qt5/plugins")))
-             (search-path-specification
-              (variable "XDG_DATA_DIRS")
-              (files '("share")))
-             (search-path-specification
-              (variable "XDG_CONFIG_DIRS")
-              (files '("etc/xdg")))))
-      (home-page "https://www.qt.io/")
-      (synopsis "Cross-platform GUI library")
-      (description "Qt is a cross-platform application and UI framework for
-  developers using C++ or QML, a CSS & JavaScript like language.")
-      (license (list license:lgpl2.1 license:lgpl3))
-
-    ;; Qt 4: 'QBasicAtomicPointer' leads to build failures on MIPS;
-    ;; see <http://hydra.gnu.org/build/112828>.
-    ;; Qt 5: assembler error; see <http://hydra.gnu.org/build/112526>.
-    (supported-systems (delete "mips64el-linux" %supported-systems))))
-
-(define-public qt-4
-  (package (inherit qt)
-    (version "4.8.7")
-    (source (origin
-             (method url-fetch)
-             (uri (string-append "http://download.qt-project.org/official_releases/qt/"
-                                 (string-copy version 0 (string-rindex version #\.))
-                                 "/" version
-                                 "/qt-everywhere-opensource-src-"
-                                 version ".tar.gz"))
-             (sha256
-              (base32
-               "183fca7n7439nlhxyg1z7aky0izgbyll3iwakw4gwivy16aj5272"))
-             (patches (search-patches "qt4-ldflags.patch"))
-             (modules '((guix build utils)))
-             (snippet
-              ;; Remove webkit module, which is not built.
-              '(begin (delete-file-recursively "src/3rdparty/webkit")
-                      #t))))
-    (inputs
-     `(,@(fold alist-delete
-               (package-inputs qt)
-               '("harfbuzz" "libjpeg" "openssl"))
+       ("zlib" ,zlib)
        ("libjpeg" ,libjpeg-8)
        ("libsm" ,libsm)
        ("openssl" ,openssl-1.0)))
@@ -438,15 +207,20 @@  system, and the core design of Django is reused in Grantlee.")
        ;; We could build it with -std=gnu++98, but then we'll get in trouble with
        ;; ICU later.  Just keep using GCC 5 for now.
        ("gcc" ,gcc-5)
-       ,@(fold alist-delete
-               (package-native-inputs qt)
-               '("vulkan-headers"))))
-
+       ("bison" ,bison)
+       ("flex" ,flex)
+       ("gperf" ,gperf)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-2)
+       ("ruby" ,ruby)
+       ("which" ,(@ (gnu packages base) which))))
     ;; Note: there are 37 MiB of examples and a '-exampledir' configure flags,
     ;; but we can't make them a separate output because "out" and "examples"
     ;; would refer to each other.
     (outputs '("out"                             ;112MiB core + 37MiB examples
                "doc"))                           ;280MiB of HTML + code
+    (build-system gnu-build-system)
     (arguments
      `(#:phases
        (modify-phases %standard-phases
@@ -519,7 +293,33 @@  system, and the core design of Django is reused in Grantlee.")
               ;; different "devices" due to bind-mounts.
               (copy-recursively olddoc docdir)
               (delete-file-recursively olddoc)
-              #t))))))))
+              #t))))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "QMAKEPATH")
+            (files '("lib/qt5")))
+           (search-path-specification
+            (variable "QML2_IMPORT_PATH")
+            (files '("lib/qt5/qml")))
+           (search-path-specification
+            (variable "QT_PLUGIN_PATH")
+            (files '("lib/qt5/plugins")))
+           (search-path-specification
+            (variable "XDG_DATA_DIRS")
+            (files '("share")))
+           (search-path-specification
+            (variable "XDG_CONFIG_DIRS")
+            (files '("etc/xdg")))))
+    (home-page "https://www.qt.io/")
+    (synopsis "Cross-platform GUI library")
+    (description "Qt is a cross-platform application and UI framework for
+developers using C++ or QML, a CSS & JavaScript like language.")
+    (license (list license:lgpl2.1 license:lgpl3))
+
+    ;; Qt 4: 'QBasicAtomicPointer' leads to build failures on MIPS;
+    ;; see <http://hydra.gnu.org/build/112828>.
+    ;; Qt 5: assembler error; see <http://hydra.gnu.org/build/112526>.
+    (supported-systems (delete "mips64el-linux" %supported-systems))))
 
 (define-public qtbase
   (package
-- 
2.21.0