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:
kyren 2017-07-05 19:35:53 -04:00
parent 6b8a4240e2
commit b8fab1b3ed
2 changed files with 67 additions and 55 deletions

View File

@ -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"

View File

@ -3,6 +3,8 @@ extern crate gcc;
use std::env; use std::env;
fn main() { fn main() {
#[cfg(feature = "builtin-lua")]
{
let mut config = gcc::Config::new(); let mut config = gcc::Config::new();
let target_os = env::var("CARGO_CFG_TARGET_OS"); let target_os = env::var("CARGO_CFG_TARGET_OS");
@ -60,3 +62,4 @@ fn main() {
.file("lua/lzio.c") .file("lua/lzio.c")
.compile("liblua.a"); .compile("liblua.a");
} }
}