guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

328/401: build-system/meson: Wrap Python executables, too.


From: guix-commits
Subject: 328/401: build-system/meson: Wrap Python executables, too.
Date: Tue, 18 Aug 2020 16:22:10 -0400 (EDT)

dannym pushed a commit to branch wip-desktop
in repository guix.

commit 0012977751da1f3ba4340389d93e63ec17dd23bd
Author: Raghav Gururajan <raghavgururajan@disroot.org>
AuthorDate: Fri Aug 14 15:21:23 2020 +0200

    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>
---
 guix/build-system/meson.scm       | 16 ++++++++--------
 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 b68bcb8..9a38cdb 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 8043a84..01e0b47 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]