unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Guix-devel <guix-devel@gnu.org>,
	Hartmut Goebel <h.goebel@goebel-consult.de>
Subject: Re: Using a function as build-step?
Date: Tue, 06 Sep 2016 09:20:57 +0200	[thread overview]
Message-ID: <87poohv6hy.fsf@elephly.net> (raw)
In-Reply-To: <87k2equkl8.fsf@gnu.org>


Ludovic Courtès <ludo@gnu.org> writes:

> Hi!
>
> Hartmut Goebel <h.goebel@goebel-consult.de> 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	other threads:[~2016-09-06  7:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-03 18:22 Using a function as build-step? Hartmut Goebel
2016-09-03 18:35 ` David Craven
2016-09-04 11:25   ` Hartmut Goebel
2016-09-04 11:29     ` David Craven
2016-09-04 11:43       ` Hartmut Goebel
2016-09-04 11:43       ` Using a function as build-step? (w/ attachement) Hartmut Goebel
2016-09-04 15:33         ` David Craven
2016-09-05 21:01 ` Using a function as build-step? Ludovic Courtès
2016-09-06  7:20   ` Ricardo Wurmus [this message]
2016-09-06  7:35     ` Hartmut Goebel

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=87poohv6hy.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=guix-devel@gnu.org \
    --cc=h.goebel@goebel-consult.de \
    --cc=ludo@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).