Replace the icu4c-based calendar implementation with one built on the icu4x Rust crate (icu_calendar). The icu4c API does not expose the píngqì month-assignment algorithm used by the Chinese and Dangi lunisolar calendars. Our old code had to approximate this by walking months via epoch millisecond arithmetic and manually tracking leap month positions, which produced incorrect month codes and ordinal month numbers for certain years. The icu4x calendar crate handles píngqì natively. With this patch, which is almost a 1-to-1 mapping of ICU invocations, we pass 100% of all Temporal test262 tests. The end goal might be to use icu4x for all of our ICU needs. But it does not yet provide the APIs needed for all ECMA-402 prototypes.
43 lines
1.2 KiB
CMake
43 lines
1.2 KiB
CMake
set(SOURCES
|
|
Calendar.cpp
|
|
CharacterTypes.cpp
|
|
Collator.cpp
|
|
CurrencyCode.cpp
|
|
DateTimeFormat.cpp
|
|
DisplayNames.cpp
|
|
DurationFormat.cpp
|
|
ICU.cpp
|
|
IDNA.cpp
|
|
ListFormat.cpp
|
|
Locale.cpp
|
|
Normalize.cpp
|
|
NumberFormat.cpp
|
|
PluralRules.cpp
|
|
RelativeTimeFormat.cpp
|
|
Segmenter.cpp
|
|
String.cpp
|
|
TimeZone.cpp
|
|
UnicodeKeywords.cpp
|
|
Utf16String.cpp
|
|
)
|
|
|
|
set(GENERATED_SOURCES ${CURRENT_LIB_GENERATED})
|
|
|
|
ladybird_lib(LibUnicode unicode)
|
|
|
|
find_package(ICU 78.2 EXACT REQUIRED COMPONENTS data i18n uc)
|
|
target_link_libraries(LibUnicode PRIVATE ICU::i18n ICU::uc ICU::data)
|
|
|
|
corrosion_import_crate(MANIFEST_PATH Rust/Cargo.toml CRATES libunicode_rust)
|
|
target_link_libraries(LibUnicode PRIVATE libunicode_rust)
|
|
install(TARGETS libunicode_rust EXPORT LagomTargets
|
|
ARCHIVE COMPONENT Lagom_Development
|
|
)
|
|
|
|
# FIXME: Add support for building LibGfx in sanitize
|
|
# lld-link: error: /failifmismatch: mismatch detected for 'annotate_string':
|
|
# >>> lagom-unicode.lib(TimeZone.cpp.obj) has value 1
|
|
# >>> lagom-gfx.lib(PaintingSurface.cpp.obj) has value 0
|
|
if (WIN32 AND ENABLE_ADDRESS_SANITIZER)
|
|
target_compile_options(LibUnicode PRIVATE -fno-sanitize=address)
|
|
endif()
|