summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2017-11-27 14:03:50 +0100
committerLudovic Courtès <ludo@gnu.org>2017-11-27 14:06:27 +0100
commite8374e6912718dad6b39a18ccc57fc735d2e4c4d (patch)
tree99e6e94ee4cbad4ee522ade79e2d92470c3e83ae
parent89c4bfe7f84044a973e2d8b52b6c3a2cf0f5d9d3 (diff)
downloadguix-e8374e6912718dad6b39a18ccc57fc735d2e4c4d.tar.gz
gnu: guile-wisp: Move .go files to 'lib/guile/2.2/site-ccache'.
* gnu/packages/guile.scm (guile-wisp)[arguments]: Remove (system base
compile) from #:modules, and (ice-9 rdelim) and (ice-9 popen).
In 'install-go-files' phase, invoke 'guild' to compile, and write to
lib/guile/X.Y/site-ccache.
-rw-r--r--gnu/packages/guile.scm27
1 files changed, 19 insertions, 8 deletions
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 6d9c428521..fef15b4dc4 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -1274,8 +1274,11 @@ key-value cache and store.")
                 "1f2bbicq1rxnwmiplrm4r75wj06w385mjkyvi7g4k740bgwcrzxr"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:modules ((system base compile)
-                  ,@%gnu-build-system-modules)
+     `(#:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (ice-9 rdelim)
+                  (ice-9 popen))
+
        #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'substitute-before-config
@@ -1300,14 +1303,22 @@ key-value cache and store.")
          (add-after 'install 'install-go-files
           (lambda* (#:key outputs inputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
-                   (module-dir (string-append out "/share/guile/site")))
+                   (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)
-                          (compile-file file
-                                        #:output-file
-                                        (string-append
-                                         (string-drop-right file 4)
-                                         ".go")))
+                          (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))))))
     (home-page "http://draketo.de/english/wisp")