mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 19:19:44 +03:00
LibUnicode: Extract cldr-core dataset from CLDR database
This commit is contained in:
parent
6f5fb87d3b
commit
caf5b6fa6f
Notes:
sideshowbarker
2024-07-18 04:57:54 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/caf5b6fa6f8 Pull-request: https://github.com/SerenityOS/serenity/pull/9705 Reviewed-by: https://github.com/linusg ✅
@ -40,6 +40,9 @@ set(CLDR_PATH ${CMAKE_BINARY_DIR}/CLDR)
|
||||
set(CLDR_ZIP_URL https://github.com/unicode-org/cldr-json/releases/download/39.0.0/cldr-39.0.0-json-modern.zip)
|
||||
set(CLDR_ZIP_PATH ${CLDR_PATH}/cldr.zip)
|
||||
|
||||
set(CLDR_CORE_SOURCE cldr-core)
|
||||
set(CLDR_CORE_PATH ${CLDR_PATH}/${CLDR_CORE_SOURCE})
|
||||
|
||||
set(CLDR_LOCALES_SOURCE cldr-localenames-modern)
|
||||
set(CLDR_LOCALES_PATH ${CLDR_PATH}/${CLDR_LOCALES_SOURCE})
|
||||
|
||||
@ -100,6 +103,13 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
||||
message(STATUS "Downloading CLDR database from ${CLDR_ZIP_URL}...")
|
||||
file(DOWNLOAD ${CLDR_ZIP_URL} ${CLDR_ZIP_PATH} INACTIVITY_TIMEOUT 10)
|
||||
endif()
|
||||
if(EXISTS ${CLDR_ZIP_PATH} AND NOT EXISTS ${CLDR_CORE_PATH})
|
||||
message(STATUS "Extracting CLDR ${CLDR_CORE_SOURCE} from ${CLDR_ZIP_PATH}...")
|
||||
execute_process(COMMAND unzip -q ${CLDR_ZIP_PATH} "${CLDR_CORE_SOURCE}/**" -d ${CLDR_PATH} RESULT_VARIABLE unzip_result)
|
||||
if (NOT unzip_result EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to unzip ${CLDR_CORE_SOURCE} from ${CLDR_ZIP_PATH} with status ${unzip_result}")
|
||||
endif()
|
||||
endif()
|
||||
if(EXISTS ${CLDR_ZIP_PATH} AND NOT EXISTS ${CLDR_LOCALES_PATH})
|
||||
message(STATUS "Extracting CLDR ${CLDR_LOCALES_SOURCE} from ${CLDR_ZIP_PATH}...")
|
||||
execute_process(COMMAND unzip -q ${CLDR_ZIP_PATH} "${CLDR_LOCALES_SOURCE}/**" -d ${CLDR_PATH} RESULT_VARIABLE unzip_result)
|
||||
@ -143,9 +153,9 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION}
|
||||
COMMAND $<TARGET_FILE:GenerateUnicodeLocale> -h ${UNICODE_LOCALE_HEADER} -c ${UNICODE_LOCALE_IMPLEMENTATION} -l ${CLDR_LOCALES_PATH} -n ${CLDR_NUMBERS_PATH}
|
||||
COMMAND $<TARGET_FILE:GenerateUnicodeLocale> -h ${UNICODE_LOCALE_HEADER} -c ${UNICODE_LOCALE_IMPLEMENTATION} -r ${CLDR_CORE_PATH} -l ${CLDR_LOCALES_PATH} -n ${CLDR_NUMBERS_PATH}
|
||||
VERBATIM
|
||||
DEPENDS GenerateUnicodeLocale ${CLDR_LOCALES_PATH} ${CLDR_NUMBERS_PATH}
|
||||
DEPENDS GenerateUnicodeLocale ${CLDR_CORE_PATH} ${CLDR_LOCALES_PATH} ${CLDR_NUMBERS_PATH}
|
||||
)
|
||||
add_custom_target(generate_${UNICODE_META_TARGET_PREFIX}UnicodeLocale DEPENDS ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION})
|
||||
add_dependencies(all_generated generate_${UNICODE_META_TARGET_PREFIX}UnicodeLocale)
|
||||
|
@ -487,12 +487,14 @@ int main(int argc, char** argv)
|
||||
{
|
||||
char const* generated_header_path = nullptr;
|
||||
char const* generated_implementation_path = nullptr;
|
||||
char const* core_path = nullptr;
|
||||
char const* locale_names_path = nullptr;
|
||||
char const* numbers_path = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(generated_header_path, "Path to the Unicode locale header file to generate", "generated-header-path", 'h', "generated-header-path");
|
||||
args_parser.add_option(generated_implementation_path, "Path to the Unicode locale implementation file to generate", "generated-implementation-path", 'c', "generated-implementation-path");
|
||||
args_parser.add_option(core_path, "Path to cldr-core directory", "core-path", 'r', "core-path");
|
||||
args_parser.add_option(locale_names_path, "Path to cldr-localenames directory", "locale-names-path", 'l', "locale-names-path");
|
||||
args_parser.add_option(numbers_path, "Path to cldr-numbers directory", "numbers-path", 'n', "numbers-path");
|
||||
args_parser.parse(argc, argv);
|
||||
|
Loading…
Reference in New Issue
Block a user