unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Arun Isaac <arunisaac@systemreboot.net>
To: 26275@debbugs.gnu.org
Subject: bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase.
Date: Tue, 28 Mar 2017 01:08:50 +0530	[thread overview]
Message-ID: <3389aacc.ADsAAG-tXNgAAAAAAAAAAAOtUOAAAAACwQwAAAAAAAW9WABY2Wpd@mailjet.com> (raw)

* 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


             reply	other threads:[~2017-03-27 19:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 19:38 Arun Isaac [this message]
2017-03-28 15:18 ` bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3389aacc.ADsAAG-tXNgAAAAAAAAAAAOtUOAAAAACwQwAAAAAAAW9WABY2Wpd@mailjet.com \
    --to=arunisaac@systemreboot.net \
    --cc=26275@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).