From 6fc043ab061bf0d42bbafe1571a12ec493d3e3e6 Mon Sep 17 00:00:00 2001 From: Chris Emerson Date: Sun, 24 Jul 2022 09:22:20 +0100 Subject: [PATCH] Add lua-no-oslib feature to other Lua versions. --- crates/rlua-lua51-sys/Cargo.toml | 1 + crates/rlua-lua51-sys/build.rs | 8 ++++++-- crates/rlua-lua53-sys/Cargo.toml | 1 + crates/rlua-lua53-sys/build.rs | 8 ++++++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/crates/rlua-lua51-sys/Cargo.toml b/crates/rlua-lua51-sys/Cargo.toml index b108be07..d6db4ec2 100644 --- a/crates/rlua-lua51-sys/Cargo.toml +++ b/crates/rlua-lua51-sys/Cargo.toml @@ -22,3 +22,4 @@ pkg-config = "0.3.24" default = [] lua51-pkg-config = [] static = [] +lua-no-oslib = [] diff --git a/crates/rlua-lua51-sys/build.rs b/crates/rlua-lua51-sys/build.rs index 98b6c3b4..5254f473 100644 --- a/crates/rlua-lua51-sys/build.rs +++ b/crates/rlua-lua51-sys/build.rs @@ -40,7 +40,6 @@ fn main() { .file(lua_dir.join("ldump.c")) .file(lua_dir.join("lfunc.c")) .file(lua_dir.join("lgc.c")) - .file(lua_dir.join("linit.c")) .file(lua_dir.join("liolib.c")) .file(lua_dir.join("llex.c")) .file(lua_dir.join("lmathlib.c")) @@ -49,7 +48,6 @@ fn main() { .file(lua_dir.join("loadlib.c")) .file(lua_dir.join("lobject.c")) .file(lua_dir.join("lopcodes.c")) - .file(lua_dir.join("loslib.c")) .file(lua_dir.join("lparser.c")) .file(lua_dir.join("lstate.c")) .file(lua_dir.join("lstring.c")) @@ -61,6 +59,12 @@ fn main() { .file(lua_dir.join("lvm.c")) .file(lua_dir.join("lzio.c")); + if !cfg!(feature = "lua-no-oslib") { + cc_config_build = cc_config_build + .file(lua_dir.join("loslib.c")) + .file(lua_dir.join("linit.c")); + } + cc_config_build .out_dir(dst.join("lib")) .compile("liblua5.1.a"); diff --git a/crates/rlua-lua53-sys/Cargo.toml b/crates/rlua-lua53-sys/Cargo.toml index 80370a03..ef8efb94 100644 --- a/crates/rlua-lua53-sys/Cargo.toml +++ b/crates/rlua-lua53-sys/Cargo.toml @@ -22,3 +22,4 @@ pkg-config = "0.3.24" default = [] lua53-pkg-config = [] static = [] +lua-no-oslib = [] diff --git a/crates/rlua-lua53-sys/build.rs b/crates/rlua-lua53-sys/build.rs index 05b4a896..145e17b5 100644 --- a/crates/rlua-lua53-sys/build.rs +++ b/crates/rlua-lua53-sys/build.rs @@ -44,7 +44,6 @@ fn main() { .file(lua_dir.join("ldump.c")) .file(lua_dir.join("lfunc.c")) .file(lua_dir.join("lgc.c")) - .file(lua_dir.join("linit.c")) .file(lua_dir.join("liolib.c")) .file(lua_dir.join("llex.c")) .file(lua_dir.join("lmathlib.c")) @@ -52,7 +51,6 @@ fn main() { .file(lua_dir.join("loadlib.c")) .file(lua_dir.join("lobject.c")) .file(lua_dir.join("lopcodes.c")) - .file(lua_dir.join("loslib.c")) .file(lua_dir.join("lparser.c")) .file(lua_dir.join("lstate.c")) .file(lua_dir.join("lstring.c")) @@ -65,6 +63,12 @@ fn main() { .file(lua_dir.join("lvm.c")) .file(lua_dir.join("lzio.c")); + if !cfg!(feature = "lua-no-oslib") { + cc_config_build = cc_config_build + .file(lua_dir.join("loslib.c")) + .file(lua_dir.join("linit.c")); + } + cc_config_build .out_dir(dst.join("lib")) .compile("liblua5.3.a");