guix-devel
[Top][All Lists]
Advanced

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

Re: Using a function as build-step?


From: Ricardo Wurmus
Subject: Re: Using a function as build-step?
Date: Tue, 06 Sep 2016 09:20:57 +0200
User-agent: mu4e 0.9.16; emacs 25.1.1

Ludovic Courtès <address@hidden> writes:

> Hi!
>
> Hartmut Goebel <address@hidden> skribis:
>
>> while packaging some java apache common packages, I found myself adding
>> some build steps over and over again, like this one:
>>
>>          (replace 'install
>>            (lambda* (#:key outputs #:allow-other-keys)
>>              (let ((share (string-append (assoc-ref outputs "out")
>>                                          "/share/java")))
>>                (for-each (λ (f) (install-file f share))
>>                          (find-files "target" "\\.jar$")))))
>>
>> Now I tried replacing this by a simple line like
>>
>>          (add-after 'install 'install-javadocs install-javadocs)
>>
>> and of course some function:
>>
>>   (define* (install-javadoc #:key outputs #:allow-other-keys)
>>     (let ((docs (string-append (assoc-ref outputs "doc")
>>                                "/share/doc/" ,name "-" ,version "/")))
>>       (mkdir-p docs)
>>       (copy-recursively "target/apidocs" docs)
>>       ))
>
> Note that the commas here (aka. “unquote”) mean that this expression
> must be enclosed in a ` (aka. “quasiquote”).  See
> <https://www.gnu.org/software/guile/manual/html_node/Expression-Syntax.html#Expression-Syntax>.
>
>> I did not manage this - not even if not using "name" and "version" and
>> not using any function parameters.
>>
>> What is the correct code?
>
> Like David, I would suggest creating a build-side module, say, (guix
> build java-utils), or maybe augmenting (guix build ant-build-system),
> and putting ‘install-javadoc’ in there (Ricardo?).

I agree.

The “ant-build-system” was designed around the packages that I started
with.  It does not claim to be complete.  Having a configurable
“install-javadoc” phase in the “ant-build-system” seems useful.

~~ Ricardo




reply via email to

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