Subject: [bug#69637] [PATCH mesa-updates 5/6] gnu: Add rust-bindgen-cli-0.69.

From: aurtzy <[email-masked]>
Date: Fri, 8 Mar 2024 15:27:15 -0500

* gnu/packages/crates-io.scm (rust-bindgen-cli-0.69): New variable.

Change-Id: I0841f34d73acf4e161c9f0ba0c6543d7f0d03092
---
 gnu/packages/crates-io.scm | 53 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 97dfc03525..150b8884b1 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -6182,6 +6182,59 @@ (define-public rust-bindgen-0.69
 bindings to C and C++ libraries.")
     (license license:bsd-3)))
 
+(define-public rust-bindgen-cli-0.69
+  (package
+    (inherit rust-bindgen-0.69)
+    (name "rust-bindgen-cli")
+    (version "0.69.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/rust-lang/rust-bindgen.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0mksvspqymdypgflgx6xqfxdr9a5wwx534imgcnn3mk7ffz0sqlm"))))
+    (arguments
+     (cons*
+      ;; 1 test case fails (header_ptr32_has_different_size_h); related issue:
+      ;; https://github.com/rust-lang/rust-bindgen/issues/2638
+      #:tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'install
+            (lambda* (#:key outputs inputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (bin (string-append out "/bin"))
+                     (bindgen (string-append bin "/bindgen"))
+                     (llvm-dir (string-append
+                                (assoc-ref inputs "clang")
+                                "/lib")))
+                (mkdir-p bin)
+                (copy-file "target/release/bindgen" bindgen)
+                (wrap-program bindgen
+                  `("LIBCLANG_PATH" = (,llvm-dir)))))))
+      (substitute-keyword-arguments (package-arguments rust-bindgen-0.69)
+        ((#:skip-build? _)
+         #f)
+        ((#:cargo-inputs original-inputs)
+         `(("rust-bindgen" ,rust-bindgen-0.69)
+           ("rust-block" ,rust-block-0.1)
+           ("rust-clap" ,rust-clap-complete-4)
+           ("rust-env-logger" ,rust-env-logger-0.10)
+           ("rust-libloading" ,rust-libloading-0.7)
+           ("rust-objc" ,rust-objc-0.2)
+           ("rust-owo-colors" ,rust-owo-colors-3)
+           ("rust-prettyplease" ,rust-prettyplease-0.2)
+           ("rust-quickcheck" ,rust-quickcheck-0.4)
+           ("rust-similar" ,rust-similar-2)
+           ,@original-inputs)))))
+    (native-inputs
+     (modify-inputs (package-native-inputs rust-bindgen-0.69)
+       (prepend clang)))))
+
 (define-public rust-bindgen-0.66
   (package
     (inherit rust-bindgen-0.69)
-- 
2.41.0