Make the builtin version of lua 5.3 optional
In case you would need to build a crazy custom version of lua for a weird platform. This could possibly be done in a cleaner way.
This commit is contained in:
parent
6b8a4240e2
commit
b8fab1b3ed
13
Cargo.toml
13
Cargo.toml
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rlua"
|
name = "rlua"
|
||||||
version = "0.8.0"
|
version = "0.8.1"
|
||||||
authors = ["kyren <catherine@chucklefish.org>"]
|
authors = ["kyren <catherine@chucklefish.org>"]
|
||||||
description = "High level bindings to Lua 5.3"
|
description = "High level bindings to Lua 5.3"
|
||||||
repository = "https://github.com/chucklefish/rlua"
|
repository = "https://github.com/chucklefish/rlua"
|
||||||
|
@ -9,8 +9,17 @@ readme = "README.md"
|
||||||
keywords = ["lua"]
|
keywords = ["lua"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["builtin-lua"]
|
||||||
|
# Builds the correct version of Lua 5.3 inside the crate. If you want to link a
|
||||||
|
# specialized version of lua into your binary, you can disable this feature to
|
||||||
|
# do that, but care must be taken. `rlua` expects the linked lua to define
|
||||||
|
# LUA_INTEGER as long long, and LUA_NUMBER as double, and may make other
|
||||||
|
# assumptions about how lua is built.
|
||||||
|
builtin-lua = ["gcc"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
gcc = "0.3"
|
gcc = { version = "0.3", optional = true }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
hlist-macro = "0.1"
|
hlist-macro = "0.1"
|
||||||
|
|
109
build.rs
109
build.rs
|
@ -3,60 +3,63 @@ extern crate gcc;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut config = gcc::Config::new();
|
#[cfg(feature = "builtin-lua")]
|
||||||
|
{
|
||||||
|
let mut config = gcc::Config::new();
|
||||||
|
|
||||||
let target_os = env::var("CARGO_CFG_TARGET_OS");
|
let target_os = env::var("CARGO_CFG_TARGET_OS");
|
||||||
let target_family = env::var("CARGO_CFG_TARGET_FAMILY");
|
let target_family = env::var("CARGO_CFG_TARGET_FAMILY");
|
||||||
|
|
||||||
if target_os == Ok("linux".to_string()) {
|
if target_os == Ok("linux".to_string()) {
|
||||||
config.define("LUA_USE_LINUX", None);
|
config.define("LUA_USE_LINUX", None);
|
||||||
} else if target_os == Ok("macos".to_string()) {
|
} else if target_os == Ok("macos".to_string()) {
|
||||||
config.define("LUA_USE_MACOSX", None);
|
config.define("LUA_USE_MACOSX", None);
|
||||||
} else if target_family == Ok("unix".to_string()) {
|
} else if target_family == Ok("unix".to_string()) {
|
||||||
config.define("LUA_USE_POSIX", None);
|
config.define("LUA_USE_POSIX", None);
|
||||||
} else if target_family == Ok("windows".to_string()) {
|
} else if target_family == Ok("windows".to_string()) {
|
||||||
config.define("LUA_USE_WINDOWS", None);
|
config.define("LUA_USE_WINDOWS", None);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enables lua api checking, which has a slight performance penalty. We
|
||||||
|
// could allow disabling this via cfg one day when there is much more
|
||||||
|
// confidence in the soundness of the API.
|
||||||
|
config.define("LUA_USE_APICHECK", None);
|
||||||
|
|
||||||
|
config
|
||||||
|
.include("lua")
|
||||||
|
.file("lua/lapi.c")
|
||||||
|
.file("lua/lauxlib.c")
|
||||||
|
.file("lua/lbaselib.c")
|
||||||
|
.file("lua/lbitlib.c")
|
||||||
|
.file("lua/lcode.c")
|
||||||
|
.file("lua/lcorolib.c")
|
||||||
|
.file("lua/lctype.c")
|
||||||
|
.file("lua/ldblib.c")
|
||||||
|
.file("lua/ldebug.c")
|
||||||
|
.file("lua/ldo.c")
|
||||||
|
.file("lua/ldump.c")
|
||||||
|
.file("lua/lfunc.c")
|
||||||
|
.file("lua/lgc.c")
|
||||||
|
.file("lua/linit.c")
|
||||||
|
.file("lua/liolib.c")
|
||||||
|
.file("lua/llex.c")
|
||||||
|
.file("lua/lmathlib.c")
|
||||||
|
.file("lua/lmem.c")
|
||||||
|
.file("lua/loadlib.c")
|
||||||
|
.file("lua/lobject.c")
|
||||||
|
.file("lua/lopcodes.c")
|
||||||
|
.file("lua/loslib.c")
|
||||||
|
.file("lua/lparser.c")
|
||||||
|
.file("lua/lstate.c")
|
||||||
|
.file("lua/lstring.c")
|
||||||
|
.file("lua/lstrlib.c")
|
||||||
|
.file("lua/ltable.c")
|
||||||
|
.file("lua/ltablib.c")
|
||||||
|
.file("lua/ltm.c")
|
||||||
|
.file("lua/lundump.c")
|
||||||
|
.file("lua/lutf8lib.c")
|
||||||
|
.file("lua/lvm.c")
|
||||||
|
.file("lua/lzio.c")
|
||||||
|
.compile("liblua.a");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enables lua api checking, which has a slight performance penalty. We
|
|
||||||
// could allow disabling this via cfg one day when there is much more
|
|
||||||
// confidence in the soundness of the API.
|
|
||||||
config.define("LUA_USE_APICHECK", None);
|
|
||||||
|
|
||||||
config
|
|
||||||
.include("lua")
|
|
||||||
.file("lua/lapi.c")
|
|
||||||
.file("lua/lauxlib.c")
|
|
||||||
.file("lua/lbaselib.c")
|
|
||||||
.file("lua/lbitlib.c")
|
|
||||||
.file("lua/lcode.c")
|
|
||||||
.file("lua/lcorolib.c")
|
|
||||||
.file("lua/lctype.c")
|
|
||||||
.file("lua/ldblib.c")
|
|
||||||
.file("lua/ldebug.c")
|
|
||||||
.file("lua/ldo.c")
|
|
||||||
.file("lua/ldump.c")
|
|
||||||
.file("lua/lfunc.c")
|
|
||||||
.file("lua/lgc.c")
|
|
||||||
.file("lua/linit.c")
|
|
||||||
.file("lua/liolib.c")
|
|
||||||
.file("lua/llex.c")
|
|
||||||
.file("lua/lmathlib.c")
|
|
||||||
.file("lua/lmem.c")
|
|
||||||
.file("lua/loadlib.c")
|
|
||||||
.file("lua/lobject.c")
|
|
||||||
.file("lua/lopcodes.c")
|
|
||||||
.file("lua/loslib.c")
|
|
||||||
.file("lua/lparser.c")
|
|
||||||
.file("lua/lstate.c")
|
|
||||||
.file("lua/lstring.c")
|
|
||||||
.file("lua/lstrlib.c")
|
|
||||||
.file("lua/ltable.c")
|
|
||||||
.file("lua/ltablib.c")
|
|
||||||
.file("lua/ltm.c")
|
|
||||||
.file("lua/lundump.c")
|
|
||||||
.file("lua/lutf8lib.c")
|
|
||||||
.file("lua/lvm.c")
|
|
||||||
.file("lua/lzio.c")
|
|
||||||
.compile("liblua.a");
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue