From fe447664d864f3d406862e9fba681c50edf04cfb Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 7 Sep 2016 18:11:30 +0200 Subject: 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 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") -- cgit v1.2.3