@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2023 Leo Nikkilä <hello@lnikki.la>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -41,6 +42,21 @@ (define-public libsigsegv
`(;; The shared library isn't built by default but some packages need it.
#:configure-flags '("--enable-shared")
+ ;; When cross-compiling for x86_64, work around this error:
+ ;;
+ ;; In file included from fault-linux-x86_64-old.h:17,
+ ;; [...]
+ ;; linux-libre-headers-cross-x86_64-linux-gnu-5.15.49/include/asm/sigcontext.h:317:8: error: redefinition of ‘struct sigcontext’
+ ,@(if (string-contains (or (%current-target-system)
+ (%current-system))
+ "x86_64")
+ `(#:phases (modify-phases %standard-phases
+ (add-before 'configure 'patch-x86_64-old-h
+ (lambda _
+ (substitute* "src/fault-linux-x86_64-old.h"
+ (("#include <asm/sigcontext\\.h>") ""))))))
+ '())
+
;; On MIPS, work around this error:
;;
;; In file included from fault-linux-mips-old.h:18:0,
@@ -52,8 +68,7 @@ (define-public libsigsegv
(add-before 'configure 'patch-mips-old-h
(lambda _
(substitute* "src/fault-linux-mips-old.h"
- (("#include <asm/sigcontext\\.h>") ""))
- #t))))
+ (("#include <asm/sigcontext\\.h>") ""))))))
'())))
(description
"GNU libsigsegv is a library to handle page faults, which occur when a