jcmoyer / rust-lua53

Lua 5.3 bindings for Rust
MIT License
158 stars 45 forks source link

Bundle Lua rather than download it #59

Closed SpaceManiac closed 8 years ago

SpaceManiac commented 8 years ago

In #51 I mentioned that the other Lua -sys crate bundles its Lua source. I heard recently from someone on IRC that buildscripts are not supposed to hit the network (though I can't find a documented source for this), so I was spurred to go ahead and try to make this change.

The environment var LUA_VERSION is removed, and LUA_LOCAL_SOURCE's meaning is changed: instead of pointing to a .tar.gz, it should point to the src/ directory of a copy of Lua. If this directory contains a liblua.a, it is used; otherwise Lua is built from these sources. If LUA_LOCAL_SOURCE is not provided, the copy of Lua bundled with the crate is used.

The Makefile is still invoked, so the dependency on make remains, but now neither curl nor wget is needed. The Makefile is invoked with extra parameters such that the output files end up inside Cargo's OUT_DIR. It would be easy to simplify the buildscript and remove the dependency on make by using the gcc crate directly, but the platform-specific configuration in Lua's Makefile would be lost.

This PR is in two commits: one adding a copy of Lua 5.3.3 sourced from where the buildscript was previously downloading it, and another modifying the buildscript.

Tested on Linux and Windows with no problems.

jcmoyer commented 8 years ago

I think this is definitely preferable. Thanks for the PR.