guix-commits
[Top][All Lists]
Advanced

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

01/05: gnu: guile-irregex: Remove hard-coded Guile effective version.


From: Ludovic Courtès
Subject: 01/05: gnu: guile-irregex: Remove hard-coded Guile effective version.
Date: Wed, 7 Sep 2016 16:42:55 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit fe447664d864f3d406862e9fba681c50edf04cfb
Author: Ludovic Courtès <address@hidden>
Date:   Wed Sep 7 18:11:30 2016 +0200

    gnu: guile-irregex: Remove hard-coded Guile effective version.
    
    * gnu/packages/guile.scm (guile-irregex)[arguments]: Add (ice-9 popen)
    and (ice-9 rdelim).  Remove nested 'use-modules' form.  Call
    'open-pipe*' to determine Guile's effective version, and use it to
    compute MODULE-DIR.
---
 gnu/packages/guile.scm |   90 +++++++++++++++++++++++++-----------------------
 1 file changed, 47 insertions(+), 43 deletions(-)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index d09cfbf..859e77a 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -632,6 +632,8 @@ See http://minikanren.org/ for more on miniKanren 
generally.")
     (arguments
      `(#:modules ((guix build utils)
                   (ice-9 match)
+                  (ice-9 rdelim)
+                  (ice-9 popen)
                   (guix build gnu-build-system))
        #:phases
        (modify-phases %standard-phases
@@ -640,50 +642,52 @@ See http://minikanren.org/ for more on miniKanren 
generally.")
          (delete 'check)
          (replace 'install
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (begin
-               (use-modules (guix build utils)
-                            (ice-9 match))
-               (let* ((out (assoc-ref outputs "out"))
-                      (module-dir (string-append out "/share/guile/site/2.0"))
-                      (source (assoc-ref inputs "source"))
-                      (doc (string-append out "/share/doc/guile-irregex/"))
-                      (guild (string-append (assoc-ref %build-inputs "guile")
-                                            "/bin/guild")))
-                 ;; Make installation directories.
-                 (mkdir-p (string-append module-dir "/rx/source"))
-                 (mkdir-p doc)
-
-                 ;; Compile .scm files and install.
-                 (setenv "GUILE_AUTO_COMPILE" "0")
-
-                 (for-each (lambda (copy-info)
-                             (match copy-info
-                               ((src-file dest-file-basis)
-                                (let* ((dest-file (string-append
-                                                   module-dir dest-file-basis
-                                                   ".scm"))
-                                       (go-file (string-append
+             (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))
+                    (source (assoc-ref inputs "source"))
+                    (doc (string-append out "/share/doc/guile-irregex/"))
+                    (guild (string-append (assoc-ref %build-inputs "guile")
+                                          "/bin/guild")))
+               ;; Make installation directories.
+               (mkdir-p (string-append module-dir "/rx/source"))
+               (mkdir-p doc)
+
+               ;; Compile .scm files and install.
+               (setenv "GUILE_AUTO_COMPILE" "0")
+
+               (for-each (lambda (copy-info)
+                           (match copy-info
+                             ((src-file dest-file-basis)
+                              (let* ((dest-file (string-append
                                                  module-dir dest-file-basis
-                                                 ".go")))
-                                  ;; Install source module.
-                                  (copy-file src-file
-                                             dest-file)
-                                  ;; Install compiled module.
-                                  (unless (zero? (system* guild "compile"
-                                                          "-L" (getcwd)
-                                                          "-o" go-file
-                                                          src-file))
-                                    (error (format #f "Failed to compile ~s to 
~s!"
-                                                   src-file dest-file)))))))
-                           '(("irregex-guile.scm" "/rx/irregex")
-                             ("irregex.scm" "/rx/source/irregex")
-                             ;; Not really reachable via guile's packaging 
system,
-                             ;; but nice to have around
-                             ("irregex-utils.scm" "/rx/source/irregex-utils")))
-
-                 ;; Also copy over the README.
-                 (install-file "irregex.html" doc)
-                 #t)))))))
+                                                 ".scm"))
+                                     (go-file (string-append
+                                               module-dir dest-file-basis
+                                               ".go")))
+                                ;; Install source module.
+                                (copy-file src-file
+                                           dest-file)
+                                ;; Install compiled module.
+                                (unless (zero? (system* guild "compile"
+                                                        "-L" (getcwd)
+                                                        "-o" go-file
+                                                        src-file))
+                                  (error (format #f "Failed to compile ~s to 
~s!"
+                                                 src-file dest-file)))))))
+                         '(("irregex-guile.scm" "/rx/irregex")
+                           ("irregex.scm" "/rx/source/irregex")
+                           ;; Not really reachable via guile's packaging 
system,
+                           ;; but nice to have around
+                           ("irregex-utils.scm" "/rx/source/irregex-utils")))
+
+               ;; Also copy over the README.
+               (install-file "irregex.html" doc)
+               #t))))))
     (inputs
      `(("guile" ,guile-2.0)))
     (home-page "http://synthcode.com/scheme/irregex";)



reply via email to

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