Skip to content

Commit

Permalink
options: Remove the linking-related options.
Browse files Browse the repository at this point in the history
They do nothing, and are effectively superseded by --raw-line and friends.

They also tend to confuse people.

Closes rust-lang#104
  • Loading branch information
emilio committed Mar 31, 2018
1 parent fb069e9 commit 8e3e585
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 115 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = "bindgen"
readme = "README.md"
repository = "https://github.com/rust-lang-nursery/rust-bindgen"
documentation = "https://docs.rs/bindgen"
version = "0.35.0"
version = "0.36.0"
build = "build.rs"

include = [
Expand Down
76 changes: 0 additions & 76 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,19 +343,6 @@ impl Builder {
output_vector.push("--disable-name-namespacing".into());
}

self.options
.links
.iter()
.map(|&(ref item, _)| {
output_vector.push("--framework".into());
output_vector.push(
item.trim_left_matches("^")
.trim_right_matches("$")
.into(),
);
})
.count();

if !self.options.codegen_config.functions {
output_vector.push("--ignore-functions".into());
}
Expand Down Expand Up @@ -389,19 +376,6 @@ impl Builder {
output_vector.push("--ignore-methods".into());
}

self.options
.links
.iter()
.map(|&(ref item, _)| {
output_vector.push("--clang-args".into());
output_vector.push(
item.trim_left_matches("^")
.trim_right_matches("$")
.into(),
);
})
.count();

if !self.options.convert_floats {
output_vector.push("--no-convert-floats".into());
}
Expand Down Expand Up @@ -437,19 +411,6 @@ impl Builder {
})
.count();

self.options
.links
.iter()
.map(|&(ref item, _)| {
output_vector.push("--static".into());
output_vector.push(
item.trim_left_matches("^")
.trim_right_matches("$")
.into(),
);
})
.count();

if self.options.use_core {
output_vector.push("--use-core".into());
}
Expand Down Expand Up @@ -824,26 +785,6 @@ impl Builder {
self
}

/// Make the generated bindings link the given shared library.
pub fn link<T: Into<String>>(mut self, library: T) -> Builder {
self.options.links.push((library.into(), LinkType::Default));
self
}

/// Make the generated bindings link the given static library.
pub fn link_static<T: Into<String>>(mut self, library: T) -> Builder {
self.options.links.push((library.into(), LinkType::Static));
self
}

/// Make the generated bindings link the given framework.
pub fn link_framework<T: Into<String>>(mut self, library: T) -> Builder {
self.options.links.push(
(library.into(), LinkType::Framework),
);
self
}

/// Emit bindings for builtin definitions (for example `__builtin_va_list`)
/// in the generated Rust.
pub fn emit_builtins(mut self) -> Builder {
Expand Down Expand Up @@ -1277,9 +1218,6 @@ struct BindgenOptions {
/// Whether we should generate builtins or not.
builtins: bool,

/// The set of libraries we should link in the generated Rust code.
links: Vec<(String, LinkType)>,

/// True if we should dump the Clang AST for debugging purposes.
emit_ast: bool,

Expand Down Expand Up @@ -1484,7 +1422,6 @@ impl Default for BindgenOptions {
rustified_enums: Default::default(),
constified_enum_modules: Default::default(),
builtins: false,
links: vec![],
emit_ast: false,
emit_ir: false,
emit_ir_graphviz: None,
Expand Down Expand Up @@ -1529,19 +1466,6 @@ impl Default for BindgenOptions {
}
}

/// The linking type to use with a given library.
///
/// TODO: #104: This is ignored at the moment, but shouldn't be.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum LinkType {
/// Use shared library linking. This is the default.
Default,
/// Use static linking.
Static,
/// The library is an OSX framework.
Framework,
}

fn ensure_libclang_is_loaded() {
if clang_sys::is_loaded() {
return;
Expand Down
37 changes: 0 additions & 37 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,6 @@ where
.help("Disable namespacing via mangling, causing bindgen to \
generate names like \"Baz\" instead of \"foo_bar_Baz\" \
for an input name \"foo::bar::Baz\"."),
Arg::with_name("framework")
.long("framework-link")
.help("Link to framework.")
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("ignore-functions")
.long("ignore-functions")
.help("Do not generate bindings for functions or methods. This \
Expand All @@ -168,13 +162,6 @@ where
Arg::with_name("ignore-methods")
.long("ignore-methods")
.help("Do not generate bindings for methods."),
Arg::with_name("dynamic")
.short("l")
.long("link")
.help("Link to dynamic library.")
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("no-convert-floats")
.long("no-convert-floats")
.help("Do not automatically convert floats to f32/f64."),
Expand Down Expand Up @@ -207,12 +194,6 @@ where
.long("rust-target")
.help(&rust_target_help)
.takes_value(true),
Arg::with_name("static")
.long("static-link")
.help("Link to static library.")
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("use-core")
.long("use-core")
.help("Use types from Rust core instead of std."),
Expand Down Expand Up @@ -409,12 +390,6 @@ where
builder = builder.ctypes_prefix(prefix);
}

if let Some(links) = matches.values_of("dynamic") {
for library in links {
builder = builder.link(library);
}
}

if let Some(what_to_generate) = matches.value_of("generate") {
let mut config = CodegenConfig::nothing();
for what in what_to_generate.split(",") {
Expand Down Expand Up @@ -456,12 +431,6 @@ where
builder = builder.disable_name_namespacing();
}

if let Some(links) = matches.values_of("framework") {
for framework in links {
builder = builder.link_framework(framework);
}
}

if matches.is_present("ignore-functions") {
builder = builder.ignore_functions();
}
Expand Down Expand Up @@ -498,12 +467,6 @@ where
}
}

if let Some(links) = matches.values_of("static") {
for library in links {
builder = builder.link_static(library);
}
}

if matches.is_present("use-core") {
builder = builder.use_core();
}
Expand Down

0 comments on commit 8e3e585

Please sign in to comment.