Archived
1
0
Fork 0

gnu: glib: Use gexps.

* gnu/packages/glib.scm (glib)[arguments]: Use a plain list.
[disallowed-references]: Adjust accordingly.
[configure-flags]: Likewise.
[phases]: Use gexps.
(glib-with-documentation)[phases]: Use gexps.
This commit is contained in:
Maxim Cournoyer 2022-08-22 12:44:41 -04:00
parent 0eab5926dd
commit c6e4a14458
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -235,125 +235,122 @@ information, refer to the @samp{dbus-daemon(1)} man page.")))
"bin" ;executables; depends on Python "bin" ;executables; depends on Python
"debug")) "debug"))
(arguments (arguments
`(#:disallowed-references (list
(,tzdata-for-tests #:disallowed-references
;; Verify glib-mkenums, gtester, ... use the cross-compiled (cons tzdata-for-tests
;; python. ;; Verify glib-mkenums, gtester, ... use the cross-compiled
,@(if (%current-target-system) ;; python.
(map (cut gexp-input <> #:native? #t) (if (%current-target-system)
`(,(this-package-native-input "python") (map (cut gexp-input <> #:native? #t)
,(this-package-native-input "python-wrapper"))) `(,(this-package-native-input "python")
'())) ,(this-package-native-input "python-wrapper")))
#:configure-flags ,#~(list "--default-library=both" '()))
"-Dman=false" #:configure-flags #~(list "--default-library=both"
"-Dselinux=disabled" "-Dman=false"
(string-append "--bindir=" "-Dselinux=disabled"
#$output:bin "/bin")) (string-append "--bindir="
#:phases #$output:bin "/bin"))
(modify-phases %standard-phases #:phases
;; Needed to pass the test phase on slower ARM and i686 machines. #~(modify-phases %standard-phases
(add-after 'unpack 'increase-test-timeout ;; Needed to pass the test phase on slower ARM and i686 machines.
(lambda _ (add-after 'unpack 'increase-test-timeout
(substitute* "meson.build" (lambda _
(("(test_timeout.*) = ([[:digit:]]+)" all first second) (substitute* "meson.build"
(string-append first " = " second "0"))))) (("(test_timeout.*) = ([[:digit:]]+)" all first second)
(add-after 'unpack 'disable-failing-tests (string-append first " = " second "0")))))
(lambda _ (add-after 'unpack 'disable-failing-tests
(substitute* "gio/tests/meson.build" (lambda _
((".*'testfilemonitor'.*") ;marked as flaky (substitute* "gio/tests/meson.build"
"")) ((".*'testfilemonitor'.*") ;marked as flaky
(with-directory-excursion "glib/tests" ""))
(substitute* '("unix.c" "utils.c") (with-directory-excursion "glib/tests"
(("[ \t]*g_test_add_func.*;") ""))) (substitute* '("unix.c" "utils.c")
(with-directory-excursion "gio/tests" (("[ \t]*g_test_add_func.*;") "")))
(substitute* '("contenttype.c" "gdbus-address-get-session.c" (with-directory-excursion "gio/tests"
"gdbus-peer.c" "appinfo.c" "desktop-app-info.c") (substitute* '("contenttype.c" "gdbus-address-get-session.c"
(("[ \t]*g_test_add_func.*;") ""))) "gdbus-peer.c" "appinfo.c" "desktop-app-info.c")
(("[ \t]*g_test_add_func.*;") "")))
,@(if (target-x86-32?) #$@(if (target-x86-32?)
;; Comment out parts of timer.c that fail on i686 due to ;; Comment out parts of timer.c that fail on i686 due to
;; excess precision when building with GCC 10: ;; excess precision when building with GCC 10:
;; <https://gitlab.gnome.org/GNOME/glib/-/issues/820>. ;; <https://gitlab.gnome.org/GNOME/glib/-/issues/820>.
'((substitute* "glib/tests/timer.c" '((substitute* "glib/tests/timer.c"
(("^ g_assert_cmpuint \\(micros.*" all) (("^ g_assert_cmpuint \\(micros.*" all)
(string-append "//" all "\n")) (string-append "//" all "\n"))
(("^ g_assert_cmpfloat \\(elapsed, ==.*" all) (("^ g_assert_cmpfloat \\(elapsed, ==.*" all)
(string-append "//" all "\n")))) (string-append "//" all "\n"))))
'()))) '())))
;; Python references are not being patched in patch-phase of build, ;; Python references are not being patched in patch-phase of build,
;; despite using python-wrapper as input. So we patch them manually. ;; despite using python-wrapper as input. So we patch them manually.
;; ;;
;; These python scripts are both used during build and installed, ;; These python scripts are both used during build and installed,
;; so at first, use a python from 'native-inputs', not 'inputs'. When ;; so at first, use a python from 'native-inputs', not 'inputs'. When
;; cross-compiling, the 'patch-shebangs' phase will replace ;; cross-compiling, the 'patch-shebangs' phase will replace
;; the native python with a python from 'inputs'. ;; the native python with a python from 'inputs'.
(add-after 'unpack 'patch-python-references (add-after 'unpack 'patch-python-references
(lambda* (#:key native-inputs inputs #:allow-other-keys) (lambda* (#:key native-inputs inputs #:allow-other-keys)
(substitute* '("gio/gdbus-2.0/codegen/gdbus-codegen.in" (substitute* '("gio/gdbus-2.0/codegen/gdbus-codegen.in"
"glib/gtester-report.in" "glib/gtester-report.in"
"gobject/glib-genmarshal.in" "gobject/glib-genmarshal.in"
"gobject/glib-mkenums.in") "gobject/glib-mkenums.in")
(("@PYTHON@") (("@PYTHON@")
(search-input-file (or native-inputs inputs) (search-input-file (or native-inputs inputs)
(string-append (string-append
"/bin/python" "/bin/python"
,(version-major+minor #$(version-major+minor
(package-version python)))))))) (package-version python))))))))
(add-before 'check 'pre-check (add-before 'check 'pre-check
(lambda* (#:key native-inputs inputs outputs #:allow-other-keys) (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
;; For tests/gdatetime.c. ;; For tests/gdatetime.c.
(setenv "TZDIR" (setenv "TZDIR"
(search-input-directory (or native-inputs inputs) (search-input-directory (or native-inputs inputs)
"share/zoneinfo")) "share/zoneinfo"))
;; Some tests want write access there. ;; Some tests want write access there.
(setenv "HOME" (getcwd)) (setenv "HOME" (getcwd))
(setenv "XDG_CACHE_HOME" (getcwd)))) (setenv "XDG_CACHE_HOME" (getcwd))))
(add-after 'install 'move-static-libraries (add-after 'install 'move-static-libraries
(lambda* (#:key outputs #:allow-other-keys) (lambda _
(let ((out (assoc-ref outputs "out")) (mkdir-p (string-append #$output:static "/lib"))
(static (assoc-ref outputs "static"))) (for-each (lambda (a)
(mkdir-p (string-append static "/lib")) (rename-file a (string-append #$output:static "/lib/"
(for-each (lambda (a) (basename a))))
(rename-file a (string-append static "/lib/" (find-files #$output "\\.a$"))))
(basename a)))) (add-after 'install 'patch-pkg-config-files
(find-files out "\\.a$"))))) (lambda* (#:key outputs #:allow-other-keys)
(add-after 'install 'patch-pkg-config-files ;; Do not refer to "bindir", which points to "${prefix}/bin".
(lambda* (#:key outputs #:allow-other-keys) ;; We don't patch "bindir" to point to "$bin/bin", because that
(let ((out (assoc-ref outputs "out"))) ;; would create a reference cycle between the "out" and "bin"
;; Do not refer to "bindir", which points to "${prefix}/bin". ;; outputs.
;; We don't patch "bindir" to point to "$bin/bin", because that (substitute*
;; would create a reference cycle between the "out" and "bin" (list (search-input-file outputs "lib/pkgconfig/gio-2.0.pc")
;; outputs. (search-input-file outputs "lib/pkgconfig/glib-2.0.pc"))
(substitute* (("^bindir=.*")
(list "")
(string-append out "/lib/pkgconfig/gio-2.0.pc") (("=\\$\\{bindir\\}/")
(string-append out "/lib/pkgconfig/glib-2.0.pc")) "=")))))))
(("^bindir=.*")
"")
(("=\\$\\{bindir\\}/")
"="))))))))
(native-inputs (native-inputs
`(("dbus" ,dbus) (list dbus
("gettext" ,gettext-minimal) gettext-minimal
("m4" ,m4) ; for installing m4 macros m4 ;for installing m4 macros
("perl" ,perl) ; needed by GIO tests perl ;needed by GIO tests
("pkg-config" ,pkg-config) pkg-config
("python" ,python) ; For 'patch-python-references python ;for 'patch-python-references
("python-wrapper" ,python-wrapper) python-wrapper
("tzdata" ,tzdata-for-tests))) ; for tests/gdatetime.c tzdata-for-tests)) ;for tests/gdatetime.c
(inputs (inputs
(list ;; "python", "python-wrapper" and "bash-minimal" (list ;; "python", "python-wrapper" and "bash-minimal"
;; are for the 'patch-shebangs' phase, to make ;; are for the 'patch-shebangs' phase, to make
;; sure the installed scripts end up with a correct shebang ;; sure the installed scripts end up with a correct shebang
;; when cross-compiling. ;; when cross-compiling.
bash-minimal bash-minimal
python python
python-wrapper)) python-wrapper))
(propagated-inputs (propagated-inputs
(list libffi ; in the Requires.private field of gobject-2.0.pc (list libffi ;in the Requires.private field of gobject-2.0.pc
pcre ; in the Requires.private field of glib-2.0.pc pcre ;in the Requires.private field of glib-2.0.pc
`(,util-linux "lib") ;for libmount `(,util-linux "lib") ;for libmount
zlib)) ; in the Requires.private field of glib-2.0.pc zlib)) ;in the Requires.private field of glib-2.0.pc
(native-search-paths (native-search-paths
;; This variable is not really "owned" by GLib, but several related ;; This variable is not really "owned" by GLib, but several related
;; packages refer to it: gobject-introspection's tools use it as a search ;; packages refer to it: gobject-introspection's tools use it as a search
@ -397,26 +394,24 @@ functions for strings and common data structures.")
#~(cons "-Dgtk_doc=true" #~(cons "-Dgtk_doc=true"
(delete "-Dman=false" #$flags))) (delete "-Dman=false" #$flags)))
((#:phases phases) ((#:phases phases)
`(modify-phases ,phases #~(modify-phases #$phases
(add-after 'unpack 'patch-docbook-xml (add-after 'unpack 'patch-docbook-xml
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(with-directory-excursion "docs" (with-directory-excursion "docs"
(substitute* (find-files "." "\\.xml$") (substitute* (find-files "." "\\.xml$")
(("http://www.oasis-open.org/docbook/xml/4\\.5/") (("http://www.oasis-open.org/docbook/xml/4\\.5/")
(string-append (assoc-ref inputs "docbook-xml-4.5") (string-append (assoc-ref inputs "docbook-xml-4.5")
"/xml/dtd/docbook/")) "/xml/dtd/docbook/"))
(("http://www.oasis-open.org/docbook/xml/4\\.2/") (("http://www.oasis-open.org/docbook/xml/4\\.2/")
(string-append (assoc-ref inputs "docbook-xml-4.2") (string-append (assoc-ref inputs "docbook-xml-4.2")
"/xml/dtd/docbook/")))))) "/xml/dtd/docbook/"))))))
(add-after 'install 'move-doc (add-after 'install 'move-doc
(lambda* (#:key outputs #:allow-other-keys) (lambda _
(let* ((out (assoc-ref outputs "out")) (let ((html "/share/gtk-doc"))
(doc (assoc-ref outputs "doc")) (mkdir-p (string-append #$output:doc "/share"))
(html (string-append "/share/gtk-doc"))) (rename-file
(mkdir-p (string-append doc "/share")) (string-append #$output html)
(rename-file (string-append #$output: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