diff --git a/Cargo.standalone.toml b/Cargo.standalone.toml index 28a5374..0a47973 100644 --- a/Cargo.standalone.toml +++ b/Cargo.standalone.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-napi" -version = "0.703.0" +version = "0.704.0" description = "NAPI library for Wasmer WebAssembly runtime" edition = "2024" license = "MIT" diff --git a/Cargo.toml b/Cargo.toml index 8caea7f..3d6b7f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmer-napi" -version = "0.703.0" +version = "0.704.0" description = "NAPI library for Wasmer WebAssembly runtime" edition = "2024" license = "MIT" @@ -36,16 +36,16 @@ cli = [ anyhow = "1" # This manifest is consumed as `wasmer/lib/napi`, so Wasmer dependencies must # stay relative to that checkout. Standalone builds use Cargo.standalone.toml. -wasmer = { version = "=7.3.0", path = "../api", default-features = false } +wasmer = { version = "=7.4.0", path = "../api", default-features = false } # This dependencies are ONLY needed for testing napi in Wasm locally -wasmer-cache = { version = "=7.3.0", path = "../cache", optional = true } -wasmer-c-api-imports = { version = "=7.3.0", path = "../c-api-imports", optional = true, default-features = false } -wasmer-types = { version = "=7.3.0", path = "../types", optional = true } +wasmer-cache = { version = "=7.4.0", path = "../cache", optional = true } +wasmer-c-api-imports = { version = "=7.4.0", path = "../c-api-imports", optional = true, default-features = false } +wasmer-types = { version = "=7.4.0", path = "../types", optional = true } # Non-optional: the guest callback trampoline re-raises guest WASI process # exits (`WasiError::Exit`) through the N-API import layers, so `mod guest` # (always compiled) needs the WASIX error type in every build. -virtual-fs = { version = "=0.703.0", path = "../virtual-fs", optional = true } +virtual-fs = { version = "=0.704.0", path = "../virtual-fs", optional = true } tokio = { version = "1", features = ["rt-multi-thread"], optional = true } enum-iterator = "2.3.0" offset-allocator = "0.2.0" @@ -54,15 +54,15 @@ offset-allocator = "0.2.0" js-sys = { version = "0.3", optional = true } wasm-bindgen = { version = "0.2.120", optional = true } wasm-bindgen-futures = { version = "0.4", optional = true } -wasmer-wasix = { version = "=0.703.0", path = "../wasix", default-features = false, features = [ +wasmer-wasix = { version = "=0.704.0", path = "../wasix", default-features = false, features = [ "js", ] } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -wasmer = { version = "=7.3.0", path = "../api", default-features = false, features = [ +wasmer = { version = "=7.4.0", path = "../api", default-features = false, features = [ "sys-default", ] } -wasmer-wasix = { version = "=0.703.0", path = "../wasix", default-features = false, features = [ +wasmer-wasix = { version = "=0.704.0", path = "../wasix", default-features = false, features = [ "sys", ] } diff --git a/Makefile b/Makefile index d0af1ab..b4d7c62 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ NAPI_NATIVE_TEST_OUT_DIR ?= $(abspath $(BUILD_WASIX_NAPI_DIR)/native) NAPI_WASIX_TEST_OUT_DIR ?= $(abspath $(BUILD_WASIX_NAPI_DIR)/wasm32-wasix/release) NAPI_V8_CTEST_ARGS ?= -E 'SandboxGlobalThisAndMarkerAreNotEnumerableForDeepFreeze' NAPI_QUICKJS_CTEST_ARGS ?= -E 'SandboxGlobalThisAndMarkerAreNotEnumerableForDeepFreeze' -NAPI_V8_PREBUILT_VERSION ?= 11.9.7 +NAPI_V8_PREBUILT_VERSION ?= 11.9.8 NAPI_V8_PLATFORM := NAPI_V8_DIST_ROOT ?= NAPI_V8_CARGO_DIST_ROOT ?= @@ -37,6 +37,8 @@ endif else ifeq ($(UNAME_S),Linux) ifeq ($(UNAME_M),x86_64) NAPI_V8_PLATFORM := linux-amd64 +else ifeq ($(UNAME_M),aarch64) +NAPI_V8_PLATFORM := linux-arm64 endif endif ifeq ($(NAPI_V8_DIST_ROOT),) diff --git a/build.rs b/build.rs index 24cb7d1..ec9129a 100644 --- a/build.rs +++ b/build.rs @@ -4,7 +4,7 @@ use std::{ path::{Path, PathBuf}, }; -const PREBUILT_V8_VERSION: &str = "11.9.7"; +const PREBUILT_V8_VERSION: &str = "11.9.8"; #[derive(Debug, Clone, Copy, PartialEq, Eq)] enum V8Method { @@ -391,6 +391,7 @@ fn prebuilt_asset_name() -> Result<(&'static str, &'static str), String> { ("macos", "aarch64", _) => Ok(("v8-darwin-aarch64.tar.xz", "darwin-arm64")), ("macos", "x86_64", _) => Ok(("v8-darwin-amd64.tar.xz", "darwin-amd64")), ("linux", "x86_64", "gnu") => Ok(("v8-linux-amd64.tar.xz", "linux-amd64")), + ("linux", "aarch64", "gnu") => Ok(("v8-linux-arm64.tar.xz", "linux-arm64")), ("linux", "x86_64", "musl") => Ok(("v8-linux-musl-amd64.tar.xz", "linux-musl-amd64")), ("android", "aarch64", _) => Ok(("v8-android-arm64.tar.xz", "android-arm64")), ("windows", "x86_64", _) => Ok(("v8-windows-amd64.tar.xz", "windows-amd64")), diff --git a/src/guest/napi.rs b/src/guest/napi.rs index e2c11b0..3d470f7 100644 --- a/src/guest/napi.rs +++ b/src/guest/napi.rs @@ -1787,7 +1787,7 @@ fn guest_napi_create_string_utf8( let s = unsafe { snapi_bridge_create_string_utf8( snapi_env(&env, e), - sb.as_ptr() as *const i8, + sb.as_ptr() as *const std::ffi::c_char, sb.len() as u32, &mut out, ) @@ -1821,7 +1821,7 @@ fn guest_napi_create_string_latin1( let s = unsafe { snapi_bridge_create_string_latin1( snapi_env(&env, e), - sb.as_ptr() as *const i8, + sb.as_ptr() as *const std::ffi::c_char, sb.len() as u32, &mut out, ) @@ -3560,7 +3560,7 @@ fn guest_napi_define_class( }; let mut prop_names_c: Vec = Vec::with_capacity(pc as usize); - let mut prop_names_ptrs: Vec<*const i8> = Vec::with_capacity(pc as usize); + let mut prop_names_ptrs: Vec<*const std::ffi::c_char> = Vec::with_capacity(pc as usize); let mut prop_name_ids: Vec = Vec::with_capacity(pc as usize); let mut prop_types: Vec = Vec::with_capacity(pc as usize); let mut prop_value_ids: Vec = Vec::with_capacity(pc as usize); @@ -3746,7 +3746,7 @@ fn guest_napi_define_properties( }; let mut prop_names_c: Vec = Vec::with_capacity(pc as usize); - let mut prop_names_ptrs: Vec<*const i8> = Vec::with_capacity(pc as usize); + let mut prop_names_ptrs: Vec<*const std::ffi::c_char> = Vec::with_capacity(pc as usize); let mut prop_name_ids: Vec = Vec::with_capacity(pc as usize); let mut prop_types: Vec = Vec::with_capacity(pc as usize); let mut prop_value_ids: Vec = Vec::with_capacity(pc as usize); diff --git a/src/snapi.rs b/src/snapi.rs index 96b48c6..27c5546 100644 --- a/src/snapi.rs +++ b/src/snapi.rs @@ -2,7 +2,7 @@ // C++ bridge FFI declarations (from napi_bridge_init.cc) // ============================================================ -use core::ffi::c_void; +use core::ffi::{c_char, c_void}; #[repr(C)] pub struct SnapiEnvState { @@ -54,7 +54,7 @@ unsafe extern "C" { pub fn snapi_bridge_init() -> i32; pub fn snapi_bridge_set_v8_worker_thread_count(count: u32) -> i32; pub fn snapi_bridge_unofficial_configure_runtime( - engine_flags: *const i8, + engine_flags: *const c_char, engine_flags_length: u32, ) -> i32; pub fn snapi_bridge_unofficial_create_env( @@ -162,7 +162,7 @@ unsafe extern "C" { ) -> i32; pub fn snapi_bridge_unofficial_create_private_symbol( env: SnapiEnv, - str_ptr: *const i8, + str_ptr: *const c_char, wasm_length: u32, out_id: *mut u32, ) -> i32; @@ -431,13 +431,13 @@ unsafe extern "C" { pub fn snapi_bridge_get_global(env: SnapiEnv, out_id: *mut u32) -> i32; pub fn snapi_bridge_create_string_utf8( env: SnapiEnv, - str_ptr: *const i8, + str_ptr: *const c_char, wasm_length: u32, out_id: *mut u32, ) -> i32; pub fn snapi_bridge_create_string_latin1( env: SnapiEnv, - str_ptr: *const i8, + str_ptr: *const c_char, wasm_length: u32, out_id: *mut u32, ) -> i32; @@ -456,14 +456,14 @@ unsafe extern "C" { pub fn snapi_bridge_get_value_string_utf8( env: SnapiEnv, id: u32, - buf: *mut i8, + buf: *mut c_char, bufsize: usize, result: *mut usize, ) -> i32; pub fn snapi_bridge_get_value_string_latin1( env: SnapiEnv, id: u32, - buf: *mut i8, + buf: *mut c_char, bufsize: usize, result: *mut usize, ) -> i32; @@ -521,19 +521,19 @@ unsafe extern "C" { pub fn snapi_bridge_set_named_property( env: SnapiEnv, obj_id: u32, - name: *const i8, + name: *const c_char, val_id: u32, ) -> i32; pub fn snapi_bridge_get_named_property( env: SnapiEnv, obj_id: u32, - name: *const i8, + name: *const c_char, out_id: *mut u32, ) -> i32; pub fn snapi_bridge_has_named_property( env: SnapiEnv, obj_id: u32, - name: *const i8, + name: *const c_char, result: *mut i32, ) -> i32; pub fn snapi_bridge_set_element(env: SnapiEnv, obj_id: u32, index: u32, val_id: u32) -> i32; @@ -591,9 +591,17 @@ unsafe extern "C" { out_id: *mut u32, ) -> i32; pub fn snapi_bridge_throw(env: SnapiEnv, error_id: u32) -> i32; - pub fn snapi_bridge_throw_error(env: SnapiEnv, code: *const i8, msg: *const i8) -> i32; - pub fn snapi_bridge_throw_type_error(env: SnapiEnv, code: *const i8, msg: *const i8) -> i32; - pub fn snapi_bridge_throw_range_error(env: SnapiEnv, code: *const i8, msg: *const i8) -> i32; + pub fn snapi_bridge_throw_error(env: SnapiEnv, code: *const c_char, msg: *const c_char) -> i32; + pub fn snapi_bridge_throw_type_error( + env: SnapiEnv, + code: *const c_char, + msg: *const c_char, + ) -> i32; + pub fn snapi_bridge_throw_range_error( + env: SnapiEnv, + code: *const c_char, + msg: *const c_char, + ) -> i32; pub fn snapi_bridge_is_exception_pending(env: SnapiEnv, result: *mut i32) -> i32; pub fn snapi_bridge_get_and_clear_last_exception(env: SnapiEnv, out_id: *mut u32) -> i32; // Symbol @@ -941,7 +949,7 @@ unsafe extern "C" { // Callback system pub fn snapi_bridge_create_function( env: SnapiEnv, - utf8name: *const i8, + utf8name: *const c_char, name_len: u32, reg_id: u32, out_id: *mut u32, @@ -979,11 +987,11 @@ unsafe extern "C" { // napi_define_class pub fn snapi_bridge_define_class( env: SnapiEnv, - utf8name: *const i8, + utf8name: *const c_char, name_len: u32, ctor_reg_id: u32, prop_count: u32, - prop_names: *const *const i8, + prop_names: *const *const c_char, prop_name_ids: *const u32, prop_types: *const u32, prop_value_ids: *const u32, @@ -997,7 +1005,7 @@ unsafe extern "C" { env: SnapiEnv, obj_id: u32, prop_count: u32, - prop_names: *const *const i8, + prop_names: *const *const c_char, prop_name_ids: *const u32, prop_types: *const u32, prop_value_ids: *const u32, diff --git a/tests/build-test-native.sh b/tests/build-test-native.sh index f98cc4c..f8a0d29 100755 --- a/tests/build-test-native.sh +++ b/tests/build-test-native.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -PREBUILT_V8_VERSION="11.9.7" +PREBUILT_V8_VERSION="11.9.8" if [[ $# -ne 1 ]]; then echo "usage: $0 " >&2 @@ -84,6 +84,9 @@ resolve_cached_prebuilt_v8() { linux/x86_64) platform_name="linux-amd64" ;; + linux/aarch64) + platform_name="linux-arm64" + ;; *) return 1 ;; diff --git a/v8/cmake/NapiV8Resolver.cmake b/v8/cmake/NapiV8Resolver.cmake index f340541..109c63f 100644 --- a/v8/cmake/NapiV8Resolver.cmake +++ b/v8/cmake/NapiV8Resolver.cmake @@ -1,4 +1,4 @@ -set(NAPI_V8_PREBUILT_VERSION "11.9.2") +set(NAPI_V8_PREBUILT_VERSION "11.9.8") set(NAPI_V8_PREBUILT_BASE_URL "https://github.com/wasmerio/v8-custom-builds/releases/download/${NAPI_V8_PREBUILT_VERSION}") @@ -109,7 +109,15 @@ function(_napi_v8_prebuilt_strategy out_ok out_include out_library out_extra out if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")) set(_platform "darwin-arm64") - set(_asset "v8-darwin-arm64.tar.xz") + set(_asset "v8-darwin-aarch64.tar.xz") + elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND + (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64")) + set(_platform "darwin-amd64") + set(_asset "v8-darwin-amd64.tar.xz") + elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND + (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")) + set(_platform "linux-arm64") + set(_asset "v8-linux-arm64.tar.xz") elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64")) set(_platform "linux-amd64")