[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase.
From: |
Arun Isaac |
Subject: |
bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase. |
Date: |
Tue, 28 Mar 2017 01:08:50 +0530 |
* guix/build/perl-build-system.scm (wrap): New procedure.
(%standard-phases): Add it.
---
guix/build/perl-build-system.scm | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/guix/build/perl-build-system.scm b/guix/build/perl-build-system.scm
index 8f480eae1..32ef86b65 100644
--- a/guix/build/perl-build-system.scm
+++ b/guix/build/perl-build-system.scm
@@ -19,7 +19,10 @@
(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 ftw)
#:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:export (%standard-phases
perl-build))
@@ -68,6 +71,31 @@
(define-w/gnu-fallback* (install)
(zero? (system* "./Build" "install")))
+(define* (wrap #:key inputs outputs #:allow-other-keys)
+ (define (list-of-files dir)
+ (map (cut string-append dir "/" <>)
+ (or (scandir dir (lambda (f)
+ (let ((s (stat (string-append dir "/" f))))
+ (eq? 'regular (stat:type s)))))
+ '())))
+
+ (define bindirs
+ (append-map (match-lambda
+ ((_ . dir)
+ (list (string-append dir "/bin")
+ (string-append dir "/sbin"))))
+ outputs))
+
+ (let* ((out (assoc-ref outputs "out"))
+ (var `("PERL5LIB" prefix
+ ,(search-path-as-string->list
+ (or (getenv "PERL5LIB") "")))))
+ (for-each (lambda (dir)
+ (let ((files (list-of-files dir)))
+ (for-each (cut wrap-program <> var)
+ files)))
+ bindirs)))
+
(define %standard-phases
;; Everything is as with the GNU Build System except for the `configure',
;; `build', `check', and `install' phases.
@@ -75,6 +103,7 @@
(replace 'install install)
(replace 'check check)
(replace 'build build)
+ (add-after 'install 'wrap wrap)
(replace 'configure configure)))
(define* (perl-build #:key inputs (phases %standard-phases)
--
2.11.0
- bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase.,
Arun Isaac <=