summary refs log tree commit diff
path: root/gnu/packages/gtk.scm
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2021-01-03 21:18:58 +0100
committerRicardo Wurmus <rekado@elephly.net>2021-01-03 22:38:50 +0100
commitb9a372066669b863a872efd0a48940f16a0a3698 (patch)
treef83e0b2e2c191432a283301be777845ed06c4c9c /gnu/packages/gtk.scm
parent3e31727b57c73710b9a4d818562ee988c19eea89 (diff)
downloadguix-b9a372066669b863a872efd0a48940f16a0a3698.tar.gz
gnu: guile-cairo: Compile Scheme sources.
* gnu/packages/gtk.scm (guile-cairo)[arguments]: Add phase "install-go-files".
Diffstat (limited to 'gnu/packages/gtk.scm')
-rw-r--r--gnu/packages/gtk.scm33
1 files changed, 30 insertions, 3 deletions
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index f15ce07b51..5e090eb5ed 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -8,7 +8,7 @@
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
 ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
 ;;; Copyright © 2015 David Hashe <david.hashe@dhashe.com>
-;;; Coypright © 2015, 2016, 2017, 2018, 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Coypright © 2015, 2016, 2017, 2018, 2020, 2021 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016, 2017, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Fabian Harfert <fhmgufs@web.de>
 ;;; Copyright © 2016 Kei Kebreau <kkebreau@posteo.net>
@@ -951,8 +951,35 @@ application suites.")
     (arguments
      ;; Uses of 'scm_t_uint8' & co. are deprecated; don't stop the build
      ;; because of them.
-     '(#:configure-flags '("--disable-Werror")
-       #:make-flags '("GUILE_AUTO_COMPILE=0")))     ; to prevent guild warnings
+     `(#:configure-flags '("--disable-Werror")
+       #:make-flags '("GUILE_AUTO_COMPILE=0") ; to prevent guild warnings
+       #:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (ice-9 rdelim)
+                  (ice-9 popen))
+       #:phases
+       (modify-phases %standard-phases
+         (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))))))
     (inputs
      `(("guile-lib" ,guile-lib)
        ("expat" ,expat)