Source: rust-leptonica-sys
Version: 0.4.8-2
Severity: normal
Tags: patch
X-Debbugs-Cc: noisyc...@tutanota.com

Hi Jonas,

bindgen is about to be updated from v0.66 to v0.70. The latter has been in
experimental for a few days. I tested that rust-leptonica-sys builds and its
autopkgtests pass in unstable using the updated version.

In its build.rs, rust-leptonica-sys uses bindgen::CargoCallbacks, which is
marked as deprecated starting from bindgen v0.69 [1] but is still accepted by
v0.70. To bump bindgen, one can either keep bindgen::CargoCallbacks and wait
for it to break on a future update, or start using its replacement,
bindgen::CargoCallbacks::new(), which however was only introduced in v0.69, so
it's not compatible with older versions. I am attaching patches for both these
approaches, named "backwards" and "forwards" respectively for their
compatibility. I tested them both, of course, although they are functionally
equivalent.

Best,

NC


[1] https://github.com/rust-lang/rust-bindgen/blob/main/CHANGELOG.md#changed-6
>From 8c2a5e022ce9afef26c2429f000b33f78faf9511 Mon Sep 17 00:00:00 2001
From: NoisyCoil <noisyc...@tutanota.com>
Date: Mon, 11 Nov 2024 01:03:33 +0100
Subject: [PATCH] Bump bindgen dependency to v0.70

---
 debian/control                       | 4 ++--
 debian/patches/1001_bindgen.patch    | 6 +++---
 debian/patches/2002_no_windows.patch | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/debian/control b/debian/control
index aec9904..174cf3f 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,7 @@ Build-Depends:
  debhelper-compat (= 13),
  dh-sequence-rust,
  libleptonica-dev <!nocheck>,
- librust-bindgen-0+default-dev (<< 0.67) <!nocheck>,
+ librust-bindgen-0+default-dev (<< 0.71) <!nocheck>,
  librust-bindgen-0+default-dev (>= 0.64) <!nocheck>,
  librust-pkg-config-0.3+default-dev <!nocheck>,
 Maintainer: Jonas Smedegaard <d...@jones.dk>
@@ -20,7 +20,7 @@ Architecture: all
 Multi-Arch: foreign
 Depends:
  libleptonica-dev,
- librust-bindgen-0+default-dev (<< 0.67),
+ librust-bindgen-0+default-dev (<< 0.71),
  librust-bindgen-0+default-dev (>= 0.64),
  librust-pkg-config-0.3+default-dev,
  ${misc:Depends},
diff --git a/debian/patches/1001_bindgen.patch 
b/debian/patches/1001_bindgen.patch
index a506aa3..27ba7a5 100644
--- a/debian/patches/1001_bindgen.patch
+++ b/debian/patches/1001_bindgen.patch
@@ -1,6 +1,6 @@
-Description: accept newer crate bindgen 0.66.1
+Description: accept newer crate bindgen up to 0.70
 Author: Jonas Smedegaard <d...@jones.dk>
-Last-Update: 2023-12-04
+Last-Update: 2024-11-10
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 --- a/Cargo.toml
@@ -10,7 +10,7 @@ This patch header follows DEP-3: 
http://dep.debian.net/deps/dep3/
  
  [build-dependencies]
 -bindgen = "0.64.0"
-+bindgen = ">= 0.64, < 0.67"
++bindgen = ">= 0.64, < 0.71"
  
  [target.'cfg(windows)'.build-dependencies]
  vcpkg = "0.2.15"
diff --git a/debian/patches/2002_no_windows.patch 
b/debian/patches/2002_no_windows.patch
index 494d6a8..d723fd9 100644
--- a/debian/patches/2002_no_windows.patch
+++ b/debian/patches/2002_no_windows.patch
@@ -8,7 +8,7 @@ This patch header follows DEP-3: 
http://dep.debian.net/deps/dep3/
 +++ b/Cargo.toml
 @@ -14,8 +14,5 @@
  [build-dependencies]
- bindgen = ">= 0.64, < 0.67"
+ bindgen = ">= 0.64, < 0.71"
  
 -[target.'cfg(windows)'.build-dependencies]
 -vcpkg = "0.2.15"
-- 
2.45.2

>From 292badccf23cb8e22c6c196494665ce1e2a24d5c Mon Sep 17 00:00:00 2001
From: NoisyCoil <noisyc...@tutanota.com>
Date: Mon, 11 Nov 2024 01:03:33 +0100
Subject: [PATCH] Bump bindgen dependency to v0.70

---
 debian/control                       |  8 ++++----
 debian/patches/1001_bindgen.patch    | 17 ++++++++++++++---
 debian/patches/2002_no_windows.patch |  2 +-
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/debian/control b/debian/control
index aec9904..c6e4d2e 100644
--- a/debian/control
+++ b/debian/control
@@ -5,8 +5,8 @@ Build-Depends:
  debhelper-compat (= 13),
  dh-sequence-rust,
  libleptonica-dev <!nocheck>,
- librust-bindgen-0+default-dev (<< 0.67) <!nocheck>,
- librust-bindgen-0+default-dev (>= 0.64) <!nocheck>,
+ librust-bindgen-0+default-dev (<< 0.71) <!nocheck>,
+ librust-bindgen-0+default-dev (>= 0.69) <!nocheck>,
  librust-pkg-config-0.3+default-dev <!nocheck>,
 Maintainer: Jonas Smedegaard <d...@jones.dk>
 Standards-Version: 4.7.0
@@ -20,8 +20,8 @@ Architecture: all
 Multi-Arch: foreign
 Depends:
  libleptonica-dev,
- librust-bindgen-0+default-dev (<< 0.67),
- librust-bindgen-0+default-dev (>= 0.64),
+ librust-bindgen-0+default-dev (<< 0.71),
+ librust-bindgen-0+default-dev (>= 0.69),
  librust-pkg-config-0.3+default-dev,
  ${misc:Depends},
 Provides:
diff --git a/debian/patches/1001_bindgen.patch 
b/debian/patches/1001_bindgen.patch
index a506aa3..33afede 100644
--- a/debian/patches/1001_bindgen.patch
+++ b/debian/patches/1001_bindgen.patch
@@ -1,6 +1,6 @@
-Description: accept newer crate bindgen 0.66.1
+Description: accept newer crate bindgen 0.70.1
 Author: Jonas Smedegaard <d...@jones.dk>
-Last-Update: 2023-12-04
+Last-Update: 2024-11-10
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 --- a/Cargo.toml
@@ -10,7 +10,18 @@ This patch header follows DEP-3: 
http://dep.debian.net/deps/dep3/
  
  [build-dependencies]
 -bindgen = "0.64.0"
-+bindgen = ">= 0.64, < 0.67"
++bindgen = ">= 0.69, < 0.71"
  
  [target.'cfg(windows)'.build-dependencies]
  vcpkg = "0.2.15"
+--- a/build.rs
++++ b/build.rs
+@@ -85,7 +85,7 @@
+     }
+ 
+     let bindings = bindings
+-        .parse_callbacks(Box::new(bindgen::CargoCallbacks))
++        .parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
+         .generate()
+         .expect("Unable to generate bindings");
+ 
diff --git a/debian/patches/2002_no_windows.patch 
b/debian/patches/2002_no_windows.patch
index 494d6a8..6b9a514 100644
--- a/debian/patches/2002_no_windows.patch
+++ b/debian/patches/2002_no_windows.patch
@@ -8,7 +8,7 @@ This patch header follows DEP-3: 
http://dep.debian.net/deps/dep3/
 +++ b/Cargo.toml
 @@ -14,8 +14,5 @@
  [build-dependencies]
- bindgen = ">= 0.64, < 0.67"
+ bindgen = ">= 0.69, < 0.71"
  
 -[target.'cfg(windows)'.build-dependencies]
 -vcpkg = "0.2.15"
-- 
2.45.2

Reply via email to