Skip to content

Commit 85d5b93

Browse files
dubiousjimlu-zero
authored andcommitted
Revert "add free_host, free_option"
This reverts commit 0b524cf.
1 parent 313688a commit 85d5b93

File tree

1 file changed

+4
-36
lines changed

1 file changed

+4
-36
lines changed

src/lib.rs

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ pub struct Config {
6363
cxxflags: OsString,
6464
ldflags: OsString,
6565
options: Vec<(Kind, OsString, Option<OsString>)>,
66-
free_options: Vec<(OsString, Option<OsString>)>,
67-
free_host: Option<String>,
6866
target: Option<String>,
6967
make_args: Option<Vec<String>>,
7068
make_targets: Option<Vec<String>>,
@@ -109,8 +107,6 @@ impl Config {
109107
cxxflags: OsString::new(),
110108
ldflags: OsString::new(),
111109
options: Vec::new(),
112-
free_options: Vec::new(),
113-
free_host: None,
114110
make_args: None,
115111
make_targets: None,
116112
out_dir: None,
@@ -159,14 +155,6 @@ impl Config {
159155
self
160156
}
161157

162-
/// Passes `--<opt><=optarg>` to configure.
163-
pub fn free_option<P: AsRef<OsStr>>(&mut self, opt: P, optarg: Option<P>) -> &mut Config {
164-
let optarg = optarg.as_ref().map(|v| v.as_ref().to_owned());
165-
self.free_options.push((opt.as_ref().to_owned(),
166-
optarg));
167-
self
168-
}
169-
170158
/// Passes `--enable-<opt><=optarg>` to configure.
171159
pub fn enable<P: AsRef<OsStr>>(&mut self, opt: P, optarg: Option<P>) -> &mut Config {
172160
self.set_opt(Kind::Enable, opt, optarg)
@@ -220,7 +208,7 @@ impl Config {
220208
self
221209
}
222210

223-
/// Sets the Rust host triple for this compilation.
211+
/// Sets the host triple for this compilation.
224212
///
225213
/// This is automatically scraped from `$HOST` which is set for Cargo
226214
/// build scripts so it's not necessary to call this from a build script.
@@ -229,16 +217,6 @@ impl Config {
229217
self
230218
}
231219

232-
/// Sets the ./configure --host triple for this compilation.
233-
///
234-
/// When cross-compiling, this will usually approximate what Rust calls the
235-
/// target rather than what Rust calls the host. When not explicitly
236-
/// set, we attempt to auto-compute this from the compiler path.
237-
pub fn free_host(&mut self, host: &str) -> &mut Config {
238-
self.free_host = Some(host.to_string());
239-
self
240-
}
241-
242220
/// Sets the output directory for this compilation.
243221
///
244222
/// This is automatically scraped from `$OUT_DIR` which is set for Cargo
@@ -308,6 +286,7 @@ impl Config {
308286
let c_compiler = c_cfg.get_compiler();
309287
let cxx_compiler = cxx_cfg.get_compiler();
310288

289+
311290
let dst;
312291
let build;
313292

@@ -336,6 +315,7 @@ impl Config {
336315
let executable = PathBuf::from(&self.path).join("configure");
337316
let mut cmd = Command::new(executable);
338317

318+
cmd.arg(format!("--host={}", host));
339319
cmd.arg(format!("--prefix={}", dst.display()));
340320
if self.enable_shared {
341321
cmd.arg("--enable-shared");
@@ -406,19 +386,7 @@ impl Config {
406386
cmd.arg(os);
407387
}
408388

409-
for &(ref k, ref v) in &self.free_options {
410-
let mut os = OsString::from("--");
411-
os.push(k);
412-
if let &Some(ref v) = v {
413-
os.push("=");
414-
os.push(v);
415-
}
416-
cmd.arg(os);
417-
}
418-
419-
if let Some(ref host) = self.free_host {
420-
cmd.arg(format!("--host={}", host));
421-
} else {
389+
if true {
422390
let compiler_path = format!("--host={}", c_compiler.path().display());
423391
if compiler_path != "--host=musl-gcc" && compiler_path.ends_with("-gcc") {
424392
cmd.arg(&compiler_path[0..compiler_path.len() - 4]);

0 commit comments

Comments
 (0)