aboutsummaryrefslogtreecommitdiff
path: root/scripts/rust_is_available.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/rust_is_available.sh')
-rwxr-xr-xscripts/rust_is_available.sh33
1 files changed, 17 insertions, 16 deletions
diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh
index 117018946b57..5262c56dd674 100755
--- a/scripts/rust_is_available.sh
+++ b/scripts/rust_is_available.sh
@@ -117,20 +117,16 @@ if [ "$rust_compiler_cversion" -lt "$rust_compiler_min_cversion" ]; then
echo >&2 "***"
exit 1
fi
-if [ "$rust_compiler_cversion" -gt "$rust_compiler_min_cversion" ]; then
- echo >&2 "***"
- echo >&2 "*** Rust compiler '$RUSTC' is too new. This may or may not work."
- echo >&2 "*** Your version: $rust_compiler_version"
- echo >&2 "*** Expected version: $rust_compiler_min_version"
- echo >&2 "***"
- warning=1
-fi
# Check that the Rust bindings generator is suitable.
#
# Non-stable and distributions' versions may have a version suffix, e.g. `-dev`.
+#
+# The dummy parameter `workaround-for-0.69.0` is required to support 0.69.0
+# (https://github.com/rust-lang/rust-bindgen/pull/2678). It can be removed when
+# the minimum version is upgraded past that (0.69.1 already fixed the issue).
rust_bindings_generator_output=$( \
- LC_ALL=C "$BINDGEN" --version 2>/dev/null
+ LC_ALL=C "$BINDGEN" --version workaround-for-0.69.0 2>/dev/null
) || rust_bindings_generator_code=$?
if [ -n "$rust_bindings_generator_code" ]; then
echo >&2 "***"
@@ -165,13 +161,18 @@ if [ "$rust_bindings_generator_cversion" -lt "$rust_bindings_generator_min_cvers
echo >&2 "***"
exit 1
fi
-if [ "$rust_bindings_generator_cversion" -gt "$rust_bindings_generator_min_cversion" ]; then
- echo >&2 "***"
- echo >&2 "*** Rust bindings generator '$BINDGEN' is too new. This may or may not work."
- echo >&2 "*** Your version: $rust_bindings_generator_version"
- echo >&2 "*** Expected version: $rust_bindings_generator_min_version"
- echo >&2 "***"
- warning=1
+if [ "$rust_bindings_generator_cversion" -eq 6600 ] ||
+ [ "$rust_bindings_generator_cversion" -eq 6601 ]; then
+ # Distributions may have patched the issue (e.g. Debian did).
+ if ! "$BINDGEN" $(dirname $0)/rust_is_available_bindgen_0_66.h >/dev/null; then
+ echo >&2 "***"
+ echo >&2 "*** Rust bindings generator '$BINDGEN' versions 0.66.0 and 0.66.1 may not"
+ echo >&2 "*** work due to a bug (https://github.com/rust-lang/rust-bindgen/pull/2567),"
+ echo >&2 "*** unless patched (like Debian's)."
+ echo >&2 "*** Your version: $rust_bindings_generator_version"
+ echo >&2 "***"
+ warning=1
+ fi
fi
# Check that the `libclang` used by the Rust bindings generator is suitable.