Subject: Re: [bug#74669] [PATCH v2] gnu: elfutils: Fix cross-compilation.

From: Ludovic Courtès <[email-masked]>
Date: Thu, 12 Dec 2024 23:03:13 +0100

Hi,

Zheng Junjie <[email-masked]> skribis:

> * gnu/packages/elf.scm (elfutils): Fix cross-compilation
> [arguments]: When cross-compilation, apply patch.
> [native-inputs]: When cross-compilation, add patch.
> * gnu/packages/patches/elfutils-libdwfl-Rewrite-reading-of-ar_size-in-elf_begin_rand.patch:
> New file.
> * gnu/local.mk (dist_patch_DATA): Register it.
>
> Change-Id: Ia1ab9c09124a140608bda34bf62f0ae80eb44f9b

[...]

> +  %D%/packages/patches/elfutils-libdwfl-Rewrite-reading-of-ar_size-in-elf_begin_rand.patch \

Please pick a shorter file name, as noted by ‘guix lint’.

(Like ‘elfutils-libdwfl-string-overflow.patch’.)

> +            '((add-after 'unpack 'patch
> +                (lambda* (#:key native-inputs #:allow-other-keys)
> +                  (invoke "patch" "-Np1" "-i"
> +                          (assoc-ref native-inputs
> +                                     "elfutils-libdwfl-Rewrite-reading-of-ar\
> +_size-in-elf_begin_rand.patch")))))

Could you use a gexp instead?  And ‘--force’ is better suited than ‘-N’
I think.

  #~(add-after …
      …
      (invoke "patch" "-p1" "--force" "-i" #$(local-file (search-patch …))))

Thanks,
Ludo’.