e0d9ec41e2
This commit teaches the build script to recognize when it is cross-compiling and switch to an alternative approach for generating the `glue.rs` module. It defaults to the equivalent logic found in the lua headers to set the default types and parameters. Notably: it doesn't statically produce the default lua paths as we cannot know these without either executing the code (not guaranteed possible when cross compiling) or regexing out the paths from the headers (a bit brittle). An alternative approach might be to use something like `lazy_static` to ask the library for its compiled in values once at runtime. I've tested this with: ``` cargo build --target armv7-unknown-linux-gnueabihf --features lua51,vendored cargo build --target armv7-unknown-linux-gnueabihf --features lua52,vendored cargo build --target armv7-unknown-linux-gnueabihf --features lua53,vendored cargo build --target armv7-unknown-linux-gnueabihf --features lua54,vendored cargo build --target armv7-unknown-linux-gnueabihf --features luajit,vendored ``` All except luajit compile. Luajit itself doesn't cross compile, so I don't think we can ever reasonably get that to work. I haven't tried to run any of this yet; my use case is actually for mac (https://github.com/wez/wezterm/pull/426) so I need to commit this and try patching it in over there before I can see if that truly worked end-to-end. refs: https://github.com/khvzak/mlua/issues/14 |
||
---|---|---|
.. | ||
find_dummy.rs | ||
find_normal.rs | ||
find_vendored.rs | ||
main.rs |