guix-devel
[Top][All Lists]
Advanced

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

Re: How to add library dependency to guix build


From: Ricardo Wurmus
Subject: Re: How to add library dependency to guix build
Date: Wed, 31 Aug 2016 21:23:26 +0200
User-agent: mu4e 0.9.16; emacs 25.1.1

Hi Tobias,

> I tried to package a speech syntesizer framework called WORLD for Guix,
> which I had earlier packaged for Trisquel. The guix build process does
> not find <sndfile.h>, even if I declared a dependency on libsndfile.

That’s because actually you added pulseaudio, not libsndfile :)

> (define-public world
>   (package
>     (name "world")
>     (version "0.3.1")
>     (source (origin
>               (method url-fetch)
>               (uri (string-append 
> "http://ongakunix.isengaara.de/ongakunix/pool/main/w/world/world_"; version
>                                   ".orig.tar.gz"))
>               (sha256
>                (base32
>                 "0d23rdk9hdwj6q981n3wm6472ygs0mlzkqk4b49w1ifa5l600kfc"))))
>     (build-system cmake-build-system)
>     (inputs `(("libsndfile",pulseaudio)))

Inputs are a list where each item consists of an arbitrary label and a
package value (i.e. the name of a variable in Guix that is bound to a
package expression).  Here you have one item with label “libsndfile” and
the value of the “pulseaudio” package.

If you want to have both pulseaudio and libsndfile do this instead:

(inputs
 `(("libsndfile" ,libsndfile)
   ("pulseaudio" ,pulseaudio)))

One more thing: there’s special Scheme syntax here which needs
explaining, I think.

In Scheme this is how you create a list of three numbers:

    (list 1 2 3)

There is a short form for lists:

    '(1 2 3)

This is called “quote”.  Think of it as declaring “data mode”.
The backtick “`” is used when you want to be able to switch from “data
mode” to “code mode”.  This is equivalent to the above list:

    `(1 2 3)

The backtick allows you to flip to “code mode” to temporarily evaluate
some nested code.  That’s done with the comma:

    `(1 2 ,(- 5 2))

This also results in a list of the numbers 1, 2 and 3.  The backtick is
short for “quasiquote” and the comma stands for “unquote”.

So in the list of inputs the comma just means that we insert the actual
value of the given package variables.

I hope this helps!

~~ Ricardo



reply via email to

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