From: Andreas Enge <andreas@enge.fr>
To: Aristide Doussot <aristide.doussot@obspm.fr>
Cc: help-guix@gnu.org
Subject: Re: Add path to a guix package into CMakeLists.txt
Date: Thu, 3 Oct 2024 15:18:07 +0200 [thread overview]
Message-ID: <Zv6Zj4BRbidIBe9F@jurong> (raw)
In-Reply-To: <d6bc14a7-bd51-454b-8eab-fdffe2b84ea4@obspm.fr>
Hello Aristide,
Am Mon, Sep 30, 2024 at 05:44:26PM +0200 schrieb Aristide Doussot:
> into the already installed guix version of aocommon, in my case it would be
> "include_directories(/gnu/store/1wiw8m5yjcr26pcqhzbh7bw5ghvbaw90-aocommon-0.0.0-1.7329a07/include/)"
> However I don't think other users installing the package would mandatorily
> have "/gnu/store/1wiw8m5yjcr26pcqhzbh7bw5ghvbaw90-aocommon-0.0.0-1.7329a07"
> as their path to their installed guix version of aocommon. My question is
> therefore : is there a way to ask guix to find this path based on the name
> of the dependency and use it in my substitute* command on the CMakeLists
> file ?
this is indeed quite a common action. For instance, I do something like this
in the package vinci in gnu/packages/maths.scm:
(modify-phases %standard-phases
(replace 'configure
;; register the lrs location in the config file
(lambda* (#:key inputs #:allow-other-keys)
(let* ((lrs (assoc-ref inputs "lrslib"))
(lrsexec (string-append lrs "/bin/lrs")))
(substitute* "vinci.h"
(("#define LRS_EXEC \"lrs\"")
(string-append "#define LRS_EXEC \"" lrsexec "\""))))
#t))
So the function defining the phase needs to take the keyword parameter
"inputs", and this is set to the inputs of the package.
Then (assoc-ref inputs "lrslib") resolves to /gnu/store/...-lrslib-...,
the store path corresponding to the input package.
However, this is an "old style" package; for instance, phases do not end
with #t anymore. I do not know whether one would do differently with the
modern gexp style approach.
In any case, I hope you can already continue in this direction.
Andreas
next prev parent reply other threads:[~2024-10-03 13:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 15:44 Add path to a guix package into CMakeLists.txt Aristide Doussot
2024-10-03 13:18 ` Andreas Enge [this message]
2024-10-04 1:12 ` James Smith
2024-10-04 14:18 ` Felix Lechner via
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zv6Zj4BRbidIBe9F@jurong \
--to=andreas@enge.fr \
--cc=aristide.doussot@obspm.fr \
--cc=help-guix@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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.