unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Reference a store path of an input?
@ 2021-12-17  3:20 Jim Newsome
  2021-12-17  8:40 ` Guillaume Le Vaillant
  2021-12-17  8:41 ` Nicolas Goaziou
  0 siblings, 2 replies; 5+ messages in thread
From: Jim Newsome @ 2021-12-17  3:20 UTC (permalink / raw)
  To: help-guix

I'm just getting started experimenting with guix and guile, so I'm 
likely missing something obvious.

I'm trying to write a package definition for some software that builds 
with cmake and uses glib. The software searches some paths explicitly to 
find the glib headers etc; it should be fixed to use pkg-config instead, 
but I'd like to figure out how to work around it both as a learning 
exercise and so that I can work around it before I can get a fix merged.

I'd like to add some explicit flags to the cmake invocation so that it 
knows where to find glib. What do I substitute in for "get-store-path" 
below? Pointers to how I might have found the appropriate helper or 
approach on my own also appreciated.

```
(define-public oniontrace
   (package
     (name "oniontrace")
     (build-system cmake-build-system)
     (inputs `(("glib", glib)))
     (arguments
       '(#:configure-flags
          (list (string-append "-DCMAKE_EXTRA_INCLUDES=" (get-store-path 
  "glib") "/include"))))
...
```


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reference a store path of an input?
  2021-12-17  3:20 Reference a store path of an input? Jim Newsome
@ 2021-12-17  8:40 ` Guillaume Le Vaillant
  2021-12-18 15:24   ` Jim Newsome
  2021-12-17  8:41 ` Nicolas Goaziou
  1 sibling, 1 reply; 5+ messages in thread
From: Guillaume Le Vaillant @ 2021-12-17  8:40 UTC (permalink / raw)
  To: Jim Newsome; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 1271 bytes --]

Jim Newsome <jim@sporksmith.net> skribis:

> I'm just getting started experimenting with guix and guile, so I'm likely
> missing something obvious.
>
> I'm trying to write a package definition for some software that builds with
> cmake and uses glib. The software searches some paths explicitly to find the
> glib headers etc; it should be fixed to use pkg-config instead, but I'd like to
> figure out how to work around it both as a learning exercise and so that I can
> work around it before I can get a fix merged.
>
> I'd like to add some explicit flags to the cmake invocation so that it knows
> where to find glib. What do I substitute in for "get-store-path" below?
> Pointers to how I might have found the appropriate helper or approach on my own
> also appreciated.
>
> ```
> (define-public oniontrace
>   (package
>     (name "oniontrace")
>     (build-system cmake-build-system)
>     (inputs `(("glib", glib)))
>     (arguments
>       '(#:configure-flags
>          (list (string-append "-DCMAKE_EXTRA_INCLUDES=" (get-store-path
>          "glib") "/include"))))
> ...
> ```

I think you're looking for the 'search-input-directory' or
'search-input-file' function.
There is some info about them in [1].

[1] https://guix.gnu.org/fr/blog/2021/the-big-change/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reference a store path of an input?
  2021-12-17  3:20 Reference a store path of an input? Jim Newsome
  2021-12-17  8:40 ` Guillaume Le Vaillant
@ 2021-12-17  8:41 ` Nicolas Goaziou
  2021-12-18 15:21   ` Jim Newsome
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2021-12-17  8:41 UTC (permalink / raw)
  To: Jim Newsome; +Cc: help-guix

Hello,

Jim Newsome <jim@sporksmith.net> writes:

> I'm just getting started experimenting with guix and guile

Great!

> I'd like to add some explicit flags to the cmake invocation so that it
> knows where to find glib. What do I substitute in for "get-store-path" 
> below? Pointers to how I might have found the appropriate helper or
> approach on my own also appreciated.

You may want to read about G-Expressions in Guix manual. See also
<https://guix.gnu.org/fr/blog/2021/the-big-change/> for addition
insight.

> ```
> (define-public oniontrace
>   (package
>     (name "oniontrace")
>     (build-system cmake-build-system)
>     (inputs `(("glib", glib)))
>     (arguments
>       '(#:configure-flags
>          (list (string-append "-DCMAKE_EXTRA_INCLUDES="
>          (get-store-path   "glib") "/include"))))
> ...
> ```

I should be:

(arguments
 (list
  #:configure-flags
  #~(list (string-append "-DCMAKE_EXTRA_INCLUDES=" #$glib "/include"))))

Regards,
-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reference a store path of an input?
  2021-12-17  8:41 ` Nicolas Goaziou
@ 2021-12-18 15:21   ` Jim Newsome
  0 siblings, 0 replies; 5+ messages in thread
From: Jim Newsome @ 2021-12-18 15:21 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: help-guix



On 12/17/21 2:41 AM, Nicolas Goaziou wrote:
> You may want to read about G-Expressions in Guix manual.

Yup, I see a lot of the details I was having trouble finding are in 8.8 
Derivations and 8.10 G-Expressions.

> See also
> <https://guix.gnu.org/fr/blog/2021/the-big-change/> for addition
> insight.

Hah, well of course I'd be trying to learn in the middle of a big 
change. I was getting confused seeing a mix of docs and examples doing 
things the old way and the new way; this clarifies a lot.

> I should be:
> 
> (arguments
>   (list
>    #:configure-flags
>    #~(list (string-append "-DCMAKE_EXTRA_INCLUDES=" #$glib "/include"))))

Yup, this works.

Thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reference a store path of an input?
  2021-12-17  8:40 ` Guillaume Le Vaillant
@ 2021-12-18 15:24   ` Jim Newsome
  0 siblings, 0 replies; 5+ messages in thread
From: Jim Newsome @ 2021-12-18 15:24 UTC (permalink / raw)
  To: Guillaume Le Vaillant; +Cc: help-guix

On 12/17/21 2:40 AM, Guillaume Le Vaillant wrote:
> I think you're looking for the 'search-input-directory' or
> 'search-input-file' function.
> There is some info about them in [1].
> 
> [1] https://guix.gnu.org/fr/blog/2021/the-big-change/
> 

After reading the blog post I ended up using `$#glib`, but I see how 
this could work too. The blog post is super helpful; thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-18 15:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-17  3:20 Reference a store path of an input? Jim Newsome
2021-12-17  8:40 ` Guillaume Le Vaillant
2021-12-18 15:24   ` Jim Newsome
2021-12-17  8:41 ` Nicolas Goaziou
2021-12-18 15:21   ` Jim Newsome

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).