Skip to content

Commit 39c9bd8

Browse files
committed
Migrate to system-deps for mlua-sys
1 parent 37b017d commit 39c9bd8

File tree

2 files changed

+4
-38
lines changed

2 files changed

+4
-38
lines changed

mlua-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module = []
3838
[build-dependencies]
3939
cc = "1.0"
4040
cfg-if = "1.0"
41-
pkg-config = "0.3.17"
41+
system-deps = "7.0"
4242
lua-src = { version = ">= 548.1.0, < 548.2.0", optional = true }
4343
luajit-src = { version = ">= 210.6.0, < 210.7.0", optional = true }
4444
luau0-src = { version = "0.17.0", optional = true }

mlua-sys/build/find_normal.rs

Lines changed: 3 additions & 37 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,40 +28,7 @@ pub fn probe_lua() {
2928
return;
3029
}
3130

32-
// Find using `pkg-config`
33-
34-
#[cfg(feature = "lua54")]
35-
let (incl_bound, excl_bound, alt_probe, ver) =
36-
("5.4", "5.5", ["lua5.4", "lua-5.4", "lua54"], "5.4");
37-
#[cfg(feature = "lua53")]
38-
let (incl_bound, excl_bound, alt_probe, ver) =
39-
("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) =
42-
("5.2", "5.3", ["lua5.2", "lua-5.2", "lua52"], "5.2");
43-
#[cfg(feature = "lua51")]
44-
let (incl_bound, excl_bound, alt_probe, ver) =
45-
("5.1", "5.2", ["lua5.1", "lua-5.1", "lua51"], "5.1");
46-
#[cfg(feature = "luajit")]
47-
let (incl_bound, excl_bound, alt_probe, ver) = ("2.0.4", "2.2", [], "JIT");
48-
49-
#[rustfmt::skip]
50-
let mut lua = pkg_config::Config::new()
51-
.range_version((Bound::Included(incl_bound), Bound::Excluded(excl_bound)))
52-
.cargo_metadata(true)
53-
.probe(if cfg!(feature = "luajit") { "luajit" } else { "lua" });
54-
55-
if lua.is_err() {
56-
for pkg in alt_probe {
57-
lua = pkg_config::Config::new()
58-
.cargo_metadata(true)
59-
.probe(pkg);
60-
61-
if lua.is_ok() {
62-
break;
63-
}
64-
}
65-
}
66-
67-
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();
6833
}
34+

0 commit comments

Comments
 (0)