diff options
author | Raghav Gururajan <raghavgururajan@disroot.org> | 2020-08-14 15:21:23 +0200 |
---|---|---|
committer | Danny Milosavljevic <dannym@scratchpost.org> | 2020-08-19 19:04:02 +0200 |
commit | f6b23446c13d016f14c5b3f477ea017a46f0b85a (patch) | |
tree | 9245fd83f4fab4d7be42ee48f153e8a5fc28c106 | |
parent | f5b7332a6b5de73bba9b3d37b6e34ed83168cd56 (diff) | |
download | guix-f6b23446c13d016f14c5b3f477ea017a46f0b85a.tar.gz |
build-system/meson: Wrap Python executables, too.
* guix/build-system/meson.scm (%meson-build-system-modules): Add %python-build-system-modules. (lower): Add #:glib-or-gtk? and #:python? to private-keywords. (meson-build): Add #:python? to formal parameters and pass it to... * guix/build/meson-build-system.scm (meson-build): ...this. (install-glib-or-gtk): New procedure. (install-python): New procedure. (%standard-phases): Start from gnu:%standard-phases instead of glib-or-gtk:%standard-phases. [install-glib-or-gtk]: New phase. [install-python]: New phase. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
-rw-r--r-- | guix/build-system/meson.scm | 16 | ||||
-rw-r--r-- | guix/build/meson-build-system.scm | 20 |
2 files changed, 24 insertions, 12 deletions
diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm index b68bcb80de..9a38cdbc77 100644 --- a/guix/build-system/meson.scm +++ b/guix/build-system/meson.scm @@ -25,6 +25,7 @@ #:use-module (guix build-system) #:use-module (guix build-system gnu) #:use-module (guix build-system glib-or-gtk) + #:use-module (guix build-system python) #:use-module (guix packages) #:use-module (ice-9 match) #:export (%meson-build-system-modules @@ -43,7 +44,8 @@ `((guix build meson-build-system) ;; The modules from glib-or-gtk contains the modules from gnu-build-system, ;; so there is no need to import that too. - ,@%glib-or-gtk-build-system-modules)) + ,@%glib-or-gtk-build-system-modules + ,@%python-build-system-modules)) (define (default-ninja) "Return the default ninja package." @@ -61,12 +63,11 @@ #:key source inputs native-inputs outputs system target (meson (default-meson)) (ninja (default-ninja)) - (glib-or-gtk? #f) #:allow-other-keys #:rest arguments) "Return a bag for NAME." (define private-keywords - `(#:source #:meson #:ninja #:inputs #:native-inputs #:outputs #:target)) + `(#:source #:meson #:ninja #:inputs #:native-inputs #:outputs #:target #:glib-or-gtk? #:python?)) (and (not target) ;; TODO: add support for cross-compilation. (bag @@ -94,6 +95,7 @@ (tests? #t) (test-target "test") (glib-or-gtk? #f) + (python? #f) (parallel-build? #t) (parallel-tests? #f) (validate-runpath? #t) @@ -129,11 +131,7 @@ has a 'meson.build' file." output))) (define builder - `(let ((build-phases (if ,glib-or-gtk? - ,phases - (modify-phases ,phases - (delete 'glib-or-gtk-compile-schemas) - (delete 'glib-or-gtk-wrap))))) + `(let ((build-phases ,phases)) (use-modules ,@modules) (meson-build #:source ,(match (assoc-ref inputs "source") (((? derivation? source)) @@ -151,6 +149,8 @@ has a 'meson.build' file." #:configure-flags ,configure-flags #:build-type ,build-type #:tests? ,tests? + #:glib-or-gtk? ,glib-or-gtk? + #:python? ,python? #:test-target ,test-target #:parallel-build? ,parallel-build? #:parallel-tests? ,parallel-tests? diff --git a/guix/build/meson-build-system.scm b/guix/build/meson-build-system.scm index 8043a84abb..01e0b474b6 100644 --- a/guix/build/meson-build-system.scm +++ b/guix/build/meson-build-system.scm @@ -21,6 +21,7 @@ (define-module (guix build meson-build-system) #:use-module ((guix build gnu-build-system) #:prefix gnu:) #:use-module ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:) + #:use-module ((guix build python-build-system) #:prefix python:) #:use-module (guix build utils) #:use-module (guix build gremlin) #:use-module (guix elf) @@ -77,6 +78,18 @@ (define* (install #:rest args) (invoke "ninja" "install")) +(define* (install-glib-or-gtk #:key glib-or-gtk? #:allow-other-keys #:rest rest) + (if glib-or-gtk? + (and + (apply (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas) rest) + (apply (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap) rest)) + #t)) + +(define* (install-python #:key python? #:allow-other-keys #:rest rest) + (if python? + (apply (assoc-ref python:%standard-phases 'wrap) rest) + #t)) + (define* (shrink-runpath #:key (elf-directories '("lib" "lib64" "libexec" "bin" "sbin")) outputs #:allow-other-keys) @@ -104,15 +117,14 @@ for example libraries only needed for the tests." #t) (define %standard-phases - ;; The standard-phases of glib-or-gtk contains a superset of the phases - ;; from the gnu-build-system. If the glib-or-gtk? key is #f (the default) - ;; then the extra phases will be removed again in (guix build-system meson). - (modify-phases glib-or-gtk:%standard-phases + (modify-phases gnu:%standard-phases (delete 'bootstrap) (replace 'configure configure) (replace 'build build) (replace 'check check) (replace 'install install) + (add-after 'install 'install-glib-or-gtk install-glib-or-gtk) + (add-after 'install 'install-python install-python) (add-after 'strip 'shrink-runpath shrink-runpath))) (define* (meson-build #:key inputs phases |