guix-commits
[Top][All Lists]
Advanced

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

02/03: gnu: guile-rsvg: Compile Scheme files.


From: guix-commits
Subject: 02/03: gnu: guile-rsvg: Compile Scheme files.
Date: Sun, 3 Jan 2021 16:39:34 -0500 (EST)

rekado pushed a commit to branch master
in repository guix.

commit 8caf7939220c464a8982f9bfa44430860067e8aa
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Sun Jan 3 21:19:46 2021 +0100

    gnu: guile-rsvg: Compile Scheme files.
    
    * gnu/packages/gtk.scm (guile-rsvg)[arguments]: Add phase 
"install-go-files".
---
 gnu/packages/gtk.scm | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index 5e090eb..89efcd6 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -1040,10 +1040,36 @@ exceptions, macros, and a dynamic programming 
environment.")
                 (file-name (string-append name "-" version ".tar.gz"))))
       (build-system gnu-build-system)
       (arguments
-       `(#:phases (modify-phases %standard-phases
-                    (replace 'bootstrap
-                      (lambda _
-                        (invoke "autoreconf" "-vfi"))))))
+       `(#:modules ((guix build gnu-build-system)
+                    (guix build utils)
+                    (ice-9 rdelim)
+                    (ice-9 popen))
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'bootstrap
+             (lambda _
+               (invoke "autoreconf" "-vfi")))
+           (add-after 'install 'install-go-files
+             (lambda* (#:key outputs inputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (effective (read-line
+                                  (open-pipe* OPEN_READ
+                                              "guile" "-c"
+                                              "(display 
(effective-version))")))
+                      (module-dir (string-append out "/share/guile/site/"
+                                                 effective))
+                      (object-dir (string-append out "/lib/guile/" effective
+                                                 "/site-ccache"))
+                      (prefix     (string-length module-dir)))
+                 ;; compile to the destination
+                 (for-each (lambda (file)
+                             (let* ((base (string-drop (string-drop-right file 
4)
+                                                       prefix))
+                                    (go   (string-append object-dir base 
".go")))
+                               (invoke "guild" "compile" "-L" module-dir
+                                       file "-o" go)))
+                           (find-files module-dir "\\.scm$"))
+                 #t))))))
       (native-inputs `(("pkg-config" ,pkg-config)
                        ("autoconf" ,autoconf)
                        ("automake" ,automake)



reply via email to

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