unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase.
@ 2017-03-27 19:38 Arun Isaac
  2017-03-28 15:18 ` Marius Bakke
  2020-11-16 18:03 ` Jonathan Brielmaier
  0 siblings, 2 replies; 9+ messages in thread
From: Arun Isaac @ 2017-03-27 19:38 UTC (permalink / raw)
  To: 26275

* 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


^ permalink raw reply related	[flat|nested] 9+ messages in thread
[parent not found: <20170327193850.12655-1-arunisaac@systemreboot.net>]

end of thread, other threads:[~2020-11-16 18:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-27 19:38 bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase Arun Isaac
2017-03-28 15:18 ` Marius Bakke
2017-03-28 17:02   ` Arun Isaac
2017-06-02 16:33     ` Ludovic Courtès
2017-06-02 17:40       ` Arun Isaac
2020-11-16 18:03 ` Jonathan Brielmaier
     [not found] <20170327193850.12655-1-arunisaac@systemreboot.net>
2017-03-27 19:49 ` Arun Isaac
2017-03-28 14:33 ` Arun Isaac
2017-04-10 21:53   ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).