diff options
Diffstat (limited to 'vendor/pkg-config')
-rw-r--r-- | vendor/pkg-config/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/pkg-config/CHANGELOG.md | 14 | ||||
-rw-r--r-- | vendor/pkg-config/Cargo.toml | 3 | ||||
-rw-r--r-- | vendor/pkg-config/src/lib.rs | 89 | ||||
-rw-r--r-- | vendor/pkg-config/tests/test.rs | 5 |
5 files changed, 70 insertions, 43 deletions
diff --git a/vendor/pkg-config/.cargo-checksum.json b/vendor/pkg-config/.cargo-checksum.json index c5e73aa5c..d3cf5dcf5 100644 --- a/vendor/pkg-config/.cargo-checksum.json +++ b/vendor/pkg-config/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"bc1a9e53c60e64a9f30e81109eeae1273ee1f574291ff712c2cfa0ec78155c82","Cargo.toml":"e2faa7f58ba9688a2f1ab2708632b4f13d0c87e769c5909b7a30facad4d648de","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"37f11a56c969237dcfd15368e96bf686ec92b0254e38fb84636e178d632c0492","src/lib.rs":"04de2653405cdbe3c662fb8e31ea3dcab7431b32dbfbd3243075de6cb5f84588","tests/escape.pc":"00caa4136799dbe5bd504239ba90d1156c12def365c8d761da319fe8a83b398e","tests/foo.pc":"4a1c442c5d1c10761ea1644f8fd58f93cc5a706391bc67b04c243bbd35d70d79","tests/framework.pc":"304fdb6cea92973650e410ab1f70ce1ebeb7718af3f139e806efbf182acd565c","tests/rpath.pc":"424a844e844edfef02692492def9864833391f581338962946646989a69c1180","tests/test.rs":"dc0c27302c599524c06be5b807e8e371f60c8296e9da280677c79db1a3fe146a"},"package":"6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"}
\ No newline at end of file +{"files":{"CHANGELOG.md":"8227908c9f30da6d80d2b7a01faa38993f8260b654026a3995b6f2a02dc0b3a3","Cargo.toml":"8a16e91f6d84cc0eed8569c0a206095b400ce2b350f8090da5557438fa40cb6a","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"37f11a56c969237dcfd15368e96bf686ec92b0254e38fb84636e178d632c0492","src/lib.rs":"52c4d689d9d9c3806444255a0fde35cfe363cc524f1c97db2a5da41b5bc0119d","tests/escape.pc":"00caa4136799dbe5bd504239ba90d1156c12def365c8d761da319fe8a83b398e","tests/foo.pc":"4a1c442c5d1c10761ea1644f8fd58f93cc5a706391bc67b04c243bbd35d70d79","tests/framework.pc":"304fdb6cea92973650e410ab1f70ce1ebeb7718af3f139e806efbf182acd565c","tests/rpath.pc":"424a844e844edfef02692492def9864833391f581338962946646989a69c1180","tests/test.rs":"d1e93c60096baa30fbd1ef961fd01a36ced36c7f05939171d1f58054c9c4b08a"},"package":"26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"}
\ No newline at end of file diff --git a/vendor/pkg-config/CHANGELOG.md b/vendor/pkg-config/CHANGELOG.md index 3ea463d03..dc2a8c980 100644 --- a/vendor/pkg-config/CHANGELOG.md +++ b/vendor/pkg-config/CHANGELOG.md @@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.3.27] - 2023-05-03 + +### Added + +- Support falling back to `pkgconf` if `pkg-config` is not available (#145). + +### Changed + +- Simplify running `pkg-config` (#144). + +- Document MSRV in `Cargo.toml` via `rust-version`. + +- Fix a couple of minor clippy warnings (#147). + ## [0.3.26] - 2022-10-26 ### Added diff --git a/vendor/pkg-config/Cargo.toml b/vendor/pkg-config/Cargo.toml index abd63e3d7..ba00d1458 100644 --- a/vendor/pkg-config/Cargo.toml +++ b/vendor/pkg-config/Cargo.toml @@ -10,8 +10,9 @@ # See Cargo.toml.orig for the original contents. [package] +rust-version = "1.30" name = "pkg-config" -version = "0.3.26" +version = "0.3.27" authors = ["Alex Crichton <alex@alexcrichton.com>"] description = """ A library to run the pkg-config system tool at build time in order to be used in diff --git a/vendor/pkg-config/src/lib.rs b/vendor/pkg-config/src/lib.rs index e9395be46..3653032e8 100644 --- a/vendor/pkg-config/src/lib.rs +++ b/vendor/pkg-config/src/lib.rs @@ -270,7 +270,7 @@ pub fn target_supported() -> bool { pub fn get_variable(package: &str, variable: &str) -> Result<String, Error> { let arg = format!("--variable={}", variable); let cfg = Config::new(); - let out = run(cfg.command(package, &[&arg]))?; + let out = cfg.run(package, &[&arg])?; Ok(str::from_utf8(&out).unwrap().trim_end().to_owned()) } @@ -392,17 +392,19 @@ impl Config { let mut library = Library::new(); - let output = run(self.command(name, &["--libs", "--cflags"])).map_err(|e| match e { - Error::Failure { command, output } => Error::ProbeFailure { - name: name.to_owned(), - command, - output, - }, - other => other, - })?; + let output = self + .run(name, &["--libs", "--cflags"]) + .map_err(|e| match e { + Error::Failure { command, output } => Error::ProbeFailure { + name: name.to_owned(), + command, + output, + }, + other => other, + })?; library.parse_libs_cflags(name, &output, self); - let output = run(self.command(name, &["--modversion"]))?; + let output = self.run(name, &["--modversion"])?; library.parse_modversion(str::from_utf8(&output).unwrap()); Ok(library) @@ -444,7 +446,7 @@ impl Config { match (env::var("TARGET"), env::var("HOST")) { (Ok(target), Ok(host)) => { let kind = if host == target { "HOST" } else { "TARGET" }; - let target_u = target.replace("-", "_"); + let target_u = target.replace('-', "_"); self.env_var_os(&format!("{}_{}", var_base, target)) .or_else(|| self.env_var_os(&format!("{}_{}", var_base, target_u))) @@ -474,10 +476,42 @@ impl Config { self.statik.unwrap_or_else(|| self.infer_static(name)) } - fn command(&self, name: &str, args: &[&str]) -> Command { - let exe = self - .targetted_env_var("PKG_CONFIG") - .unwrap_or_else(|| OsString::from("pkg-config")); + fn run(&self, name: &str, args: &[&str]) -> Result<Vec<u8>, Error> { + let pkg_config_exe = self.targetted_env_var("PKG_CONFIG"); + let fallback_exe = if pkg_config_exe.is_none() { + Some(OsString::from("pkgconf")) + } else { + None + }; + let exe = pkg_config_exe.unwrap_or_else(|| OsString::from("pkg-config")); + + let mut cmd = self.command(exe, name, args); + + match cmd.output().or_else(|e| { + if let Some(exe) = fallback_exe { + self.command(exe, name, args).output() + } else { + Err(e) + } + }) { + Ok(output) => { + if output.status.success() { + Ok(output.stdout) + } else { + Err(Error::Failure { + command: format!("{:?}", cmd), + output, + }) + } + } + Err(cause) => Err(Error::Command { + command: format!("{:?}", cmd), + cause, + }), + } + } + + fn command(&self, exe: OsString, name: &str, args: &[&str]) -> Command { let mut cmd = Command::new(exe); if self.is_static(name) { cmd.arg("--static"); @@ -768,8 +802,8 @@ impl Library { } } - let mut linker_options = words.iter().filter(|arg| arg.starts_with("-Wl,")); - while let Some(option) = linker_options.next() { + let linker_options = words.iter().filter(|arg| arg.starts_with("-Wl,")); + for option in linker_options { let mut pop = false; let mut ld_option = vec![]; for subopt in option[4..].split(',') { @@ -795,7 +829,7 @@ impl Library { } fn parse_modversion(&mut self, output: &str) { - self.version.push_str(output.lines().nth(0).unwrap().trim()); + self.version.push_str(output.lines().next().unwrap().trim()); } } @@ -815,25 +849,6 @@ fn is_static_available(name: &str, system_roots: &[PathBuf], dirs: &[PathBuf]) - }) } -fn run(mut cmd: Command) -> Result<Vec<u8>, Error> { - match cmd.output() { - Ok(output) => { - if output.status.success() { - Ok(output.stdout) - } else { - Err(Error::Failure { - command: format!("{:?}", cmd), - output, - }) - } - } - Err(cause) => Err(Error::Command { - command: format!("{:?}", cmd), - cause, - }), - } -} - /// Split output produced by pkg-config --cflags and / or --libs into separate flags. /// /// Backslash in output is used to preserve literal meaning of following byte. Different words are diff --git a/vendor/pkg-config/tests/test.rs b/vendor/pkg-config/tests/test.rs index 4e04ac071..0f37c7224 100644 --- a/vendor/pkg-config/tests/test.rs +++ b/vendor/pkg-config/tests/test.rs @@ -24,10 +24,7 @@ fn reset() { } env::remove_var("TARGET"); env::remove_var("HOST"); - env::set_var( - "PKG_CONFIG_PATH", - &env::current_dir().unwrap().join("tests"), - ); + env::set_var("PKG_CONFIG_PATH", env::current_dir().unwrap().join("tests")); } fn find(name: &str) -> Result<pkg_config::Library, Error> { |