mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Bump version-compare to 0.1.0, remove some unwraps
This commit is contained in:
+1
-1
@@ -40,7 +40,7 @@ version = "^1"
|
||||
optional = true
|
||||
|
||||
[build-dependencies]
|
||||
version-compare = "0.0.10"
|
||||
version-compare = "0.1"
|
||||
cfg-if = "^1.0"
|
||||
|
||||
[features]
|
||||
|
||||
+6
-6
@@ -112,16 +112,16 @@ fn compile_sdl2(sdl2_build_path: &Path, target_os: &str) -> PathBuf {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
use version_compare::Version;
|
||||
// Add common flag for affected version and above
|
||||
use version_compare::{compare_to, Cmp};
|
||||
if let Ok(version) = std::process::Command::new("cc")
|
||||
.arg("-dumpversion")
|
||||
.output()
|
||||
{
|
||||
let local_ver =
|
||||
Version::from(std::str::from_utf8(&version.stdout).unwrap()).unwrap();
|
||||
let affected_ver = Version::from("10").unwrap();
|
||||
|
||||
if local_ver >= affected_ver {
|
||||
let affected =
|
||||
compare_to(std::str::from_utf8(&version.stdout).unwrap(), "10", Cmp::Ge)
|
||||
.unwrap_or(true);
|
||||
if affected {
|
||||
cfg.cflag("-fcommon");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user