Subject: [PATCHv2 rust-team 10/27] gnu: Add rust-freetype-sys-0.21.

From: Giacomo Leidi <[email-masked]>
Date: Wed, 6 Nov 2024 21:41:14 +0100

* gnu/packages/crates-io.scm (rust-freetype-sys-0.21): New variable;
(rust-freetype-sys-0.20): inherit from rust-freetype-sys-0.21.

Change-Id: I6833de0940a7f03f1d91dbb7e4c6f4e9f992581e
---
 gnu/packages/crates-io.scm | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index dd78521655..b5423efc2e 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -28337,17 +28337,17 @@ (define-public rust-freetype-rs-0.26
         ("rust-freetype-sys" ,rust-freetype-sys-0.13)
         ("rust-libc" ,rust-libc-0.2))))))
 
-(define-public rust-freetype-sys-0.20
+(define-public rust-freetype-sys-0.21
   (package
     (name "rust-freetype-sys")
-    (version "0.20.1")
+    (version "0.21.0")
     (source
      (origin
        (method url-fetch)
        (uri (crate-uri "freetype-sys" version))
        (file-name (string-append name "-" version ".tar.gz"))
        (sha256
-        (base32 "0d5iiv95ap3lwy7b0hxbc8caa9ng1fg3wlwrvb7rld39jrdxqzhf"))
+        (base32 "1bsmjhjb26hzpzhj82c9196m0ls5m43zkgmqp67ambwjk6ylmf6x"))
        (snippet
         #~(begin
             (use-modules (guix build utils))
@@ -28372,6 +28372,34 @@ (define-public rust-freetype-sys-0.20
      "This package provides low level binding for FreeType font library.")
     (license license:expat)))
 
+(define-public rust-freetype-sys-0.20
+  (package
+    (inherit rust-freetype-sys-0.21)
+    (name "rust-freetype-sys")
+    (version "0.20.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "freetype-sys" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0d5iiv95ap3lwy7b0hxbc8caa9ng1fg3wlwrvb7rld39jrdxqzhf"))
+       (snippet
+        #~(begin
+            (use-modules (guix build utils))
+            (delete-file-recursively "freetype2")
+            ;; Inspired by Debian's patch for bzip2-sys.
+            (delete-file "build.rs")
+            (with-output-to-file "build.rs"
+              (lambda _
+                (format #t "fn main() {~@
+                        println!(\"cargo:rustc-link-lib=freetype\");~@
+                        }~%")))))))
+    (arguments
+     `(#:cargo-inputs (("rust-cc" ,rust-cc-1)
+                       ("rust-libc" ,rust-libc-0.2)
+                       ("rust-pkg-config" ,rust-pkg-config-0.3))))))
+
 (define-public rust-freetype-sys-0.17
   (package
     (inherit rust-freetype-sys-0.20)
-- 
2.46.0