diff mbox

[2/3] build/perl-build-system: Add `wrap` phase.

Message ID 20161116132734.5943-3-alex@pompo.co
State New
Headers show

Commit Message

Alex Sassmannshausen Nov. 16, 2016, 1:27 p.m. UTC
* guix/build/perl-build-system.scm (wrap): New procedure.
  (%standard-phases): Add `wrap` phase.
---
 guix/build/perl-build-system.scm | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/guix/build/perl-build-system.scm b/guix/build/perl-build-system.scm
index 8f480ea..861d75c 100644
--- a/guix/build/perl-build-system.scm
+++ b/guix/build/perl-build-system.scm
@@ -19,7 +19,7 @@ 
 (define-module (guix build perl-build-system)
   #:use-module ((guix build gnu-build-system) #:prefix gnu:)
   #:use-module (guix build utils)
-  #:use-module (ice-9 match)
+  #:use-module (srfi srfi-1)
   #:export (%standard-phases
             perl-build))
 
@@ -47,6 +47,15 @@ 
     (format #t "running `perl' with arguments ~s~%" args)
     (zero? (apply system* "perl" args))))
 
+;; Use `wrap-language-program' to return an executable wrapper for perl.
+(define wrap
+  (wrap-language-programs
+   (lambda (inputs outputs)
+     (string-append (assoc-ref outputs "out") "/lib/perl5/site_perl/"
+                    ;; As in python, assume version at end of `perl' string.
+                    (last (string-split (assoc-ref inputs "perl") #\-))))
+   "PERL5LIB"))
+
 (define-syntax-rule (define-w/gnu-fallback* (name args ...) body ...)
   (define* (name args ... #:rest rest)
     (if (access? "Build" X_OK)
@@ -70,9 +79,11 @@ 
 
 (define %standard-phases
   ;; Everything is as with the GNU Build System except for the `configure',
-  ;; `build', `check', and `install' phases.
+  ;; `build', `check', and `install' phases.  We also add a `wrap' phase to
+  ;; wrap perl binaries with a complete PERL5LIB path.
   (modify-phases gnu:%standard-phases
     (replace 'install install)
+    (add-after 'install 'wrap wrap)
     (replace 'check check)
     (replace 'build build)
     (replace 'configure configure)))