-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
universe/rust-bindgen: unbreak --version flag
[ commit ff261ebc9ab2b7c8ccb56f341e82697f16c3699b ] this is rust-lang/rust-bindgen#3040 this also unbreaks the mesa-asahi build
- Loading branch information
omni
authored and
Takha Polat
committed
Dec 9, 2024
1 parent
db38b76
commit 52975b7
Showing
2 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
universe/rust-bindgen/unbreak-shell-completion-and--version-without-leader.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
From 2e154e7e2af2f5c40f195c3ec5b468ae2259c1c7 Mon Sep 17 00:00:00 2001 | ||
From: "Jan Alexander Steffens (heftig)" <[email protected]> | ||
Date: Sat, 7 Dec 2024 18:54:51 +0100 | ||
Subject: [PATCH] Unbreak shell completion and --version without header | ||
|
||
This regressed again in #2984. Partially revert d75fe271418e and | ||
42a86e288c43 and restore the previous behavior. | ||
|
||
Fixes: https://github.com/rust-lang/rust-bindgen/issues/3037 | ||
Fixes: https://github.com/rust-lang/rust-bindgen/issues/3039 | ||
--- | ||
bindgen/options/cli.rs | 52 +++++++++++++++++++++++------------------- | ||
1 file changed, 28 insertions(+), 24 deletions(-) | ||
|
||
diff --git a/bindgen/options/cli.rs b/bindgen/options/cli.rs | ||
index 9d5cea3dc6..8c4c05bc84 100644 | ||
--- a/bindgen/options/cli.rs | ||
+++ b/bindgen/options/cli.rs | ||
@@ -146,7 +146,7 @@ fn parse_custom_attribute( | ||
#[allow(clippy::doc_markdown)] | ||
struct BindgenCommand { | ||
/// C or C++ header file. | ||
- header: String, | ||
+ header: Option<String>, | ||
/// Path to write depfile to. | ||
#[arg(long)] | ||
depfile: Option<String>, | ||
@@ -657,6 +657,33 @@ where | ||
clang_args, | ||
} = command; | ||
|
||
+ if let Some(shell) = generate_shell_completions { | ||
+ clap_complete::generate( | ||
+ shell, | ||
+ &mut BindgenCommand::command(), | ||
+ "bindgen", | ||
+ &mut io::stdout(), | ||
+ ); | ||
+ | ||
+ exit(0) | ||
+ } | ||
+ | ||
+ if version { | ||
+ println!( | ||
+ "bindgen {}", | ||
+ option_env!("CARGO_PKG_VERSION").unwrap_or("unknown") | ||
+ ); | ||
+ if verbose { | ||
+ println!("Clang: {}", crate::clang_version().full); | ||
+ } | ||
+ | ||
+ exit(0) | ||
+ } | ||
+ | ||
+ if header.is_none() { | ||
+ return Err(io::Error::new(io::ErrorKind::Other, "Header not found")); | ||
+ } | ||
+ | ||
let mut builder = builder(); | ||
|
||
#[derive(Debug)] | ||
@@ -804,31 +831,8 @@ where | ||
} | ||
} | ||
|
||
- let header = Some(header); | ||
- | ||
builder = apply_args!( | ||
builder { | ||
- generate_shell_completions => |_, shell| { | ||
- clap_complete::generate( | ||
- shell, | ||
- &mut BindgenCommand::command(), | ||
- "bindgen", | ||
- &mut io::stdout(), | ||
- ); | ||
- | ||
- exit(0) | ||
- }, | ||
- version => |_, _| { | ||
- println!( | ||
- "bindgen {}", | ||
- option_env!("CARGO_PKG_VERSION").unwrap_or("unknown") | ||
- ); | ||
- if verbose { | ||
- println!("Clang: {}", crate::clang_version().full); | ||
- } | ||
- | ||
- exit(0) | ||
- }, | ||
header, | ||
rust_target, | ||
rust_edition, |