Skip to content

Commit d8c07df

Browse files
committed
refactor(mlua-sys): migrate from pkg-config to system-deps
1 parent 2b4d362 commit d8c07df

File tree

2 files changed

+3
-34
lines changed

2 files changed

+3
-34
lines changed

mlua-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ libc = "0.2"
4040
[build-dependencies]
4141
cc = "1.0"
4242
cfg-if = "1.0"
43-
pkg-config = "0.3.17"
43+
system-deps = "7.0"
4444
lua-src = { version = ">= 550.0.0, < 550.1.0", optional = true }
4545
luajit-src = { version = ">= 210.6.0, < 210.7.0", optional = true }
4646
luau0-src = { version = "0.18.0", optional = true }

mlua-sys/build/find_normal.rs

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![allow(dead_code)]
22

33
use std::env;
4-
use std::ops::Bound;
54

65
pub fn probe_lua() {
76
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
@@ -29,36 +28,6 @@ pub fn probe_lua() {
2928
return;
3029
}
3130

32-
// Find using `pkg-config`
33-
34-
#[cfg(feature = "lua55")]
35-
let (incl_bound, excl_bound, alt_probe, ver) = ("5.5", "5.6", ["lua5.5", "lua-5.5", "lua55"], "5.5");
36-
#[cfg(feature = "lua54")]
37-
let (incl_bound, excl_bound, alt_probe, ver) = ("5.4", "5.5", ["lua5.4", "lua-5.4", "lua54"], "5.4");
38-
#[cfg(feature = "lua53")]
39-
let (incl_bound, excl_bound, alt_probe, ver) = ("5.3", "5.4", ["lua5.3", "lua-5.3", "lua53"], "5.3");
40-
#[cfg(feature = "lua52")]
41-
let (incl_bound, excl_bound, alt_probe, ver) = ("5.2", "5.3", ["lua5.2", "lua-5.2", "lua52"], "5.2");
42-
#[cfg(feature = "lua51")]
43-
let (incl_bound, excl_bound, alt_probe, ver) = ("5.1", "5.2", ["lua5.1", "lua-5.1", "lua51"], "5.1");
44-
#[cfg(feature = "luajit")]
45-
let (incl_bound, excl_bound, alt_probe, ver) = ("2.0.4", "2.2", [], "JIT");
46-
47-
#[rustfmt::skip]
48-
let mut lua = pkg_config::Config::new()
49-
.range_version((Bound::Included(incl_bound), Bound::Excluded(excl_bound)))
50-
.cargo_metadata(true)
51-
.probe(if cfg!(feature = "luajit") { "luajit" } else { "lua" });
52-
53-
if lua.is_err() {
54-
for pkg in alt_probe {
55-
lua = pkg_config::Config::new().cargo_metadata(true).probe(pkg);
56-
57-
if lua.is_ok() {
58-
break;
59-
}
60-
}
61-
}
62-
63-
lua.unwrap_or_else(|err| panic!("cannot find Lua{ver} using `pkg-config`: {err}"));
31+
// This reads [package.metadata.system-deps] from Cargo.toml
32+
system_deps::Config::new().probe().unwrap();
6433
}

0 commit comments

Comments
 (0)