guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase.


From: Ludovic Courtès
Subject: bug#26275: [PATCH] build: perl-build-system: Add `wrap' phase.
Date: Mon, 10 Apr 2017 23:53:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Hi,

And sorry for the delay.

Arun Isaac <address@hidden> skribis:

>> +(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)))
>
> I copied this wrap function from the python build system, and modified
> it a little to suite perl. Is there any reason `list-of-files' and
> `bindirs' are initialized using `define' rather than a `let' binding?
> This is probably a very basic Guile question, but still...

It’s purely cosmetic in this case: it makes them more visible and fits
within the 80-column limit.  :-)

Technically:

  (define (proc x y)
    (define a …)
    (define b …)
    body …)

is equivalent to:

  (define (proc x y)
    (letrec ((a …)
             (b …))
      body …))

See <https://gnu.org/software/guile/manual/html_node/Local-Bindings.html>.

HTH!

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]