Skip to content

Commit 66d3c87

Browse files
committed
fix(js): ARMv7 gnueabihf build
Signed-off-by: Dmitry Dygalo <[email protected]>
1 parent acde6ac commit 66d3c87

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

bindings/javascript/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ crate-type = ["cdylib"]
1818
[target.'cfg(not(any(target_os = "linux", target_family = "wasm")))'.dependencies]
1919
mimalloc = "0.1"
2020

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

2424
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]

bindings/javascript/js-binding.js

+25-10
Original file line numberDiff line numberDiff line change
@@ -224,17 +224,32 @@ switch (platform) {
224224
}
225225
break
226226
case 'arm':
227-
localFileExisted = existsSync(
228-
join(__dirname, 'css-inline.linux-arm-gnueabihf.node')
229-
)
230-
try {
231-
if (localFileExisted) {
232-
nativeBinding = require('./css-inline.linux-arm-gnueabihf.node')
233-
} else {
234-
nativeBinding = require('@css-inline/css-inline-linux-arm-gnueabihf')
227+
if (isMusl()) {
228+
localFileExisted = existsSync(
229+
join(__dirname, 'css-inline.linux-arm-musleabihf.node')
230+
)
231+
try {
232+
if (localFileExisted) {
233+
nativeBinding = require('./css-inline.linux-arm-musleabihf.node')
234+
} else {
235+
nativeBinding = require('@css-inline/css-inline-linux-arm-musleabihf')
236+
}
237+
} catch (e) {
238+
loadError = e
239+
}
240+
} else {
241+
localFileExisted = existsSync(
242+
join(__dirname, 'css-inline.linux-arm-gnueabihf.node')
243+
)
244+
try {
245+
if (localFileExisted) {
246+
nativeBinding = require('./css-inline.linux-arm-gnueabihf.node')
247+
} else {
248+
nativeBinding = require('@css-inline/css-inline-linux-arm-gnueabihf')
249+
}
250+
} catch (e) {
251+
loadError = e
235252
}
236-
} catch (e) {
237-
loadError = e
238253
}
239254
break
240255
case 'riscv64':

bindings/javascript/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ mod options;
88
use options::Options;
99

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

0 commit comments

Comments
 (0)