gnu: glib: Add "static" output.

* gnu/packages/glib.scm (glib)[outputs]: Add "static".
[arguments]: Add "--default-library=both" to #:configure-flags.  Add phase
move-static-libraries.
(glib-static): Remove variable.
* gnu/packages/virtualization.scm (qemu)[native-inputs]: Change from
GLIB-STATIC to GLIB:STATIC.
This commit is contained in:
Marius Bakke 2021-05-22 22:46:43 +02:00
parent 425df5b081
commit 557084a0c9
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
2 changed files with 17 additions and 34 deletions

View File

@ -11,7 +11,7 @@
;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com> ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
;;; Copyright © 2019, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2019, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org> ;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org>
;;; Copyright © 2019, 2020 Marius Bakke <mbakke@fastmail.com> ;;; Copyright © 2019, 2020, 2021 Marius Bakke <marius@gnu.org>
;;; Copyright © 2020 Nicolò Balzarotti <nicolo@nixo.xyz> ;;; Copyright © 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de> ;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
@ -194,13 +194,14 @@ shared NFS home directories.")
(substitute* "tests/spawn-test.c" (substitute* "tests/spawn-test.c"
(("/bin/sh") "sh")) (("/bin/sh") "sh"))
#t)))) #t))))
;; (properties '((hidden? . #t)))
(build-system meson-build-system) (build-system meson-build-system)
(outputs '("out" ; everything (outputs '("out" ;libraries, locales, etc
"bin")) ; glib-mkenums, gtester, etc.; depends on Python "static" ;static libraries
"bin")) ;executables; depends on Python
(arguments (arguments
`(#:disallowed-references (,tzdata-for-tests) `(#:disallowed-references (,tzdata-for-tests)
#:configure-flags '("-Dman=true" #:configure-flags '("--default-library=both"
"-Dman=true"
"-Dselinux=disabled") "-Dselinux=disabled")
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
@ -244,6 +245,16 @@ shared NFS home directories.")
(setenv "HOME" (getcwd)) (setenv "HOME" (getcwd))
(setenv "XDG_CACHE_HOME" (getcwd)) (setenv "XDG_CACHE_HOME" (getcwd))
#t)) #t))
(add-after 'install 'move-static-libraries
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(static (assoc-ref outputs "static")))
(mkdir-p (string-append static "/lib"))
(for-each (lambda (file)
(link file (string-append static "/lib/"
(basename file)))
(delete-file file))
(find-files (string-append out "/lib") "\\.a$")))))
;; Meson does not permit the bindir to be outside of prefix. ;; Meson does not permit the bindir to be outside of prefix.
(add-after 'install 'move-bin (add-after 'install 'move-bin
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
@ -352,34 +363,6 @@ functions for strings and common data structures.")
(string-append doc html)) (string-append doc html))
#t))))))))) #t)))))))))
;;; TODO: Merge into glib as a 'static' output on core-updates.
(define-public glib-static
(hidden-package
(package
(inherit glib)
(name "glib-static")
(outputs '("out"))
(arguments
(substitute-keyword-arguments (package-arguments glib)
((#:configure-flags flags ''())
`(cons* "--default-library=static"
"-Dselinux=disabled"
"-Dman=false"
"-Dgtk_doc=false"
"-Dinternal_pcre=false"
,flags))
((#:phases phases)
`(modify-phases ,phases
(delete 'move-executables)
(replace 'install
;; Only install the static libraries.
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(lib (string-append out "/lib")))
(for-each (lambda (f)
(install-file f lib))
(find-files "." "\\.a$"))))))))))))
(define gobject-introspection (define gobject-introspection
(package (package
(name "gobject-introspection") (name "gobject-introspection")

View File

@ -366,7 +366,7 @@ exec smbd $@")))
("texinfo" ,texinfo) ("texinfo" ,texinfo)
;; The following static libraries are required to build ;; The following static libraries are required to build
;; the static output of QEMU. ;; the static output of QEMU.
("glib-static" ,glib-static) ("glib:static" ,glib "static")
("pcre:static" ,pcre "static") ("pcre:static" ,pcre "static")
("zlib:static" ,zlib "static"))) ("zlib:static" ,zlib "static")))
(home-page "https://www.qemu.org") (home-page "https://www.qemu.org")