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


Reply via email to