Skip to content

Commit

Permalink
fix(js): ARMv7 gnueabihf build
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Dygalo <[email protected]>
  • Loading branch information
Stranger6667 committed Jul 6, 2024
1 parent acde6ac commit 66d3c87
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bindings/javascript/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ crate-type = ["cdylib"]
[target.'cfg(not(any(target_os = "linux", target_family = "wasm")))'.dependencies]
mimalloc = "0.1"

[target.'cfg(target_os = "linux")'.dependencies]
[target.'cfg(all(target_os = "linux", not(target_arch = "arm")))'.dependencies]
mimalloc = { version = "0.1", features = ["local_dynamic_tls"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand Down
35 changes: 25 additions & 10 deletions bindings/javascript/js-binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,32 @@ switch (platform) {
}
break
case 'arm':
localFileExisted = existsSync(
join(__dirname, 'css-inline.linux-arm-gnueabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./css-inline.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('@css-inline/css-inline-linux-arm-gnueabihf')
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'css-inline.linux-arm-musleabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./css-inline.linux-arm-musleabihf.node')
} else {
nativeBinding = require('@css-inline/css-inline-linux-arm-musleabihf')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'css-inline.linux-arm-gnueabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./css-inline.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('@css-inline/css-inline-linux-arm-gnueabihf')
}
} catch (e) {
loadError = e
}
} catch (e) {
loadError = e
}
break
case 'riscv64':
Expand Down
1 change: 1 addition & 0 deletions bindings/javascript/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod options;
use options::Options;

#[cfg(not(target_family = "wasm"))]
#[cfg(not(all(target_os = "linux", target_arch = "arm")))]
#[global_allocator]
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;

Expand Down

0 comments on commit 66d3c87

Please sign in to comment.