diff --git a/.cargo/config.toml b/.cargo/config.toml index 39048c06a33..268b363d1c1 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,25 +3,6 @@ # (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). [alias] - quick = "make quick" tidy = "make tidy" - -# Run Clippy on all code paths -# Keep args in sync with `clippy` job in .github/workflows/build-test.yml clippy-all = "clippy --all-features --all-targets -- -D warnings" - -# Build configuration for small binary size -panic-abort-build = "build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort" - -wasm-build-release = "panic-abort-build --target wasm32-unknown-unknown --profile=release-opt-size" - -[target.wasm32-unknown-unknown] -rustflags = [ - # 100 KiB, working around a bug in older rustc - # https://github.com/unicode-org/icu4x/issues/2753 - # keep in sync with wasm's and tinywasm's build.sh - "-C", "link-args=-z stack-size=100000", - "-C", "panic=abort", - "-C", "opt-level=s" -] diff --git a/Cargo.toml b/Cargo.toml index 6a89d0ad68b..214189dc672 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -239,14 +239,13 @@ diplomat-runtime = { git = "https://github.com/rust-diplomat/diplomat", rev = "3 diplomat_core = { git = "https://github.com/rust-diplomat/diplomat", rev = "354307d4a519a3f42a9dc744ea0d64d766431d1d" } diplomat-tool = { git = "https://github.com/rust-diplomat/diplomat", rev = "354307d4a519a3f42a9dc744ea0d64d766431d1d" } -# LTO is needed for WASM and other size-optimized builds, -# and it improve the performance of benchmarks -[profile.release] -lto = true - +# Size optimized builds [profile.release-opt-size] inherits = "release" +lto = true opt-level = "s" +panic = "abort" +codegen-units = 1 # Enable debug information specifically for memory profiling. # https://docs.rs/dhat/0.2.1/dhat/#configuration @@ -254,6 +253,7 @@ opt-level = "s" # 2021-01-08: This would be nicer as a named profile, e.g. [profile.memory] # https://github.com/rust-lang/cargo/issues/6988 [profile.bench] +lto = true debug = true debug-assertions = false diff --git a/ffi/capi/c/examples/fixeddecimal_tiny/Makefile b/ffi/capi/c/examples/fixeddecimal_tiny/Makefile index 3f3202be645..e9f610f4290 100644 --- a/ffi/capi/c/examples/fixeddecimal_tiny/Makefile +++ b/ffi/capi/c/examples/fixeddecimal_tiny/Makefile @@ -20,53 +20,53 @@ LLD := lld-15 baked_data/macros.rs: cargo run -p icu_datagen -- --locales en bn --keys all --fallback preresolved --format mod --out baked_data --overwrite -../../../../../target/debug/libicu_capi_staticlib.a: FORCE - cargo build -p icu_capi_staticlib --no-default-features --features compiled_data,default_components +crate/target/debug/libcrate.a: FORCE + cd crate && cargo build --features std -icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a: FORCE baked_data/macros.rs +crate/target/x86_64-unknown-linux-gnu/debug/libcrate.a: FORCE baked_data/macros.rs rustup toolchain install ${ICU4X_NIGHTLY_TOOLCHAIN} rustup component add rust-src --toolchain ${ICU4X_NIGHTLY_TOOLCHAIN} - cd icu_capi_staticlib_tiny && \ - RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" ICU4X_DATA_DIR=$(shell pwd)/baked_data cargo +${ICU4X_NIGHTLY_TOOLCHAIN} panic-abort-build --target x86_64-unknown-linux-gnu + cd crate && \ + RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" ICU4X_DATA_DIR=$(shell pwd)/baked_data cargo +${ICU4X_NIGHTLY_TOOLCHAIN} build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu -icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a: FORCE baked_data/macros.rs +crate/target/x86_64-unknown-linux-gnu/release/libcrate.a: FORCE baked_data/macros.rs rustup toolchain install ${ICU4X_NIGHTLY_TOOLCHAIN} rustup component add rust-src --toolchain ${ICU4X_NIGHTLY_TOOLCHAIN} - cd icu_capi_staticlib_tiny && \ - RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" ICU4X_DATA_DIR=$(shell pwd)/baked_data cargo +${ICU4X_NIGHTLY_TOOLCHAIN} panic-abort-build --target x86_64-unknown-linux-gnu --profile=release-opt-size + cd crate && \ + RUSTFLAGS="-Clto -Cembed-bitcode -Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort -Copt-level=s" ICU4X_DATA_DIR=$(shell pwd)/baked_data cargo +${ICU4X_NIGHTLY_TOOLCHAIN} build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu --release # Naive target: no optimizations, full std -optim0.elf: ../../../../../target/debug/libicu_capi_staticlib.a $(ALL_HEADERS) test.c - $(GCC) test.c ../../../../../target/debug/libicu_capi_staticlib.a -ldl -lpthread -lm -g -o optim0.elf +optim0.elf: crate/target/debug/libcrate.a $(ALL_HEADERS) test.c + $(GCC) test.c crate/target/debug/libcrate.a -ldl -lpthread -lm -g -o optim0.elf # optim.elf: gcc with maximum link-time code stripping (gc-sections and strip-all) -optim1.elf: ../../../../../target/debug/libicu_capi_staticlib.a $(ALL_HEADERS) test.c - $(GCC) -fdata-sections -ffunction-sections test.c ../../../../../target/debug/libicu_capi_staticlib.a -ldl -lpthread -lm -g -o optim1.elf -Wl,--gc-sections -Wl,--strip-all +optim1.elf: crate/target/debug/libcrate.a $(ALL_HEADERS) test.c + $(GCC) -fdata-sections -ffunction-sections test.c crate/target/debug/libcrate.a -ldl -lpthread -lm -g -o optim1.elf -Wl,--gc-sections -Wl,--strip-all # optim2.elf: clang single-step with gc-sections -optim2.elf: icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a $(ALL_HEADERS) test.c - $(CLANG) -flto -fdata-sections -ffunction-sections test.c icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a -g -o optim2.elf -Wl,--gc-sections +optim2.elf: crate/target/x86_64-unknown-linux-gnu/debug/libcrate.a $(ALL_HEADERS) test.c + $(CLANG) -flto -fdata-sections -ffunction-sections test.c crate/target/x86_64-unknown-linux-gnu/debug/libcrate.a -g -o optim2.elf -Wl,--gc-sections optim3.o: $(ALL_HEADERS) test.c $(CLANG) -c -flto=thin -fdata-sections -ffunction-sections --target=x86_64-unknown-linux-gnu test.c -g -o optim3.o # optim3.elf: clang two-step with lld, debug mode -optim3.elf: optim3.o icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a - $(CLANG) -flto=thin -fuse-ld=$(LLD) -L . -o optim3.elf optim3.o icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a -Wl,--gc-sections +optim3.elf: optim3.o crate/target/x86_64-unknown-linux-gnu/debug/libcrate.a + $(CLANG) -flto=thin -fuse-ld=$(LLD) -L . -o optim3.elf optim3.o crate/target/x86_64-unknown-linux-gnu/debug/libcrate.a -Wl,--gc-sections optim4.o: $(ALL_HEADERS) test.c $(CLANG) -c -flto=thin -fdata-sections -ffunction-sections --target=x86_64-unknown-linux-gnu test.c -g -o optim4.o # optim4.elf: clang two-step with lld, release mode with debug symbols -optim4.elf: optim4.o icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a - $(CLANG) -flto=thin -fuse-ld=$(LLD) -L . -o optim4.elf optim4.o icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a -Wl,--gc-sections +optim4.elf: optim4.o crate/target/x86_64-unknown-linux-gnu/release/libcrate.a + $(CLANG) -flto=thin -fuse-ld=$(LLD) -L . -o optim4.elf optim4.o crate/target/x86_64-unknown-linux-gnu/release/libcrate.a -Wl,--gc-sections optim5.o: $(ALL_HEADERS) test.c $(CLANG) -c -flto=thin -fdata-sections -ffunction-sections --target=x86_64-unknown-linux-gnu test.c -o optim5.o # optim5.elf: clang two-step with lld, release mode stripped of debug symbols -optim5.elf: optim5.o icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a - $(CLANG) -flto=thin -fuse-ld=$(LLD) -L . -o optim5.elf optim5.o icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a -Wl,--gc-sections -Wl,--strip-all +optim5.elf: optim5.o crate/target/x86_64-unknown-linux-gnu/release/libcrate.a + $(CLANG) -flto=thin -fuse-ld=$(LLD) -L . -o optim5.elf optim5.o crate/target/x86_64-unknown-linux-gnu/release/libcrate.a -Wl,--gc-sections -Wl,--strip-all build: optim0.elf optim1.elf optim2.elf optim3.elf optim4.elf optim5.elf ls -l optim*.elf @@ -81,4 +81,3 @@ test: build clean: git clean -xf * - rm -f ../../../../../target/debug/libicu_capi_staticlib.a diff --git a/ffi/capi/c/examples/fixeddecimal_tiny/icu_capi_staticlib_tiny/Cargo.lock b/ffi/capi/c/examples/fixeddecimal_tiny/crate/Cargo.lock similarity index 96% rename from ffi/capi/c/examples/fixeddecimal_tiny/icu_capi_staticlib_tiny/Cargo.lock rename to ffi/capi/c/examples/fixeddecimal_tiny/crate/Cargo.lock index e8fe305b212..90d4f5718ec 100644 --- a/ffi/capi/c/examples/fixeddecimal_tiny/icu_capi_staticlib_tiny/Cargo.lock +++ b/ffi/capi/c/examples/fixeddecimal_tiny/crate/Cargo.lock @@ -19,11 +19,18 @@ dependencies = [ "libm", ] +[[package]] +name = "crate" +version = "0.0.0" +dependencies = [ + "dlmalloc", + "icu_capi", +] + [[package]] name = "diplomat" version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92bd5669c330d5cafd10588707f6b75a1448f9758cb6fad19f83649fe1e2e9c" +source = "git+https://github.com/rust-diplomat/diplomat?rev=354307d4a519a3f42a9dc744ea0d64d766431d1d#354307d4a519a3f42a9dc744ea0d64d766431d1d" dependencies = [ "diplomat_core", "proc-macro2", @@ -34,14 +41,12 @@ dependencies = [ [[package]] name = "diplomat-runtime" version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c0116d8e7fea6b2554fdb90289782b1e4e5e35d259525e4882a48ce09cbe7a" +source = "git+https://github.com/rust-diplomat/diplomat?rev=354307d4a519a3f42a9dc744ea0d64d766431d1d#354307d4a519a3f42a9dc744ea0d64d766431d1d" [[package]] name = "diplomat_core" version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c5577c28e7ed9d8f984ab7286a734a154307d09c976a3d6cb08d6fcb2f2740" +source = "git+https://github.com/rust-diplomat/diplomat?rev=354307d4a519a3f42a9dc744ea0d64d766431d1d#354307d4a519a3f42a9dc744ea0d64d766431d1d" dependencies = [ "lazy_static", "proc-macro2", @@ -134,14 +139,6 @@ dependencies = [ "writeable", ] -[[package]] -name = "icu_capi_staticlib_tiny" -version = "0.0.0" -dependencies = [ - "dlmalloc", - "icu_capi", -] - [[package]] name = "icu_casemap" version = "1.3.2" diff --git a/ffi/capi/c/examples/fixeddecimal_tiny/icu_capi_staticlib_tiny/Cargo.toml b/ffi/capi/c/examples/fixeddecimal_tiny/crate/Cargo.toml similarity index 77% rename from ffi/capi/c/examples/fixeddecimal_tiny/icu_capi_staticlib_tiny/Cargo.toml rename to ffi/capi/c/examples/fixeddecimal_tiny/crate/Cargo.toml index f6e13b20881..2b4d7336d51 100644 --- a/ffi/capi/c/examples/fixeddecimal_tiny/icu_capi_staticlib_tiny/Cargo.toml +++ b/ffi/capi/c/examples/fixeddecimal_tiny/crate/Cargo.toml @@ -3,7 +3,7 @@ # (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). [package] -name = "icu_capi_staticlib_tiny" +name = "crate" publish = false version = "0.0.0" edition = "2021" @@ -15,11 +15,7 @@ crate-type = ["staticlib"] icu_capi = { path = "../../../..", default-features = false, features = ["compiled_data", "icu_decimal"] } dlmalloc = { version = "0.2", features = ["global"] } -[profile.release] -lto = true +[features] +std = [] -[profile.release-opt-size] -inherits = "release" -opt-level = "s" - -[workspace] \ No newline at end of file +[workspace] diff --git a/ffi/capi/c/examples/fixeddecimal_tiny/icu_capi_staticlib_tiny/src/lib.rs b/ffi/capi/c/examples/fixeddecimal_tiny/crate/src/lib.rs similarity index 80% rename from ffi/capi/c/examples/fixeddecimal_tiny/icu_capi_staticlib_tiny/src/lib.rs rename to ffi/capi/c/examples/fixeddecimal_tiny/crate/src/lib.rs index 79672c07855..c2005e7e600 100644 --- a/ffi/capi/c/examples/fixeddecimal_tiny/icu_capi_staticlib_tiny/src/lib.rs +++ b/ffi/capi/c/examples/fixeddecimal_tiny/crate/src/lib.rs @@ -2,14 +2,16 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -#![no_std] +#![cfg_attr(not(feature = "std"), no_std)] // Expose icu_capi symbols extern crate icu_capi; +#[cfg(not(feature = "std"))] #[global_allocator] static ALLOCATOR: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc; +#[cfg(not(feature = "std"))] #[panic_handler] fn panic(_info: &core::panic::PanicInfo) -> ! { loop {} diff --git a/ffi/capi/c/examples/segmenter_tiny/Makefile b/ffi/capi/c/examples/segmenter_tiny/Makefile index 0974ad78a4c..da0b98a8705 100644 --- a/ffi/capi/c/examples/segmenter_tiny/Makefile +++ b/ffi/capi/c/examples/segmenter_tiny/Makefile @@ -17,53 +17,53 @@ GCC := gcc CLANG := clang-15 LLD := lld-15 -../../../../../target/debug/libicu_capi_staticlib.a: FORCE - cargo build -p icu_capi_staticlib --no-default-features --features compiled_data,default_components +crate/target/debug/libcrate.a: FORCE + cd crate && cargo build --features std -icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a: FORCE +crate/target/x86_64-unknown-linux-gnu/debug/libcrate.a: FORCE rustup toolchain install ${ICU4X_NIGHTLY_TOOLCHAIN} rustup component add rust-src --toolchain ${ICU4X_NIGHTLY_TOOLCHAIN} - cd icu_capi_staticlib_tiny && \ - RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" cargo +${ICU4X_NIGHTLY_TOOLCHAIN} panic-abort-build --target x86_64-unknown-linux-gnu + cd crate && \ + RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" cargo +${ICU4X_NIGHTLY_TOOLCHAIN} build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu -icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a: FORCE +crate/target/x86_64-unknown-linux-gnu/release/libcrate.a: FORCE rustup toolchain install ${ICU4X_NIGHTLY_TOOLCHAIN} rustup component add rust-src --toolchain ${ICU4X_NIGHTLY_TOOLCHAIN} - cd icu_capi_staticlib_tiny && \ - RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" cargo +${ICU4X_NIGHTLY_TOOLCHAIN} panic-abort-build --target x86_64-unknown-linux-gnu --profile=release-opt-size + cd crate && \ + RUSTFLAGS="-Clto -Cembed-bitcode -Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort -Copt-level=s" cargo +${ICU4X_NIGHTLY_TOOLCHAIN} build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu --release # Naive target: no optimizations, full std -optim0.elf: ../../../../../target/debug/libicu_capi_staticlib.a $(ALL_HEADERS) test.c - $(GCC) test.c ../../../../../target/debug/libicu_capi_staticlib.a -ldl -lpthread -lm -g -o optim0.elf +optim0.elf: crate/target/debug/libcrate.a $(ALL_HEADERS) test.c + $(GCC) test.c crate/target/debug/libcrate.a -ldl -lpthread -lm -g -o optim0.elf # optim.elf: gcc with maximum link-time code stripping (gc-sections and strip-all) -optim1.elf: ../../../../../target/debug/libicu_capi_staticlib.a $(ALL_HEADERS) test.c - $(GCC) -fdata-sections -ffunction-sections test.c ../../../../../target/debug/libicu_capi_staticlib.a -ldl -lpthread -lm -g -o optim1.elf -Wl,--gc-sections -Wl,--strip-all +optim1.elf: crate/target/debug/libcrate.a $(ALL_HEADERS) test.c + $(GCC) -fdata-sections -ffunction-sections test.c crate/target/debug/libcrate.a -ldl -lpthread -lm -g -o optim1.elf -Wl,--gc-sections -Wl,--strip-all # optim2.elf: clang single-step with gc-sections -optim2.elf: icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a $(ALL_HEADERS) test.c - $(CLANG) -flto -fdata-sections -ffunction-sections test.c icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a -g -o optim2.elf -Wl,--gc-sections +optim2.elf: crate/target/x86_64-unknown-linux-gnu/debug/libcrate.a $(ALL_HEADERS) test.c + $(CLANG) -flto -fdata-sections -ffunction-sections test.c crate/target/x86_64-unknown-linux-gnu/debug/libcrate.a -g -o optim2.elf -Wl,--gc-sections optim3.o: $(ALL_HEADERS) test.c $(CLANG) -c -flto=thin -fdata-sections -ffunction-sections --target=x86_64-unknown-linux-gnu test.c -g -o optim3.o # optim3.elf: clang two-step with lld, debug mode -optim3.elf: optim3.o icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a - $(CLANG) -flto=thin -fuse-ld=$(LLD) -L . -o optim3.elf optim3.o icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a -Wl,--gc-sections +optim3.elf: optim3.o crate/target/x86_64-unknown-linux-gnu/debug/libcrate.a + $(CLANG) -flto=thin -fuse-ld=$(LLD) -L . -o optim3.elf optim3.o crate/target/x86_64-unknown-linux-gnu/debug/libcrate.a -Wl,--gc-sections optim4.o: $(ALL_HEADERS) test.c $(CLANG) -c -flto=thin -fdata-sections -ffunction-sections --target=x86_64-unknown-linux-gnu test.c -g -o optim4.o # optim4.elf: clang two-step with lld, release mode with debug symbols -optim4.elf: optim4.o icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a - $(CLANG) -flto=thin -fuse-ld=$(LLD) -L . -o optim4.elf optim4.o icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a -Wl,--gc-sections +optim4.elf: optim4.o crate/target/x86_64-unknown-linux-gnu/release/libcrate.a + $(CLANG) -flto=thin -fuse-ld=$(LLD) -L . -o optim4.elf optim4.o crate/target/x86_64-unknown-linux-gnu/release/libcrate.a -Wl,--gc-sections optim5.o: $(ALL_HEADERS) test.c $(CLANG) -c -flto=thin -fdata-sections -ffunction-sections --target=x86_64-unknown-linux-gnu test.c -o optim5.o # optim5.elf: clang two-step with lld, release mode stripped of debug symbols -optim5.elf: optim5.o icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a - $(CLANG) -flto=thin -fuse-ld=$(LLD) -L . -o optim5.elf optim5.o icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a -Wl,--gc-sections -Wl,--strip-all +optim5.elf: optim5.o crate/target/x86_64-unknown-linux-gnu/release/libcrate.a + $(CLANG) -flto=thin -fuse-ld=$(LLD) -L . -o optim5.elf optim5.o crate/target/x86_64-unknown-linux-gnu/release/libcrate.a -Wl,--gc-sections -Wl,--strip-all build: optim0.elf optim1.elf optim2.elf optim3.elf optim4.elf optim5.elf ls -l optim*.elf @@ -78,4 +78,3 @@ test: build clean: git clean -xf * - rm -f ../../../../../target/debug/libicu_capi_staticlib.a diff --git a/ffi/capi/c/examples/segmenter_tiny/icu_capi_staticlib_tiny/Cargo.lock b/ffi/capi/c/examples/segmenter_tiny/crate/Cargo.lock similarity index 96% rename from ffi/capi/c/examples/segmenter_tiny/icu_capi_staticlib_tiny/Cargo.lock rename to ffi/capi/c/examples/segmenter_tiny/crate/Cargo.lock index fb3ca79821b..8e2351d3165 100644 --- a/ffi/capi/c/examples/segmenter_tiny/icu_capi_staticlib_tiny/Cargo.lock +++ b/ffi/capi/c/examples/segmenter_tiny/crate/Cargo.lock @@ -19,11 +19,18 @@ dependencies = [ "libm", ] +[[package]] +name = "crate" +version = "0.0.0" +dependencies = [ + "dlmalloc", + "icu_capi", +] + [[package]] name = "diplomat" version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92bd5669c330d5cafd10588707f6b75a1448f9758cb6fad19f83649fe1e2e9c" +source = "git+https://github.com/rust-diplomat/diplomat?rev=354307d4a519a3f42a9dc744ea0d64d766431d1d#354307d4a519a3f42a9dc744ea0d64d766431d1d" dependencies = [ "diplomat_core", "proc-macro2", @@ -34,14 +41,12 @@ dependencies = [ [[package]] name = "diplomat-runtime" version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c0116d8e7fea6b2554fdb90289782b1e4e5e35d259525e4882a48ce09cbe7a" +source = "git+https://github.com/rust-diplomat/diplomat?rev=354307d4a519a3f42a9dc744ea0d64d766431d1d#354307d4a519a3f42a9dc744ea0d64d766431d1d" [[package]] name = "diplomat_core" version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c5577c28e7ed9d8f984ab7286a734a154307d09c976a3d6cb08d6fcb2f2740" +source = "git+https://github.com/rust-diplomat/diplomat?rev=354307d4a519a3f42a9dc744ea0d64d766431d1d#354307d4a519a3f42a9dc744ea0d64d766431d1d" dependencies = [ "lazy_static", "proc-macro2", @@ -132,14 +137,6 @@ dependencies = [ "writeable", ] -[[package]] -name = "icu_capi_staticlib_tiny" -version = "0.0.0" -dependencies = [ - "dlmalloc", - "icu_capi", -] - [[package]] name = "icu_casemap" version = "1.3.2" diff --git a/ffi/capi/c/examples/segmenter_tiny/icu_capi_staticlib_tiny/Cargo.toml b/ffi/capi/c/examples/segmenter_tiny/crate/Cargo.toml similarity index 77% rename from ffi/capi/c/examples/segmenter_tiny/icu_capi_staticlib_tiny/Cargo.toml rename to ffi/capi/c/examples/segmenter_tiny/crate/Cargo.toml index cc4727558cf..aa645846fef 100644 --- a/ffi/capi/c/examples/segmenter_tiny/icu_capi_staticlib_tiny/Cargo.toml +++ b/ffi/capi/c/examples/segmenter_tiny/crate/Cargo.toml @@ -3,7 +3,7 @@ # (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). [package] -name = "icu_capi_staticlib_tiny" +name = "crate" publish = false version = "0.0.0" edition = "2021" @@ -15,11 +15,7 @@ crate-type = ["staticlib"] icu_capi = { path = "../../../..", default-features = false, features = ["compiled_data", "icu_segmenter"] } dlmalloc = { version = "0.2", features = ["global"] } -[profile.release] -lto = true +[features] +std = [] -[profile.release-opt-size] -inherits = "release" -opt-level = "s" - -[workspace] \ No newline at end of file +[workspace] diff --git a/ffi/capi/c/examples/segmenter_tiny/icu_capi_staticlib_tiny/src/lib.rs b/ffi/capi/c/examples/segmenter_tiny/crate/src/lib.rs similarity index 80% rename from ffi/capi/c/examples/segmenter_tiny/icu_capi_staticlib_tiny/src/lib.rs rename to ffi/capi/c/examples/segmenter_tiny/crate/src/lib.rs index 79672c07855..c2005e7e600 100644 --- a/ffi/capi/c/examples/segmenter_tiny/icu_capi_staticlib_tiny/src/lib.rs +++ b/ffi/capi/c/examples/segmenter_tiny/crate/src/lib.rs @@ -2,14 +2,16 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -#![no_std] +#![cfg_attr(not(feature = "std"), no_std)] // Expose icu_capi symbols extern crate icu_capi; +#[cfg(not(feature = "std"))] #[global_allocator] static ALLOCATOR: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc; +#[cfg(not(feature = "std"))] #[panic_handler] fn panic(_info: &core::panic::PanicInfo) -> ! { loop {} diff --git a/ffi/capi/cpp/examples/fixeddecimal_wasm/Makefile b/ffi/capi/cpp/examples/fixeddecimal_wasm/Makefile index b354889c746..b2c0a018cfa 100644 --- a/ffi/capi/cpp/examples/fixeddecimal_wasm/Makefile +++ b/ffi/capi/cpp/examples/fixeddecimal_wasm/Makefile @@ -14,22 +14,23 @@ EMCC?=emcc $(ALL_HEADERS): -../../../../../target/debug/libicu_capi_staticlib.a: FORCE - cargo build -p icu_capi_staticlib +crate/target/debug/libcrate.a: FORCE + cd crate && cargo build -a.out: ../../../../../target/debug/libicu_capi_staticlib.a $(ALL_HEADERS) test.cpp - $(CXX) -std=c++17 test.cpp ../../../../../target/debug/libicu_capi_staticlib.a -ldl -lpthread -lm -g +a.out: crate/target/debug/libcrate.a $(ALL_HEADERS) test.cpp + $(CXX) -std=c++17 test.cpp crate/target/debug/libcrate.a -ldl -lpthread -lm -g -../../../../../target/wasm32-unknown-emscripten/release-opt-size/libicu_capi_staticlib.a: FORCE +crate/target/wasm32-unknown-emscripten/release/libcrate.a: FORCE rustup toolchain install ${ICU4X_NIGHTLY_TOOLCHAIN} rustup component add rust-src --toolchain ${ICU4X_NIGHTLY_TOOLCHAIN} - RUSTFLAGS="-Cpanic=abort" cargo +${ICU4X_NIGHTLY_TOOLCHAIN} build --profile=release-opt-size -p icu_capi_staticlib --target wasm32-unknown-emscripten -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort + RUSTFLAGS="-Cpanic=abort -Copt-level=s -Clto -Cembed-bitcode" \ + cd crate && cargo +${ICU4X_NIGHTLY_TOOLCHAIN} build --release --target wasm32-unknown-emscripten -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort -web-version.html: ../../../../../target/wasm32-unknown-emscripten/release-opt-size/libicu_capi_staticlib.a $(ALL_HEADERS) test.cpp - $(EMCC) -std=c++17 test.cpp ../../../../../target/wasm32-unknown-emscripten/release-opt-size/libicu_capi_staticlib.a -ldl -lpthread -lm -g -o web-version.html --bind --emrun -sENVIRONMENT=web -sWASM=1 -sEXPORT_ES6=1 -sMODULARIZE=1 +web-version.html: crate/target/wasm32-unknown-emscripten/release/libcrate.a $(ALL_HEADERS) test.cpp + $(EMCC) -std=c++17 test.cpp crate/target/wasm32-unknown-emscripten/release/libcrate.a -ldl -lpthread -lm -g -o web-version.html --bind --emrun -sENVIRONMENT=web -sWASM=1 -sEXPORT_ES6=1 -sMODULARIZE=1 -node-version.js: ../../../../../target/wasm32-unknown-emscripten/release-opt-size/libicu_capi_staticlib.a $(ALL_HEADERS) test.cpp - $(EMCC) -std=c++17 test.cpp ../../../../../target/wasm32-unknown-emscripten/release-opt-size/libicu_capi_staticlib.a -ldl -lpthread -lm -g -o node-version.js --bind -sWASM=1 -sENVIRONMENT=node -sWASM_ASYNC_COMPILATION=0 -DNOMAIN +node-version.js: crate/target/wasm32-unknown-emscripten/release/libcrate.a $(ALL_HEADERS) test.cpp + $(EMCC) -std=c++17 test.cpp crate/target/wasm32-unknown-emscripten/release/libcrate.a -ldl -lpthread -lm -g -o node-version.js --bind -sWASM=1 -sENVIRONMENT=node -sWASM_ASYNC_COMPILATION=0 -DNOMAIN build: web-version.html node-version.js @@ -48,5 +49,5 @@ test-host: build-host clean: git clean -xf * - rm -f ../../../../../target/wasm32-unknown-emscripten/release-opt-size/libicu_capi_staticlib.a - rm -f ../../../../../target/debug/libicu_capi_staticlib.a + rm -f crate/target/wasm32-unknown-emscripten/release/libcrate.a + rm -f crate/target/debug/libcrate.a diff --git a/ffi/capi/cpp/examples/fixeddecimal_wasm/crate/Cargo.lock b/ffi/capi/cpp/examples/fixeddecimal_wasm/crate/Cargo.lock new file mode 100644 index 00000000000..8a3eaf397bb --- /dev/null +++ b/ffi/capi/cpp/examples/fixeddecimal_wasm/crate/Cargo.lock @@ -0,0 +1,924 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "calendrical_calculations" +version = "0.1.0" +dependencies = [ + "core_maths", + "displaydoc", +] + +[[package]] +name = "colored" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +dependencies = [ + "is-terminal", + "lazy_static", + "windows-sys 0.48.0", +] + +[[package]] +name = "core_maths" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b02505ccb8c50b0aa21ace0fc08c3e53adebd4e58caa18a36152803c7709a3" +dependencies = [ + "libm", +] + +[[package]] +name = "crate" +version = "0.0.0" +dependencies = [ + "icu_capi", +] + +[[package]] +name = "deranged" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "diplomat" +version = "0.6.0" +source = "git+https://github.com/rust-diplomat/diplomat?rev=354307d4a519a3f42a9dc744ea0d64d766431d1d#354307d4a519a3f42a9dc744ea0d64d766431d1d" +dependencies = [ + "diplomat_core", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "diplomat-runtime" +version = "0.6.0" +source = "git+https://github.com/rust-diplomat/diplomat?rev=354307d4a519a3f42a9dc744ea0d64d766431d1d#354307d4a519a3f42a9dc744ea0d64d766431d1d" +dependencies = [ + "log", +] + +[[package]] +name = "diplomat_core" +version = "0.6.0" +source = "git+https://github.com/rust-diplomat/diplomat?rev=354307d4a519a3f42a9dc744ea0d64d766431d1d#354307d4a519a3f42a9dc744ea0d64d766431d1d" +dependencies = [ + "lazy_static", + "proc-macro2", + "quote", + "serde", + "smallvec", + "strck_ident", + "syn", +] + +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "errno" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "fixed_decimal" +version = "0.5.4" +dependencies = [ + "displaydoc", + "ryu", + "smallvec", + "writeable", +] + +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "icu_calendar" +version = "1.3.2" +dependencies = [ + "calendrical_calculations", + "displaydoc", + "icu_calendar_data", + "icu_locid", + "icu_locid_transform", + "icu_provider", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_calendar_data" +version = "1.3.2" + +[[package]] +name = "icu_capi" +version = "1.3.2" +dependencies = [ + "diplomat", + "diplomat-runtime", + "fixed_decimal", + "icu_calendar", + "icu_casemap", + "icu_collator", + "icu_collections", + "icu_datetime", + "icu_decimal", + "icu_displaynames", + "icu_list", + "icu_locid", + "icu_locid_transform", + "icu_normalizer", + "icu_plurals", + "icu_properties", + "icu_provider", + "icu_provider_adapters", + "icu_segmenter", + "icu_timezone", + "log", + "simple_logger", + "tinystr", + "unicode-bidi", + "writeable", +] + +[[package]] +name = "icu_casemap" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_casemap_data", + "icu_collections", + "icu_locid", + "icu_properties", + "icu_provider", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_casemap_data" +version = "1.3.2" + +[[package]] +name = "icu_collator" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_collator_data", + "icu_collections", + "icu_locid", + "icu_locid_transform", + "icu_normalizer", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_collator_data" +version = "1.3.2" + +[[package]] +name = "icu_collections" +version = "1.3.2" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_datetime" +version = "1.3.2" +dependencies = [ + "displaydoc", + "either", + "fixed_decimal", + "icu_calendar", + "icu_datetime_data", + "icu_decimal", + "icu_locid", + "icu_locid_transform", + "icu_plurals", + "icu_provider", + "icu_timezone", + "smallvec", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_datetime_data" +version = "1.3.2" + +[[package]] +name = "icu_decimal" +version = "1.3.2" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_decimal_data", + "icu_locid", + "icu_locid_transform", + "icu_provider", + "writeable", +] + +[[package]] +name = "icu_decimal_data" +version = "1.3.2" + +[[package]] +name = "icu_displaynames" +version = "0.11.1" +dependencies = [ + "icu_displaynames_data", + "icu_locid", + "icu_locid_transform", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_displaynames_data" +version = "1.3.2" + +[[package]] +name = "icu_list" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_list_data", + "icu_locid_transform", + "icu_provider", + "regex-automata", + "writeable", +] + +[[package]] +name = "icu_list_data" +version = "1.3.2" + +[[package]] +name = "icu_locid" +version = "1.3.2" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.3.2" + +[[package]] +name = "icu_normalizer" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.3.2" + +[[package]] +name = "icu_plurals" +version = "1.3.2" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_locid", + "icu_locid_transform", + "icu_plurals_data", + "icu_provider", + "zerovec", +] + +[[package]] +name = "icu_plurals_data" +version = "1.3.2" + +[[package]] +name = "icu_properties" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "unicode-bidi", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.3.2" + +[[package]] +name = "icu_provider" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "log", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_adapters" +version = "1.3.2" +dependencies = [ + "icu_locid", + "icu_locid_transform", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.3.2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "icu_segmenter" +version = "1.3.2" +dependencies = [ + "core_maths", + "displaydoc", + "icu_collections", + "icu_locid", + "icu_provider", + "icu_segmenter_data", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_segmenter_data" +version = "1.3.2" + +[[package]] +name = "icu_timezone" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_calendar", + "icu_locid", + "icu_provider", + "icu_timezone_data", + "tinystr", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_timezone_data" +version = "1.3.2" + +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "linux-raw-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" + +[[package]] +name = "litemap" +version = "0.7.1" + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "num_threads" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +dependencies = [ + "libc", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex-automata" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9368763f5a9b804326f3af749e16f9abf378d227bcdee7634b13d8f17793782" +dependencies = [ + "memchr", +] + +[[package]] +name = "rustix" +version = "0.38.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "serde" +version = "1.0.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "simple_logger" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2230cd5c29b815c9b699fb610b49a5ed65588f3509d9f0108be3a885da629333" +dependencies = [ + "colored", + "log", + "time", + "windows-sys 0.42.0", +] + +[[package]] +name = "smallvec" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strck" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be91090ded9d8f979d9fe921777342d37e769e0b6b7296843a7a38247240e917" + +[[package]] +name = "strck_ident" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1c3802b169b3858a44667f221c9a0b3136e6019936ea926fc97fbad8af77202" +dependencies = [ + "strck", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "time" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +dependencies = [ + "deranged", + "itoa", + "libc", + "num_threads", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +dependencies = [ + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.7.4" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "utf16_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52df8b7fb78e7910d776fccf2e42ceaf3604d55e8e7eb2dbd183cb1441d8a692" + +[[package]] +name = "utf8_iter" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a8922555b9500e3d865caed19330172cd67cbf82203f1a3311d8c305cc9f33" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.3" + +[[package]] +name = "yoke" +version = "0.7.2" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.2" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.3" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.3" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.1.1" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.10.0" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/ffi/capi/cpp/examples/fixeddecimal_wasm/crate/Cargo.toml b/ffi/capi/cpp/examples/fixeddecimal_wasm/crate/Cargo.toml new file mode 100644 index 00000000000..45341487a0c --- /dev/null +++ b/ffi/capi/cpp/examples/fixeddecimal_wasm/crate/Cargo.toml @@ -0,0 +1,16 @@ +# This file is part of ICU4X. For terms of use, please see the file +# called LICENSE at the top level of the ICU4X source tree +# (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +[package] +name = "crate" +version = "0.0.0" +publish = false + +[lib] +crate-type = ["staticlib"] + +[dependencies] +icu_capi = { path = "../../../.." } + +[workspace] \ No newline at end of file diff --git a/ffi/capi/cpp/examples/fixeddecimal_wasm/crate/LICENSE b/ffi/capi/cpp/examples/fixeddecimal_wasm/crate/LICENSE new file mode 100644 index 00000000000..9845aa5f488 --- /dev/null +++ b/ffi/capi/cpp/examples/fixeddecimal_wasm/crate/LICENSE @@ -0,0 +1,44 @@ +UNICODE LICENSE V3 + +COPYRIGHT AND PERMISSION NOTICE + +Copyright © 2020-2023 Unicode, Inc. + +NOTICE TO USER: Carefully read the following legal agreement. BY +DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR +SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT +DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of data files and any associated documentation (the "Data Files") or +software and any associated documentation (the "Software") to deal in the +Data Files or Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, and/or sell +copies of the Data Files or Software, and to permit persons to whom the +Data Files or Software are furnished to do so, provided that either (a) +this copyright and permission notice appear with all copies of the Data +Files or Software, or (b) this copyright and permission notice appear in +associated Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +THIRD PARTY RIGHTS. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE +BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA +FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall +not be used in advertising or otherwise to promote the sale, use or other +dealings in these Data Files or Software without prior written +authorization of the copyright holder. + +— + +Portions of ICU4X may have been adapted from ICU4C and/or ICU4J. +ICU 1.8.1 to ICU 57.1 © 1995-2016 International Business Machines Corporation and others. diff --git a/ffi/capi/cpp/examples/fixeddecimal_wasm/crate/src/lib.rs b/ffi/capi/cpp/examples/fixeddecimal_wasm/crate/src/lib.rs new file mode 100644 index 00000000000..235b9b59807 --- /dev/null +++ b/ffi/capi/cpp/examples/fixeddecimal_wasm/crate/src/lib.rs @@ -0,0 +1,6 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +// Necessary for symbols to be linked in +extern crate icu_capi; diff --git a/ffi/capi/js/examples/node/.gitignore b/ffi/capi/js/examples/node/.gitignore index 1d3eed9661b..82a8e5417cf 100644 --- a/ffi/capi/js/examples/node/.gitignore +++ b/ffi/capi/js/examples/node/.gitignore @@ -1,3 +1,2 @@ lib -icu_capi.wasm data.postcard diff --git a/ffi/capi/js/examples/node/Makefile b/ffi/capi/js/examples/node/Makefile index f70814aca61..e10cc15630c 100644 --- a/ffi/capi/js/examples/node/Makefile +++ b/ffi/capi/js/examples/node/Makefile @@ -12,7 +12,6 @@ $(ALL_HEADERS): # 100 KiB, working around a bug in older rustc # https://github.com/unicode-org/icu4x/issues/2753 -# keep in sync with .cargo/config.toml WASM_STACK_SIZE := 100000 lib: $(ALL_HEADERS) @@ -20,21 +19,16 @@ lib: $(ALL_HEADERS) mkdir lib; cp ../../include/* lib/ -../../../../../target/wasm32-unknown-unknown/release/icu_capi_cdylib.wasm: FORCE +crate/target/wasm32-unknown-unknown/release/crate.wasm: FORCE rustup toolchain install ${ICU4X_NIGHTLY_TOOLCHAIN} rustup component add rust-src --toolchain ${ICU4X_NIGHTLY_TOOLCHAIN} - RUSTFLAGS="-Cpanic=abort -Copt-level=s -C link-args=-zstack-size=${WASM_STACK_SIZE}" \ - cargo +${ICU4X_NIGHTLY_TOOLCHAIN} build \ + RUSTFLAGS="-Cpanic=abort -Copt-level=s -C link-args=-zstack-size=${WASM_STACK_SIZE} -Clto -Cembed-bitcode" \ + cd crate && cargo +${ICU4X_NIGHTLY_TOOLCHAIN} build \ -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort \ --target wasm32-unknown-unknown \ - --release \ - --package icu_capi_cdylib + --release -icu_capi.wasm: ../../../../../target/wasm32-unknown-unknown/release/icu_capi_cdylib.wasm - cp ../../../../../target/wasm32-unknown-unknown/release/icu_capi_cdylib.wasm icu_capi.wasm - -build: icu_capi.wasm lib +build: crate/target/wasm32-unknown-unknown/release/crate.wasm lib clean: git clean -xf * - rm -f ../../../../../target/wasm32-unknown-unknown/release/icu_capi_cdylib.wasm diff --git a/ffi/capi/js/examples/node/crate/Cargo.lock b/ffi/capi/js/examples/node/crate/Cargo.lock new file mode 100644 index 00000000000..34e567509ec --- /dev/null +++ b/ffi/capi/js/examples/node/crate/Cargo.lock @@ -0,0 +1,924 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "calendrical_calculations" +version = "0.1.0" +dependencies = [ + "core_maths", + "displaydoc", +] + +[[package]] +name = "colored" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +dependencies = [ + "is-terminal", + "lazy_static", + "windows-sys 0.48.0", +] + +[[package]] +name = "core_maths" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b02505ccb8c50b0aa21ace0fc08c3e53adebd4e58caa18a36152803c7709a3" +dependencies = [ + "libm", +] + +[[package]] +name = "deranged" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "diplomat" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92bd5669c330d5cafd10588707f6b75a1448f9758cb6fad19f83649fe1e2e9c" +dependencies = [ + "diplomat_core", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "diplomat-runtime" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c0116d8e7fea6b2554fdb90289782b1e4e5e35d259525e4882a48ce09cbe7a" + +[[package]] +name = "diplomat_core" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c5577c28e7ed9d8f984ab7286a734a154307d09c976a3d6cb08d6fcb2f2740" +dependencies = [ + "lazy_static", + "proc-macro2", + "quote", + "serde", + "smallvec", + "strck_ident", + "syn", +] + +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "errno" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "fixed_decimal" +version = "0.5.4" +dependencies = [ + "displaydoc", + "ryu", + "smallvec", + "writeable", +] + +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "icu_calendar" +version = "1.3.2" +dependencies = [ + "calendrical_calculations", + "displaydoc", + "icu_calendar_data", + "icu_locid", + "icu_locid_transform", + "icu_provider", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_calendar_data" +version = "1.3.2" + +[[package]] +name = "icu_capi" +version = "1.3.2" +dependencies = [ + "diplomat", + "diplomat-runtime", + "fixed_decimal", + "icu_calendar", + "icu_casemap", + "icu_collator", + "icu_collections", + "icu_datetime", + "icu_decimal", + "icu_displaynames", + "icu_list", + "icu_locid", + "icu_locid_transform", + "icu_normalizer", + "icu_plurals", + "icu_properties", + "icu_provider", + "icu_provider_adapters", + "icu_segmenter", + "icu_timezone", + "log", + "simple_logger", + "tinystr", + "unicode-bidi", + "writeable", +] + +[[package]] +name = "icu_capi_cdylib" +version = "0.0.0" +dependencies = [ + "icu_capi", +] + +[[package]] +name = "icu_casemap" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_casemap_data", + "icu_collections", + "icu_locid", + "icu_properties", + "icu_provider", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_casemap_data" +version = "1.3.2" + +[[package]] +name = "icu_collator" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_collator_data", + "icu_collections", + "icu_locid", + "icu_locid_transform", + "icu_normalizer", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_collator_data" +version = "1.3.2" + +[[package]] +name = "icu_collections" +version = "1.3.2" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_datetime" +version = "1.3.2" +dependencies = [ + "displaydoc", + "either", + "fixed_decimal", + "icu_calendar", + "icu_datetime_data", + "icu_decimal", + "icu_locid", + "icu_locid_transform", + "icu_plurals", + "icu_provider", + "icu_timezone", + "smallvec", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_datetime_data" +version = "1.3.2" + +[[package]] +name = "icu_decimal" +version = "1.3.2" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_decimal_data", + "icu_locid", + "icu_locid_transform", + "icu_provider", + "writeable", +] + +[[package]] +name = "icu_decimal_data" +version = "1.3.2" + +[[package]] +name = "icu_displaynames" +version = "0.11.1" +dependencies = [ + "icu_displaynames_data", + "icu_locid", + "icu_locid_transform", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_displaynames_data" +version = "1.3.2" + +[[package]] +name = "icu_list" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_list_data", + "icu_locid_transform", + "icu_provider", + "regex-automata", + "writeable", +] + +[[package]] +name = "icu_list_data" +version = "1.3.2" + +[[package]] +name = "icu_locid" +version = "1.3.2" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.3.2" + +[[package]] +name = "icu_normalizer" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.3.2" + +[[package]] +name = "icu_plurals" +version = "1.3.2" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_locid", + "icu_locid_transform", + "icu_plurals_data", + "icu_provider", + "zerovec", +] + +[[package]] +name = "icu_plurals_data" +version = "1.3.2" + +[[package]] +name = "icu_properties" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "unicode-bidi", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.3.2" + +[[package]] +name = "icu_provider" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "log", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_adapters" +version = "1.3.2" +dependencies = [ + "icu_locid", + "icu_locid_transform", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.3.2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "icu_segmenter" +version = "1.3.2" +dependencies = [ + "core_maths", + "displaydoc", + "icu_collections", + "icu_locid", + "icu_provider", + "icu_segmenter_data", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_segmenter_data" +version = "1.3.2" + +[[package]] +name = "icu_timezone" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_calendar", + "icu_locid", + "icu_provider", + "icu_timezone_data", + "tinystr", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_timezone_data" +version = "1.3.2" + +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "linux-raw-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" + +[[package]] +name = "litemap" +version = "0.7.1" + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "num_threads" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +dependencies = [ + "libc", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex-automata" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9368763f5a9b804326f3af749e16f9abf378d227bcdee7634b13d8f17793782" +dependencies = [ + "memchr", +] + +[[package]] +name = "rustix" +version = "0.38.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "serde" +version = "1.0.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "simple_logger" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2230cd5c29b815c9b699fb610b49a5ed65588f3509d9f0108be3a885da629333" +dependencies = [ + "colored", + "log", + "time", + "windows-sys 0.42.0", +] + +[[package]] +name = "smallvec" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strck" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be91090ded9d8f979d9fe921777342d37e769e0b6b7296843a7a38247240e917" + +[[package]] +name = "strck_ident" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1c3802b169b3858a44667f221c9a0b3136e6019936ea926fc97fbad8af77202" +dependencies = [ + "strck", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "time" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +dependencies = [ + "deranged", + "itoa", + "libc", + "num_threads", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +dependencies = [ + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.7.4" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "utf16_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52df8b7fb78e7910d776fccf2e42ceaf3604d55e8e7eb2dbd183cb1441d8a692" + +[[package]] +name = "utf8_iter" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a8922555b9500e3d865caed19330172cd67cbf82203f1a3311d8c305cc9f33" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.3" + +[[package]] +name = "yoke" +version = "0.7.2" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.2" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.3" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.3" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.1.1" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.10.0" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/ffi/capi/js/examples/node/crate/Cargo.toml b/ffi/capi/js/examples/node/crate/Cargo.toml new file mode 100644 index 00000000000..879ede4a5ae --- /dev/null +++ b/ffi/capi/js/examples/node/crate/Cargo.toml @@ -0,0 +1,16 @@ +# This file is part of ICU4X. For terms of use, please see the file +# called LICENSE at the top level of the ICU4X source tree +# (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +[package] +name = "crate" +version = "0.0.0" +publish = false + +[lib] +crate-type = ["cdylib"] + +[dependencies] +icu_capi = { path = "../../../.." } + +[workspace] \ No newline at end of file diff --git a/ffi/capi/js/examples/node/crate/LICENSE b/ffi/capi/js/examples/node/crate/LICENSE new file mode 100644 index 00000000000..9845aa5f488 --- /dev/null +++ b/ffi/capi/js/examples/node/crate/LICENSE @@ -0,0 +1,44 @@ +UNICODE LICENSE V3 + +COPYRIGHT AND PERMISSION NOTICE + +Copyright © 2020-2023 Unicode, Inc. + +NOTICE TO USER: Carefully read the following legal agreement. BY +DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR +SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT +DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of data files and any associated documentation (the "Data Files") or +software and any associated documentation (the "Software") to deal in the +Data Files or Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, and/or sell +copies of the Data Files or Software, and to permit persons to whom the +Data Files or Software are furnished to do so, provided that either (a) +this copyright and permission notice appear with all copies of the Data +Files or Software, or (b) this copyright and permission notice appear in +associated Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +THIRD PARTY RIGHTS. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE +BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA +FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall +not be used in advertising or otherwise to promote the sale, use or other +dealings in these Data Files or Software without prior written +authorization of the copyright holder. + +— + +Portions of ICU4X may have been adapted from ICU4C and/or ICU4J. +ICU 1.8.1 to ICU 57.1 © 1995-2016 International Business Machines Corporation and others. diff --git a/ffi/capi/js/examples/node/crate/src/lib.rs b/ffi/capi/js/examples/node/crate/src/lib.rs new file mode 100644 index 00000000000..235b9b59807 --- /dev/null +++ b/ffi/capi/js/examples/node/crate/src/lib.rs @@ -0,0 +1,6 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +// Necessary for symbols to be linked in +extern crate icu_capi; diff --git a/ffi/capi/js/examples/node/diplomat.config.js b/ffi/capi/js/examples/node/diplomat.config.js index 9babc8a8e2d..5b3842cd697 100644 --- a/ffi/capi/js/examples/node/diplomat.config.js +++ b/ffi/capi/js/examples/node/diplomat.config.js @@ -3,5 +3,5 @@ // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). export default { - wasm_path: new URL('./icu_capi.wasm', import.meta.url), + wasm_path: new URL('crate/target/wasm32-unknown-unknown/release/crate.wasm', import.meta.url), }; diff --git a/ffi/capi/js/examples/tinywasm/.gitignore b/ffi/capi/js/examples/tinywasm/.gitignore index d8fa72e28bf..a65b41774ad 100644 --- a/ffi/capi/js/examples/tinywasm/.gitignore +++ b/ffi/capi/js/examples/tinywasm/.gitignore @@ -1,2 +1 @@ lib -icu_capi.wasm diff --git a/ffi/capi/js/examples/tinywasm/Makefile b/ffi/capi/js/examples/tinywasm/Makefile index c5bb5413baf..bcfaabb9233 100755 --- a/ffi/capi/js/examples/tinywasm/Makefile +++ b/ffi/capi/js/examples/tinywasm/Makefile @@ -12,7 +12,6 @@ $(ALL_HEADERS): # 100 KiB, working around a bug in older rustc # https://github.com/unicode-org/icu4x/issues/2753 -# keep in sync with .cargo/config.toml WASM_STACK_SIZE := 100000 BASEDIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST)))) @@ -22,22 +21,17 @@ lib: $(ALL_HEADERS) mkdir lib; cp ../../include/* lib -target/wasm32-unknown-unknown/release/icu_capi_cdylib.wasm: FORCE +crate/target/wasm32-unknown-unknown/release/crate.wasm: FORCE rustup toolchain install ${ICU4X_NIGHTLY_TOOLCHAIN} rustup component add rust-src --toolchain ${ICU4X_NIGHTLY_TOOLCHAIN} # Build the WASM library - RUSTFLAGS="-Cpanic=abort -Copt-level=s -C link-arg=-zstack-size=${WASM_STACK_SIZE} -Clinker-plugin-lto -Ccodegen-units=1 -C linker=${BASEDIR}/ld.py -C linker-flavor=wasm-ld" \ - CARGO_TARGET_DIR="target" `# Special linker flags shouldn't overwrite the top-level target directory` \ - cargo +${ICU4X_NIGHTLY_TOOLCHAIN} build \ + RUSTFLAGS="-Cpanic=abort -Copt-level=s -C link-arg=-zstack-size=${WASM_STACK_SIZE} -Clinker-plugin-lto -Ccodegen-units=1 -C linker=${BASEDIR}/ld.py -C linker-flavor=wasm-ld -Clto -Cembed-bitcode" \ + cd crate && cargo +${ICU4X_NIGHTLY_TOOLCHAIN} build \ -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort \ --target wasm32-unknown-unknown \ - --release \ - --package icu_capi_cdylib + --release -icu_capi.wasm: target/wasm32-unknown-unknown/release/icu_capi_cdylib.wasm - cp target/wasm32-unknown-unknown/release/icu_capi_cdylib.wasm icu_capi.wasm - -build: icu_capi.wasm lib +build: crate/target/wasm32-unknown-unknown/release/crate.wasm lib ls -l test: diff --git a/ffi/capi/js/examples/tinywasm/crate/Cargo.lock b/ffi/capi/js/examples/tinywasm/crate/Cargo.lock new file mode 100644 index 00000000000..34e567509ec --- /dev/null +++ b/ffi/capi/js/examples/tinywasm/crate/Cargo.lock @@ -0,0 +1,924 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "calendrical_calculations" +version = "0.1.0" +dependencies = [ + "core_maths", + "displaydoc", +] + +[[package]] +name = "colored" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +dependencies = [ + "is-terminal", + "lazy_static", + "windows-sys 0.48.0", +] + +[[package]] +name = "core_maths" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b02505ccb8c50b0aa21ace0fc08c3e53adebd4e58caa18a36152803c7709a3" +dependencies = [ + "libm", +] + +[[package]] +name = "deranged" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "diplomat" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92bd5669c330d5cafd10588707f6b75a1448f9758cb6fad19f83649fe1e2e9c" +dependencies = [ + "diplomat_core", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "diplomat-runtime" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c0116d8e7fea6b2554fdb90289782b1e4e5e35d259525e4882a48ce09cbe7a" + +[[package]] +name = "diplomat_core" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c5577c28e7ed9d8f984ab7286a734a154307d09c976a3d6cb08d6fcb2f2740" +dependencies = [ + "lazy_static", + "proc-macro2", + "quote", + "serde", + "smallvec", + "strck_ident", + "syn", +] + +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "errno" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "fixed_decimal" +version = "0.5.4" +dependencies = [ + "displaydoc", + "ryu", + "smallvec", + "writeable", +] + +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "icu_calendar" +version = "1.3.2" +dependencies = [ + "calendrical_calculations", + "displaydoc", + "icu_calendar_data", + "icu_locid", + "icu_locid_transform", + "icu_provider", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_calendar_data" +version = "1.3.2" + +[[package]] +name = "icu_capi" +version = "1.3.2" +dependencies = [ + "diplomat", + "diplomat-runtime", + "fixed_decimal", + "icu_calendar", + "icu_casemap", + "icu_collator", + "icu_collections", + "icu_datetime", + "icu_decimal", + "icu_displaynames", + "icu_list", + "icu_locid", + "icu_locid_transform", + "icu_normalizer", + "icu_plurals", + "icu_properties", + "icu_provider", + "icu_provider_adapters", + "icu_segmenter", + "icu_timezone", + "log", + "simple_logger", + "tinystr", + "unicode-bidi", + "writeable", +] + +[[package]] +name = "icu_capi_cdylib" +version = "0.0.0" +dependencies = [ + "icu_capi", +] + +[[package]] +name = "icu_casemap" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_casemap_data", + "icu_collections", + "icu_locid", + "icu_properties", + "icu_provider", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_casemap_data" +version = "1.3.2" + +[[package]] +name = "icu_collator" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_collator_data", + "icu_collections", + "icu_locid", + "icu_locid_transform", + "icu_normalizer", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_collator_data" +version = "1.3.2" + +[[package]] +name = "icu_collections" +version = "1.3.2" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_datetime" +version = "1.3.2" +dependencies = [ + "displaydoc", + "either", + "fixed_decimal", + "icu_calendar", + "icu_datetime_data", + "icu_decimal", + "icu_locid", + "icu_locid_transform", + "icu_plurals", + "icu_provider", + "icu_timezone", + "smallvec", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_datetime_data" +version = "1.3.2" + +[[package]] +name = "icu_decimal" +version = "1.3.2" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_decimal_data", + "icu_locid", + "icu_locid_transform", + "icu_provider", + "writeable", +] + +[[package]] +name = "icu_decimal_data" +version = "1.3.2" + +[[package]] +name = "icu_displaynames" +version = "0.11.1" +dependencies = [ + "icu_displaynames_data", + "icu_locid", + "icu_locid_transform", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_displaynames_data" +version = "1.3.2" + +[[package]] +name = "icu_list" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_list_data", + "icu_locid_transform", + "icu_provider", + "regex-automata", + "writeable", +] + +[[package]] +name = "icu_list_data" +version = "1.3.2" + +[[package]] +name = "icu_locid" +version = "1.3.2" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.3.2" + +[[package]] +name = "icu_normalizer" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.3.2" + +[[package]] +name = "icu_plurals" +version = "1.3.2" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_locid", + "icu_locid_transform", + "icu_plurals_data", + "icu_provider", + "zerovec", +] + +[[package]] +name = "icu_plurals_data" +version = "1.3.2" + +[[package]] +name = "icu_properties" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "unicode-bidi", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.3.2" + +[[package]] +name = "icu_provider" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "log", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_adapters" +version = "1.3.2" +dependencies = [ + "icu_locid", + "icu_locid_transform", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.3.2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "icu_segmenter" +version = "1.3.2" +dependencies = [ + "core_maths", + "displaydoc", + "icu_collections", + "icu_locid", + "icu_provider", + "icu_segmenter_data", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_segmenter_data" +version = "1.3.2" + +[[package]] +name = "icu_timezone" +version = "1.3.2" +dependencies = [ + "displaydoc", + "icu_calendar", + "icu_locid", + "icu_provider", + "icu_timezone_data", + "tinystr", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_timezone_data" +version = "1.3.2" + +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "linux-raw-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" + +[[package]] +name = "litemap" +version = "0.7.1" + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "num_threads" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +dependencies = [ + "libc", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex-automata" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9368763f5a9b804326f3af749e16f9abf378d227bcdee7634b13d8f17793782" +dependencies = [ + "memchr", +] + +[[package]] +name = "rustix" +version = "0.38.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "serde" +version = "1.0.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "simple_logger" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2230cd5c29b815c9b699fb610b49a5ed65588f3509d9f0108be3a885da629333" +dependencies = [ + "colored", + "log", + "time", + "windows-sys 0.42.0", +] + +[[package]] +name = "smallvec" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strck" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be91090ded9d8f979d9fe921777342d37e769e0b6b7296843a7a38247240e917" + +[[package]] +name = "strck_ident" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1c3802b169b3858a44667f221c9a0b3136e6019936ea926fc97fbad8af77202" +dependencies = [ + "strck", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "time" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +dependencies = [ + "deranged", + "itoa", + "libc", + "num_threads", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +dependencies = [ + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.7.4" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "utf16_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52df8b7fb78e7910d776fccf2e42ceaf3604d55e8e7eb2dbd183cb1441d8a692" + +[[package]] +name = "utf8_iter" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a8922555b9500e3d865caed19330172cd67cbf82203f1a3311d8c305cc9f33" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.3" + +[[package]] +name = "yoke" +version = "0.7.2" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.2" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.3" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.3" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.1.1" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.10.0" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/ffi/capi/js/examples/tinywasm/crate/Cargo.toml b/ffi/capi/js/examples/tinywasm/crate/Cargo.toml new file mode 100644 index 00000000000..879ede4a5ae --- /dev/null +++ b/ffi/capi/js/examples/tinywasm/crate/Cargo.toml @@ -0,0 +1,16 @@ +# This file is part of ICU4X. For terms of use, please see the file +# called LICENSE at the top level of the ICU4X source tree +# (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +[package] +name = "crate" +version = "0.0.0" +publish = false + +[lib] +crate-type = ["cdylib"] + +[dependencies] +icu_capi = { path = "../../../.." } + +[workspace] \ No newline at end of file diff --git a/ffi/capi/js/examples/tinywasm/crate/LICENSE b/ffi/capi/js/examples/tinywasm/crate/LICENSE new file mode 100644 index 00000000000..9845aa5f488 --- /dev/null +++ b/ffi/capi/js/examples/tinywasm/crate/LICENSE @@ -0,0 +1,44 @@ +UNICODE LICENSE V3 + +COPYRIGHT AND PERMISSION NOTICE + +Copyright © 2020-2023 Unicode, Inc. + +NOTICE TO USER: Carefully read the following legal agreement. BY +DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR +SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT +DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of data files and any associated documentation (the "Data Files") or +software and any associated documentation (the "Software") to deal in the +Data Files or Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, and/or sell +copies of the Data Files or Software, and to permit persons to whom the +Data Files or Software are furnished to do so, provided that either (a) +this copyright and permission notice appear with all copies of the Data +Files or Software, or (b) this copyright and permission notice appear in +associated Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +THIRD PARTY RIGHTS. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE +BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA +FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall +not be used in advertising or otherwise to promote the sale, use or other +dealings in these Data Files or Software without prior written +authorization of the copyright holder. + +— + +Portions of ICU4X may have been adapted from ICU4C and/or ICU4J. +ICU 1.8.1 to ICU 57.1 © 1995-2016 International Business Machines Corporation and others. diff --git a/ffi/capi/js/examples/tinywasm/crate/src/lib.rs b/ffi/capi/js/examples/tinywasm/crate/src/lib.rs new file mode 100644 index 00000000000..235b9b59807 --- /dev/null +++ b/ffi/capi/js/examples/tinywasm/crate/src/lib.rs @@ -0,0 +1,6 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +// Necessary for symbols to be linked in +extern crate icu_capi; diff --git a/ffi/capi/js/examples/tinywasm/diplomat.config.js b/ffi/capi/js/examples/tinywasm/diplomat.config.js index 9babc8a8e2d..5b3842cd697 100644 --- a/ffi/capi/js/examples/tinywasm/diplomat.config.js +++ b/ffi/capi/js/examples/tinywasm/diplomat.config.js @@ -3,5 +3,5 @@ // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). export default { - wasm_path: new URL('./icu_capi.wasm', import.meta.url), + wasm_path: new URL('crate/target/wasm32-unknown-unknown/release/crate.wasm', import.meta.url), }; diff --git a/tools/make/ffi.toml b/tools/make/ffi.toml index 4e90450891b..60d425d6b79 100644 --- a/tools/make/ffi.toml +++ b/tools/make/ffi.toml @@ -75,7 +75,7 @@ command = "cargo" args = ["check", "--package", "icu_freertos", "--target", "thumbv8m.main-none-eabihf", "--no-default-features", "--features=wearos", - "-Zbuild-std=core,alloc", "-Zbuild-std-features=panic_immediate_abort"] + "-Zbuild-std=std,panic_abort", "-Zbuild-std-features=panic_immediate_abort"] # Diplomat gen diff --git a/tools/make/wasm.toml b/tools/make/wasm.toml index 2a3f5ec3efe..02bc89992f9 100644 --- a/tools/make/wasm.toml +++ b/tools/make/wasm.toml @@ -18,10 +18,13 @@ script_runner = "@duckscript" script = ''' exit_on_error true -set_env RUSTFLAGS "-C panic=abort -C opt-level=s" -exec --fail-on-error cargo +${ICU4X_NIGHTLY_TOOLCHAIN} wasm-build-release --examples --workspace --features serde --exclude icu_datagen --exclude icu_capi -# Re-run the build command only to generate the JSON output (--message-format=json) -output = exec --fail-on-error cargo +${ICU4X_NIGHTLY_TOOLCHAIN} wasm-build-release --message-format=json --examples --workspace --features serde --exclude icu_datagen --exclude icu_capi +# 100 KiB, working around a bug in older rustc +# https://github.com/unicode-org/icu4x/issues/2753 +set_env RUSTFLAGS "-Clink-args=-zstack-size=100000" +command = set "build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target wasm32-unknown-unknown --profile=release-opt --examples --workspace --features serde --exclude icu_datagen --exclude icu_capi" +exec --fail-on-error cargo +${ICU4X_NIGHTLY_TOOLCHAIN} %{command} +# Re-run the build command only to generate the JSON output +output = exec --fail-on-error cargo +${ICU4X_NIGHTLY_TOOLCHAIN} %{command} --message-format=json # Parse the JSON messages from --message-format=json line by line trimmed_stdout = trim ${output.stdout}