Subject: [PATCH] gnu: libjxl: Fix building on riscv64-linux.
From: Zheng Junjie <[email-masked]>
To: [email-masked]
Date: Sat, 30 Mar 2024 01:01:16 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/packages/image.scm (libjxl)
[arguments]: When target riscv64, add 'add-miss-atomic-include phase.

Change-Id: I554ae8d9d9bd982e7eb63ad4ecae176d2ba2372b
---
 gnu/packages/image.scm | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 6accf68ef0..35ee12d8f3 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -35,7 +35,7 @@
 ;;; Copyright © 2022 Jai Vetrivelan <[email-masked]>
 ;;; Copyright © 2022 ( <[email-masked]>
 ;;; Copyright © 2022-2023 Bruno Victal <[email-masked]>
-;;; Copyright © 2023 Zheng Junjie <[email-masked]>
+;;; Copyright © 2023, 2024 Zheng Junjie <[email-masked]>
 ;;; Copyright © 2023-2024 Nicolas Goaziou <[email-masked]>
 ;;; Copyright © 2023 Artyom V. Poptsov <[email-masked]>
 ;;; Copyright © 2024 chris <[email-masked]>
@@ -2606,7 +2606,17 @@ (define-public libjxl
              "-DJPEGXL_FORCE_SYSTEM_BROTLI=true"
              "-DJPEGXL_FORCE_SYSTEM_LCMS2=true"
              "-DJPEGXL_FORCE_SYSTEM_HWY=true"
-             "-DJPEGXL_BUNDLE_LIBPNG=false")))
+             "-DJPEGXL_BUNDLE_LIBPNG=false")
+       ;; see https://github.com/libjxl/libjxl/pull/2211
+       ,@(if (target-riscv64?)
+             `(#:phases
+               (modify-phases %standard-phases
+                 (add-after 'unpack 'add-miss-atomic-include
+                   (lambda _
+                     (substitute* "lib/jxl/enc_xyb.cc"
+                       (("<algorithm>")
+                        "<algorithm>\n#include <atomic>"))))))
+             '())))
     (native-inputs
      (list asciidoc doxygen googletest pkg-config python))
     (inputs

base-commit: 37d31495c1c3c38d1b74e0c5b3ba279c1d99c7d5
-- 
2.41.0