gnu: Add glib-next.

* gnu/packages/glib.scm (glib-next): New variable.
(glib-with-documentation): Inherit from it.
This commit is contained in:
Maxim Cournoyer 2022-09-08 14:37:46 -04:00
parent dc1cf13ac5
commit 7ad9360bd6
No known key found for this signature in database
GPG Key ID: 1260E46482E63562

View File

@ -48,6 +48,7 @@
#:use-module (gnu packages enlightenment) #:use-module (gnu packages enlightenment)
#:use-module (gnu packages file) #:use-module (gnu packages file)
#:use-module (gnu packages flex) #:use-module (gnu packages flex)
#:use-module (gnu packages freedesktop)
#:use-module (gnu packages gettext) #:use-module (gnu packages gettext)
#:use-module (gnu packages gnome) #:use-module (gnu packages gnome)
#:use-module (gnu packages graphviz) #:use-module (gnu packages graphviz)
@ -379,46 +380,105 @@ functions for strings and common data structures.")
(license license:lgpl2.1+) (license license:lgpl2.1+)
(properties '((hidden? . #t))))) (properties '((hidden? . #t)))))
(define-public glib-next
(package
(inherit glib)
(name "glib")
(version "2.73.3")
(source
(origin
(inherit (package-source glib))
(uri
(string-append "mirror://gnome/sources/"
name "/" (string-take version 4) "/"
name "-" version ".tar.xz"))
(snippet
'(substitute* "glib/tests/spawn-test.c"
(("/bin/sh") "sh")))
(sha256
(base32 "1bgfch7zj1pq4rkqcibfky1470ijljyrx5pn5s5v9mk72s22n6nz"))))
(arguments
(substitute-keyword-arguments (package-arguments glib)
((#:test-options test-options ''())
;; Skip flaky or slow tests.
`(cons* "--no-suite=slow" "--no-suite=flaky" ,test-options))
((#:phases phases '%standard-phases)
`(modify-phases ,phases
(replace 'disable-failing-tests
(lambda _
(with-directory-excursion "glib/tests"
(substitute* '("unix.c" "utils.c")
(("[ \t]*g_test_add_func.*;") "")))
;; The "glib:gio / file" test fails with the error "No
;; application is registered as handling this file" (see:
;; https://gitlab.gnome.org/GNOME/glib/-/issues/2742).
(with-directory-excursion "gio/tests"
(substitute* '("appinfo.c"
"contenttype.c"
"desktop-app-info.c"
"file.c"
"gdbus-address-get-session.c"
"gdbus-peer.c")
(("[ \t]*g_test_add_func.*;") "")))
,@(if (target-x86-32?)
;; Comment out parts of timer.c that fail on i686 due to
;; excess precision when building with GCC 10:
;; <https://gitlab.gnome.org/GNOME/glib/-/issues/820>.
'((substitute* "glib/tests/timer.c"
(("^ g_assert_cmpuint \\(micros.*" all)
(string-append "//" all "\n"))
(("^ g_assert_cmpfloat \\(elapsed, ==.*" all)
(string-append "//" all "\n"))))
'())))))))
(native-inputs
(modify-inputs (package-native-inputs glib)
(append desktop-file-utils)))
(propagated-inputs
(modify-inputs (package-propagated-inputs glib)
(replace "pcre" pcre2)))))
(define-public glib-with-documentation (define-public glib-with-documentation
;; glib's doc must be built in a separate package since it requires gtk-doc, ;; glib's doc must be built in a separate package since it requires gtk-doc,
;; which in turn depends on glib. ;; which in turn depends on glib.
(package/inherit glib (let ((base glib-next))
(properties (alist-delete 'hidden? (package-properties glib))) (package/inherit base
(outputs (cons "doc" (package-outputs glib))) ; 20 MiB of GTK-Doc reference (properties (alist-delete 'hidden? (package-properties base)))
(native-inputs (outputs (cons "doc" (package-outputs base))) ; 20 MiB of GTK-Doc reference
`(("docbook-xml-4.2" ,docbook-xml-4.2) (native-inputs
("docbook-xml-4.5" ,docbook-xml) `(("docbook-xml-4.2" ,docbook-xml-4.2)
("docbook-xsl" ,docbook-xsl) ("docbook-xml-4.5" ,docbook-xml)
("gtk-doc" ,gtk-doc) ("docbook-xsl" ,docbook-xsl)
("libxml2" ,libxml2) ("gtk-doc" ,gtk-doc)
("xsltproc" ,libxslt) ("libxml2" ,libxml2)
,@(package-native-inputs glib))) ("xsltproc" ,libxslt)
(arguments ,@(package-native-inputs base)))
(substitute-keyword-arguments (package-arguments glib) (arguments
((#:configure-flags flags ''()) (substitute-keyword-arguments (package-arguments base)
#~(cons "-Dgtk_doc=true" ((#:configure-flags flags ''())
(delete "-Dman=false" #$flags))) #~(cons "-Dgtk_doc=true"
((#:phases phases) (delete "-Dman=false" #$flags)))
`(modify-phases ,phases ((#:phases phases)
(add-after 'unpack 'patch-docbook-xml `(modify-phases ,phases
(lambda* (#:key inputs #:allow-other-keys) (add-after 'unpack 'patch-docbook-xml
(with-directory-excursion "docs" (lambda* (#:key inputs #:allow-other-keys)
(substitute* (find-files "." "\\.xml$") (with-directory-excursion "docs"
(("http://www.oasis-open.org/docbook/xml/4\\.5/") (substitute* (find-files "." "\\.xml$")
(string-append (assoc-ref inputs "docbook-xml-4.5") (("http://www.oasis-open.org/docbook/xml/4\\.5/")
"/xml/dtd/docbook/")) (string-append (assoc-ref inputs "docbook-xml-4.5")
(("http://www.oasis-open.org/docbook/xml/4\\.2/") "/xml/dtd/docbook/"))
(string-append (assoc-ref inputs "docbook-xml-4.2") (("http://www.oasis-open.org/docbook/xml/4\\.2/")
"/xml/dtd/docbook/")))))) (string-append (assoc-ref inputs "docbook-xml-4.2")
(add-after 'install 'move-doc "/xml/dtd/docbook/"))))))
(lambda* (#:key outputs #:allow-other-keys) (add-after 'install 'move-doc
(let* ((out (assoc-ref outputs "out")) (lambda* (#:key outputs #:allow-other-keys)
(doc (assoc-ref outputs "doc")) (let* ((out (assoc-ref outputs "out"))
(html (string-append "/share/gtk-doc"))) (doc (assoc-ref outputs "doc"))
(mkdir-p (string-append doc "/share")) (html (string-append "/share/gtk-doc")))
(rename-file (mkdir-p (string-append doc "/share"))
(string-append out html) (rename-file
(string-append doc html))))))))))) (string-append out html)
(string-append doc html))))))))))))
(define (python-extension-suffix python triplet) (define (python-extension-suffix python triplet)
"Determine the suffix for C extensions for PYTHON when compiled "Determine the suffix for C extensions for PYTHON when compiled