Skip to content

Commit 1da889c

Browse files
authored
Fix linking on Android due to Luau JIT (#153)
1 parent faa15cf commit 1da889c

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

Cargo.toml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
[package]
22
name = "seal"
3+
authors = ["Dev Chrysalis Dalal <dev@deviaze.com>"]
34
version = "0.0.7-rc.1"
45
edition = "2024"
56

6-
[dependencies]
7-
# need to rely on the git version as it contains the most up-to-date luau;
8-
# mlua creates official releases very infrequently but khvzak seems to be updating his `main` very regularly upon Luau releases.
9-
# If this breaks we'll pin to a commit and risk lagging behind Luau
10-
# but mlua's main branch is relatively stable and hasn't broken for us before nor for other projects.
11-
# we need to enable error-send so we can propogate errors across threads in std_thread.rs
7+
# mluau is our custom mlua fork with a greater focus on luau and luau ecosystem
8+
# support, maintained by Midnight Frost and myself (mostly him).
9+
[target.'cfg(not(target_os = "android"))'.dependencies]
1210
mluau = { git = "https://github.com/mluau/mluau.git", features = ["luau", "luau-jit", "serialize", "error-send"] }
11+
12+
[target.'cfg(target_os = "android")'.dependencies]
13+
# luau jit (ncg) compilation is not available on android
14+
mluau = { git = "https://github.com/mluau/mluau.git", features = ["luau", "serialize", "error-send"] }
15+
16+
[dependencies]
1317
regex = "1.11.1"
1418
# needed for seal setup (really useful!)
1519
include_dir = { version = "0.7.4" }
@@ -28,6 +32,8 @@ serde-xml-rs = "0.5.1"
2832
hex = "0.4.3"
2933
lz4_flex = { version = "0.12" }
3034
flate2 = "1.0"
35+
urlencoding = "2.1.3"
36+
zstd = "0.13.3"
3137
copy_dir = "0.1.3"
3238
# we should switch to a more maintained alternative when possible,
3339
# but as long as ring receives security updates it's not a huge priority
@@ -36,6 +42,7 @@ rsa = "0.9.8"
3642
rand = "0.8.5"
3743
# simple wrapper lib, might want to switch to a more frequently updated one?
3844
simple_crypt = "0.2.3"
45+
# @std/str lib
3946
unicode-segmentation = "1.12.0"
4047
# used for very fast string pattern searches (str.split*)
4148
aho-corasick = "1.1.3"
@@ -54,16 +61,18 @@ jiff = "0.2.15"
5461
# manual terminal stuff and manual astrick password
5562
crossterm = "0.29.0"
5663
# determines if we should fallback to stdin handling in @std/io/input and @std/cli
64+
# as well as what happens to output during errors/panics
5765
atty = "0.2.14"
5866
# sane cli input handling in @std/cli
5967
rustyline = "17.0.2"
6068
# hidden password handling so i dont have to implement it myself with crossterm
6169
rpassword = "7.4.0"
62-
zstd = "0.13.3"
70+
# format.hexdump and dp
6371
pretty-hex = "0.4.1"
72+
# websockets
6473
tungstenite = { version = "0.28.0", features = ["native-tls"] }
6574
url = "2.5.7"
66-
urlencoding = "2.1.3"
75+
# needed for .env support in @std/env/vars
6776
dotenvy = "0.15.7"
6877

6978
[profile.dev.package.num-bigint-dig]

src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ fn main() -> LuaResult<()> {
192192
}
193193
}
194194

195+
#[cfg_attr(target_os = "android", expect(unused_variables))]
195196
fn set_jit(luau: &Lua) -> bool {
196197
let should_jit = match std::env::var("SEAL_NO_JIT") {
197198
Ok(var) if var.eq_ignore_ascii_case("true") => false,
@@ -200,7 +201,10 @@ fn set_jit(luau: &Lua) -> bool {
200201
Err(_) => true,
201202
};
202203

203-
luau.enable_jit(should_jit);
204+
#[cfg(not(target_os = "android"))]
205+
{
206+
luau.enable_jit(should_jit);
207+
}
204208

205209
should_jit
206210
}

0 commit comments

Comments
 (0)