From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: Re: Using a function as build-step? Date: Tue, 06 Sep 2016 09:20:57 +0200 Message-ID: <87poohv6hy.fsf@elephly.net> References: <0b8f97f5-d931-a344-1000-8ab64233f026@goebel-consult.de> <87k2equkl8.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhAh3-0001Sp-6H for guix-devel@gnu.org; Tue, 06 Sep 2016 03:21:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhAh1-0005ru-Vd for guix-devel@gnu.org; Tue, 06 Sep 2016 03:21:17 -0400 In-reply-to: <87k2equkl8.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: Guix-devel , Hartmut Goebel Ludovic Courtès writes: > Hi! > > Hartmut Goebel 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 > . > >> 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