Skip to content

Commit

Permalink
Bug 1854031 - Part 3. Import icu_capi and icu_segmenter_data crate in…
Browse files Browse the repository at this point in the history
… tree. r=TYLin

By update-icu4x.sh script.

Depends on D192900

Differential Revision: https://phabricator.services.mozilla.com/D193880
  • Loading branch information
makotokato committed Dec 4, 2023
1 parent cc4f5bd commit 652974a
Show file tree
Hide file tree
Showing 1,009 changed files with 74,481 additions and 94 deletions.
271 changes: 271 additions & 0 deletions intl/icu_capi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.

[package]
edition = "2021"
rust-version = "1.67"
name = "icu_capi"
version = "1.4.0"
authors = ["The ICU4X Project Developers"]
include = [
"js/**/*",
"c/**/*",
"cpp/**/*",
"src/**/*",
"tests/**/*",
"Cargo.toml",
"LICENSE",
"README.md",
]
description = "C interface to ICU4X"
homepage = "https://icu4x.unicode.org"
readme = "README.md"
categories = ["internationalization"]
license-file = "LICENSE"
repository = "https://github.com/unicode-org/icu4x"

[package.metadata.cargo-all-features]
denylist = [
"bench",
"cpp_default",
"wasm_default",
"provider_test",
]
max_combination_size = 2

[package.metadata.docs.rs]
all-features = true

[dependencies.diplomat]
version = "0.7"

[dependencies.diplomat-runtime]
version = "0.7"

[dependencies.fixed_decimal]
version = "0.5.5"
features = ["ryu"]
optional = true
default-features = false

[dependencies.icu_calendar]
version = "~1.4.0"
optional = true
default-features = false

[dependencies.icu_casemap]
version = "~1.4.0"
optional = true
default-features = false

[dependencies.icu_collator]
version = "~1.4.0"
optional = true
default-features = false

[dependencies.icu_collections]
version = "~1.4.0"
optional = true
default-features = false

[dependencies.icu_datetime]
version = "~1.4.0"
optional = true
default-features = false

[dependencies.icu_decimal]
version = "~1.4.0"
optional = true
default-features = false

[dependencies.icu_displaynames]
version = "0.11.2"
optional = true
default-features = false

[dependencies.icu_list]
version = "~1.4.0"
optional = true
default-features = false

[dependencies.icu_locid]
version = "~1.4.0"
default-features = false

[dependencies.icu_locid_transform]
version = "~1.4.0"
optional = true
default-features = false

[dependencies.icu_normalizer]
version = "~1.4.0"
optional = true
default-features = false

[dependencies.icu_plurals]
version = "~1.4.0"
optional = true
default-features = false

[dependencies.icu_properties]
version = "~1.4.0"
features = ["bidi"]
optional = true
default-features = false

[dependencies.icu_provider]
version = "~1.4.0"
default-features = false

[dependencies.icu_provider_adapters]
version = "~1.4.0"
default-features = false

[dependencies.icu_provider_blob]
version = "~1.4.0"
optional = true
default-features = false

[dependencies.icu_segmenter]
version = "~1.4.0"
features = ["auto"]
optional = true
default-features = false

[dependencies.icu_timezone]
version = "~1.4.0"
optional = true
default-features = false

[dependencies.log]
version = "0.4"
optional = true

[dependencies.serde]
version = "1.0"
optional = true
default-features = false

[dependencies.tinystr]
version = "0.7.4"
default-features = false

[dependencies.unicode-bidi]
version = "0.3.13"
optional = true
default-features = false

[dependencies.writeable]
version = "0.5.4"
default-features = false

[features]
any_provider = []
buffer_provider = [
"dep:icu_provider_blob",
"dep:serde",
"icu_calendar?/serde",
"icu_casemap?/serde",
"icu_collator?/serde",
"icu_datetime?/serde",
"icu_decimal?/serde",
"icu_displaynames?/serde",
"icu_list?/serde",
"icu_locid_transform?/serde",
"icu_locid/serde",
"icu_normalizer?/serde",
"icu_plurals?/serde",
"icu_properties?/serde",
"icu_provider/serde",
"icu_provider_adapters/serde",
"icu_segmenter?/serde",
"icu_timezone?/serde",
]
compiled_data = [
"icu_segmenter?/compiled_data",
]
cpp_default = ["logging"]
default = [
"compiled_data",
"default_components",
"logging",
"simple_logger",
]
default_components = [
"icu_calendar",
"icu_casemap",
"icu_collator",
"icu_datetime",
"icu_decimal",
"icu_list",
"icu_locid_transform",
"icu_normalizer",
"icu_plurals",
"icu_properties",
"icu_segmenter",
"icu_timezone",
]
icu_calendar = ["dep:icu_calendar"]
icu_casemap = ["dep:icu_casemap"]
icu_collator = ["dep:icu_collator"]
icu_datetime = [
"dep:icu_datetime",
"dep:icu_calendar",
"dep:icu_timezone",
"dep:icu_decimal",
"dep:icu_plurals",
]
icu_decimal = [
"dep:icu_decimal",
"dep:fixed_decimal",
]
icu_displaynames = ["dep:icu_displaynames"]
icu_list = ["dep:icu_list"]
icu_locid_transform = ["dep:icu_locid_transform"]
icu_normalizer = ["dep:icu_normalizer"]
icu_plurals = [
"dep:icu_plurals",
"dep:fixed_decimal",
]
icu_properties = [
"dep:icu_properties",
"dep:icu_collections",
"dep:unicode-bidi",
]
icu_segmenter = ["dep:icu_segmenter"]
icu_timezone = [
"dep:icu_timezone",
"dep:icu_calendar",
]
logging = [
"icu_provider/logging",
"dep:log",
"diplomat-runtime/log",
]
provider_fs = [
"dep:icu_provider_fs",
"buffer_provider",
]
provider_test = ["compiled_data"]
simple_logger = [
"dep:simple_logger",
"logging",
]
wasm_default = ["logging"]

[target."cfg(not(any(target_arch = \"wasm32\", target_os = \"none\")))".dependencies.icu_provider_fs]
version = "~1.4.0"
optional = true
default-features = false

[target."cfg(not(target_arch = \"wasm32\"))".dependencies.simple_logger]
version = "4.1.0"
optional = true
44 changes: 44 additions & 0 deletions intl/icu_capi/LICENSE
Original file line number Diff line number Diff line change
@@ -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.
30 changes: 30 additions & 0 deletions intl/icu_capi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# icu_capi [![crates.io](https://img.shields.io/crates/v/icu_capi)](https://crates.io/crates/icu_capi)

<!-- cargo-rdme start -->

This crate contains the source of truth for the [Diplomat](https://github.com/rust-diplomat/diplomat)-generated
FFI bindings. This generates the C, C++, JavaScript, and TypeScript bindings. This crate also contains the `extern "C"`
FFI for ICU4X.

While the types in this crate are public, APIs from this crate are *not intended to be used from Rust*
and as such this crate may unpredictably change its Rust API across compatible semver versions. The `extern "C"` APIs exposed
by this crate, while not directly documented, are stable within the same major semver version, as are the bindings exposed under
the `cpp/` and `js/` folders.

This crate may still be explored for documentation on docs.rs, and there are generated language-specific docs available as well.
C++ has sphinx docs in `cpp/docs/`, and the header files also contain documentation comments. The JS version has sphinx docs under
`js/docs`, and the TypeScript sources in `js/include` are compatible with `tsdoc`.

This crate is `no_std` and will not typically build as a staticlib on its own. If you wish to link to it you should prefer
using `icu_capi_staticlib`, or for more esoteric platforms you may write a shim crate depending on this crate that hooks in
an allocator and panic hook.

More information on using ICU4X from C++ can be found in [our tutorial].

[our tutorial]: https://github.com/unicode-org/icu4x/blob/main/docs/tutorials/cpp.md

<!-- cargo-rdme end -->

## More Information

For more information on development, authorship, contributing etc. please visit [`ICU4X home page`](https://github.com/unicode-org/icu4x).
17 changes: 17 additions & 0 deletions intl/icu_capi/c/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# C FFI for ICU4X

This folder contains the C FFI for ICU4X. To re-generate the bindings run:

```sh
cargo make diplomat-gen-c
```

Or re-generate all of the bindings:

```sh
cargo make diplomat-gen
```

## More Information

For more information on development, authorship, contributing etc. please visit [`ICU4X home page`](https://github.com/unicode-org/icu4x).
2 changes: 2 additions & 0 deletions intl/icu_capi/c/examples/fixeddecimal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a.out
a.out.dSYM
26 changes: 26 additions & 0 deletions intl/icu_capi/c/examples/fixeddecimal/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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 ).

.DEFAULT_GOAL := test
.PHONY: build test
FORCE:

ALL_HEADERS := $(wildcard ../../include/*.h)

$(ALL_HEADERS):

../../../../../target/debug/libicu_capi_staticlib.a: FORCE
cargo build -p icu_capi_staticlib

a.out: ../../../../../target/debug/libicu_capi_staticlib.a $(ALL_HEADERS) test.c
gcc test.c ../../../../../target/debug/libicu_capi_staticlib.a -ldl -lpthread -lm -g

build: a.out

test: build
./a.out

clean:
git clean -xf *
rm -f ../../../../../target/debug/libicu_capi_staticlib.a
Loading

0 comments on commit 652974a

Please sign in to comment.