Commit graph

32 commits

Author SHA1 Message Date
Alex Orlenko 1807fa789c
Don't require Lua sources for modules in build system 2022-05-07 22:16:54 +01:00
Alex Orlenko dba76f3994
Merge pull request #145 from zh-jq/patch-v0.7.4
support luajit version 2.0.4
2022-04-15 20:25:32 +01:00
zhangjingqiang 75697e3a3b support luajit version 2.0.4 2022-04-13 13:36:45 +08:00
Alex Orlenko 55b778c68b
Fix clippy warnings 2022-03-22 00:47:31 +00:00
Alex Orlenko c322e028e2
Initial Luau support 2022-03-20 20:30:20 +00:00
Alex Orlenko 6dc127f4eb
Refactor ffi module
Initial Luau support work
2022-03-20 20:30:18 +00:00
Alex Orlenko f52d106a82
Fix "find_dummy" compile error if no lua feature selected 2022-03-01 19:59:42 +00:00
Alex Orlenko 4963cc1b8b
Fix cross compilation (bug introduced in 84a174c) 2022-01-19 17:42:32 +00:00
Alex Orlenko 84a174c94d
Allow pkg-config to omit include paths if they equals to standard.
See #114
2021-12-28 12:02:02 +00:00
Alex Orlenko 888b2bbf8d
Refactor build/find_normal.rs to include error messages instead of unwrap() 2021-12-28 10:26:12 +00:00
Alex Orlenko 806f0bcef4
Add luajit52 support (LuaJIT with partial compatibility with Lua 5.2) 2021-11-04 12:26:11 +00:00
Alex Orlenko 458b06796c
Fixed LUA_REGISTRYINDEX when generating glue.rs on cross-compiling for lua51(jit) 2021-10-08 21:15:22 +01:00
Alex Orlenko 9f0378b77e Complitely remove the C shim 2021-06-16 22:21:45 +01:00
Alex Orlenko d3f44354e0 Revert commit ced808d5ab
I think this experiment is unsuccessful and does not work well in a module mode
with dynamic symbols resolution and mixing between different mlua instances.
Overall the Rust bug has been fixed and we can wait for the "C-unwind" feature become stable.
2021-06-16 22:13:01 +01:00
Alex Orlenko 3b9d8a7b5f Keep all Lua symbols in unsafe mode to load C modules 2021-06-12 18:00:55 +01:00
Alex Orlenko 2250421438 Fix clippy warnings 2021-05-04 23:42:33 +01:00
Alex Orlenko ced808d5ab Don't trigger longjmp in rust.
Motivation behind this change is upcoming breaking change in Rust
compiler v1.52.0 to prevent unwinding across FFI boundaries.
https://github.com/rust-lang/rust/pull/76570
The new functionality requires nightly compiler to declare FFI
functions as "C-unwind".
The fundamental solution is to use C shim to wrap "e" and "m"
Lua functions in pcall.
Additionally define Rust calling convention to trigger lua_error
on Rust behalf.
2021-04-27 00:29:38 +01:00
Alex Orlenko 3e7f25670a Don't read lua.h from build script (was not used) 2021-04-20 02:05:00 +01:00
Alex Orlenko 58cb371f06 Add rerun-if-changed instructions to build script 2021-04-14 22:33:23 +01:00
Alex Orlenko 8add60b019 Don't check LUA_LIB_NAME if it's not needed 2021-04-14 22:25:49 +01:00
Alex Orlenko e62fd400d7 Remove unused exports from glue.{c,rs} && Fix some clippy warnings 2021-01-16 13:31:45 +00:00
Wez Furlong faf19e4a06 Allow luajit to build in the pointer size cross compilation case 2021-01-13 20:01:12 -08:00
Wez Furlong e0d9ec41e2 Support cross compilation
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
2021-01-13 09:55:53 -08:00
Alex Orlenko a35b8dda68 Raise compile_error! instead of panic! in the build script 2020-06-07 20:38:19 +01:00
Alex Orlenko 5952a1f709 New module feature
Don't link module with Lua core (see: http://lua-users.org/wiki/BuildingModules)
Example and tests for modules
2020-06-07 20:38:11 +01:00
Alex Orlenko 2fd6757f39 Add LuaJIT 2.0.5 stable support 2020-06-06 16:07:16 +01:00
Alex Orlenko 9f2d598517 Add clippy check and fix clippy warnings 2020-05-15 01:48:56 +01:00
Alex Orlenko 539b569ff4 Add Lua 5.4 (rc2) support 2020-05-11 02:43:34 +01:00
Alex Orlenko f7dc9da107 Update README
Cargo fmt and minor changes
2020-04-17 22:52:34 +01:00
Alex Orlenko 47e8a80c1c v0.3.0-alpha.1 with async support
Squashed commit of the async branch.
2020-04-17 22:39:50 +01:00
Alex Orlenko d5bc9c8c24 Combine lua-vendored and luajit-vendored features into "vendored" 2020-01-27 21:21:50 +00:00
Alex Orlenko 07fc4642ae Support vendored versions of Lua and LuaJIT 2020-01-25 20:47:31 +00:00