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