aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-09-07 18:11:30 +0200
committerLudovic Courtès <ludo@gnu.org>2016-09-07 18:42:46 +0200
commitfe447664d864f3d406862e9fba681c50edf04cfb (patch)
treec35bade8f6c0afd8c4b97ce760b288294d29c680
parent8f3afba44f2092ccb966b4f44ed7eb11c68d5f0a (diff)
downloadguix-fe447664d864f3d406862e9fba681c50edf04cfb.tar
guix-fe447664d864f3d406862e9fba681c50edf04cfb.tar.gz
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.
-rw-r--r--gnu/packages/guile.scm90
1 files changed, 47 insertions, 43 deletions
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index d09cfbfd1a..859e77a6e8 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")