Subject: [bug#54595] [PATCH 2/2] gnu: libfido2: Fix cross-compilation.

From: Pierre Langlois <[email-masked]>
Date: Sun, 27 Mar 2022 15:04:09 +0100

Hi,

Maxime Devos <[email-masked]> writes:

> [[PGP Signed Part:Undecided]]
> Sébastien Lerique schreef op zo 27-03-2022 om 21:29 [+0900]:
>> +                                                            ,(%current-target-system)
>> +                                                            "-pkg-config"))))
>
> This can be simplified with 'pkg-config-for-target':
>
>   #:configure-flags
>   (list (string-append "-DPKG_CONFIG_EXECUTABLE="
>                        (search-input-file %build-inputs
>                                           (string-append "/bin/" ,(pkg-config-for-target)))))

For my own benefit trying to get better at writing gexps, I was
wondering how to write in order to remove the %build-inputs reference.
I came up with the following:

--8<---------------cut here---------------start------------->8---
    (arguments
     (list
      #:configure-flags
      #~(list #$@(if (%current-target-system)
                     (list
                      #~(string-append
                         "-DPKG_CONFIG_EXECUTABLE="
                         #+pkg-config "/bin/"
                         #$(pkg-config-for-target)))
                     '()))
       #:phases
       #~(modify-phases %standard-phases
           ;; regress tests enabled only for debug builds
           (delete 'check))))
--8<---------------cut here---------------end--------------->8---

Would this a the better way to do this?  It looks a bit complex to me so
I wonder if there's a simpler way.  I'm also not entirely sure if it's
#+pkg-config or #$pkg-config, both seem to work, however I thought we
should be using #+ for native inputs and #$ for regular inputs.

Thanks,
Pierre