mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
LibUnicode: Move CLDR data generators to a LibLocale subfolder
To prepare for placing all CLDR generated data in a new library, LibLocale, this moves the code generators for the CLDR data to the LibLocale subfolder.
This commit is contained in:
parent
e3e0602833
commit
89d1813b5d
Notes:
sideshowbarker
2024-07-17 07:30:25 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/89d1813b5d Pull-request: https://github.com/SerenityOS/serenity/pull/15096 Reviewed-by: https://github.com/linusg ✅
2
.github/workflows/cmake.yml
vendored
2
.github/workflows/cmake.yml
vendored
@ -138,7 +138,7 @@ jobs:
|
||||
uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
|
||||
with:
|
||||
path: ${{ github.workspace }}/Build/${{ matrix.arch }}/CLDR
|
||||
key: UnicodeLocale-${{ hashFiles('Meta/CMake/unicode_data.cmake') }}
|
||||
key: UnicodeLocale-${{ hashFiles('Meta/CMake/locale_data.cmake') }}
|
||||
- name: Create build environment with extra debug options
|
||||
# Build the entire project with all available debug options turned on, to prevent code rot.
|
||||
# However, it is unwieldy and slow to run tests with them enabled, so we will build twice.
|
||||
|
2
.github/workflows/libjs-test262.yml
vendored
2
.github/workflows/libjs-test262.yml
vendored
@ -93,7 +93,7 @@ jobs:
|
||||
uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
|
||||
with:
|
||||
path: ${{ github.workspace }}/libjs-test262/Build/CLDR
|
||||
key: UnicodeData-${{ hashFiles('Meta/CMake/unicode_data.cmake') }}
|
||||
key: UnicodeData-${{ hashFiles('Meta/CMake/locale_data.cmake') }}
|
||||
|
||||
- name: Build libjs-test262-runner and test-js
|
||||
working-directory: libjs-test262
|
||||
|
@ -81,7 +81,7 @@ steps:
|
||||
inputs:
|
||||
key: '"unicode_locale" | Meta/CMake/unicode_data.cmake | "$(timestamp)"'
|
||||
restoreKeys: |
|
||||
"unicode_locale" | Meta/CMake/unicode_data.cmake
|
||||
"unicode_locale" | Meta/CMake/locale_data.cmake
|
||||
path: $(Build.SourcesDirectory)/${{ parameters.build_directory }}/CLDR
|
||||
displayName: 'UnicodeLocale Cache'
|
||||
|
||||
|
137
Meta/CMake/locale_data.cmake
Normal file
137
Meta/CMake/locale_data.cmake
Normal file
@ -0,0 +1,137 @@
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/utils.cmake)
|
||||
|
||||
set(CLDR_VERSION 41.0.0)
|
||||
set(CLDR_PATH "${CMAKE_BINARY_DIR}/CLDR" CACHE PATH "Download location for CLDR files")
|
||||
set(CLDR_VERSION_FILE "${CLDR_PATH}/version.txt")
|
||||
|
||||
set(CLDR_ZIP_URL "https://github.com/unicode-org/cldr-json/releases/download/${CLDR_VERSION}/cldr-${CLDR_VERSION}-json-modern.zip")
|
||||
set(CLDR_ZIP_PATH "${CLDR_PATH}/cldr.zip")
|
||||
|
||||
set(CLDR_BCP47_SOURCE cldr-bcp47)
|
||||
set(CLDR_BCP47_PATH "${CLDR_PATH}/${CLDR_BCP47_SOURCE}")
|
||||
|
||||
set(CLDR_CORE_SOURCE cldr-core)
|
||||
set(CLDR_CORE_PATH "${CLDR_PATH}/${CLDR_CORE_SOURCE}")
|
||||
|
||||
set(CLDR_DATES_SOURCE cldr-dates-modern)
|
||||
set(CLDR_DATES_PATH "${CLDR_PATH}/${CLDR_DATES_SOURCE}")
|
||||
|
||||
set(CLDR_LOCALES_SOURCE cldr-localenames-modern)
|
||||
set(CLDR_LOCALES_PATH "${CLDR_PATH}/${CLDR_LOCALES_SOURCE}")
|
||||
|
||||
set(CLDR_MISC_SOURCE cldr-misc-modern)
|
||||
set(CLDR_MISC_PATH "${CLDR_PATH}/${CLDR_MISC_SOURCE}")
|
||||
|
||||
set(CLDR_NUMBERS_SOURCE cldr-numbers-modern)
|
||||
set(CLDR_NUMBERS_PATH "${CLDR_PATH}/${CLDR_NUMBERS_SOURCE}")
|
||||
|
||||
set(CLDR_UNITS_SOURCE cldr-units-modern)
|
||||
set(CLDR_UNITS_PATH "${CLDR_PATH}/${CLDR_UNITS_SOURCE}")
|
||||
|
||||
if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
||||
remove_path_if_version_changed("${CLDR_VERSION}" "${CLDR_VERSION_FILE}" "${CLDR_PATH}")
|
||||
|
||||
download_file("${CLDR_ZIP_URL}" "${CLDR_ZIP_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_BCP47_SOURCE}/**" "${CLDR_BCP47_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_CORE_SOURCE}/**" "${CLDR_CORE_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_DATES_SOURCE}/**" "${CLDR_DATES_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_LOCALES_SOURCE}/**" "${CLDR_LOCALES_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_MISC_SOURCE}/**" "${CLDR_MISC_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_NUMBERS_SOURCE}/**" "${CLDR_NUMBERS_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_UNITS_SOURCE}/**" "${CLDR_UNITS_PATH}")
|
||||
|
||||
set(DATE_TIME_FORMAT_DATA_HEADER LibUnicode/DateTimeFormatData.h)
|
||||
set(DATE_TIME_FORMAT_DATA_IMPLEMENTATION LibUnicode/DateTimeFormatData.cpp)
|
||||
|
||||
set(LOCALE_DATA_HEADER LibUnicode/LocaleData.h)
|
||||
set(LOCALE_DATA_IMPLEMENTATION LibUnicode/LocaleData.cpp)
|
||||
|
||||
set(NUMBER_FORMAT_DATA_HEADER LibUnicode/NumberFormatData.h)
|
||||
set(NUMBER_FORMAT_DATA_IMPLEMENTATION LibUnicode/NumberFormatData.cpp)
|
||||
|
||||
set(PLURAL_RULES_DATA_HEADER LibUnicode/PluralRulesData.h)
|
||||
set(PLURAL_RULES_DATA_IMPLEMENTATION LibUnicode/PluralRulesData.cpp)
|
||||
|
||||
set(RELATIVE_TIME_FORMAT_DATA_HEADER LibUnicode/RelativeTimeFormatData.h)
|
||||
set(RELATIVE_TIME_FORMAT_DATA_IMPLEMENTATION LibUnicode/RelativeTimeFormatData.cpp)
|
||||
|
||||
set(LOCALE_META_TARGET_PREFIX LibUnicode_)
|
||||
|
||||
if (CMAKE_CURRENT_BINARY_DIR MATCHES ".*/LibUnicode") # Serenity build.
|
||||
set(DATE_TIME_FORMAT_DATA_HEADER DateTimeFormatData.h)
|
||||
set(DATE_TIME_FORMAT_DATA_IMPLEMENTATION DateTimeFormatData.cpp)
|
||||
|
||||
set(LOCALE_DATA_HEADER LocaleData.h)
|
||||
set(LOCALE_DATA_IMPLEMENTATION LocaleData.cpp)
|
||||
|
||||
set(NUMBER_FORMAT_DATA_HEADER NumberFormatData.h)
|
||||
set(NUMBER_FORMAT_DATA_IMPLEMENTATION NumberFormatData.cpp)
|
||||
|
||||
set(PLURAL_RULES_DATA_HEADER PluralRulesData.h)
|
||||
set(PLURAL_RULES_DATA_IMPLEMENTATION PluralRulesData.cpp)
|
||||
|
||||
set(RELATIVE_TIME_FORMAT_DATA_HEADER RelativeTimeFormatData.h)
|
||||
set(RELATIVE_TIME_FORMAT_DATA_IMPLEMENTATION RelativeTimeFormatData.cpp)
|
||||
|
||||
set(LOCALE_META_TARGET_PREFIX "")
|
||||
endif()
|
||||
|
||||
invoke_generator(
|
||||
"DateTimeFormatData"
|
||||
Lagom::GenerateDateTimeFormatData
|
||||
"${CLDR_VERSION_FILE}"
|
||||
"${LOCALE_META_TARGET_PREFIX}"
|
||||
"${DATE_TIME_FORMAT_DATA_HEADER}"
|
||||
"${DATE_TIME_FORMAT_DATA_IMPLEMENTATION}"
|
||||
arguments -r "${CLDR_CORE_PATH}" -d "${CLDR_DATES_PATH}"
|
||||
)
|
||||
invoke_generator(
|
||||
"LocaleData"
|
||||
Lagom::GenerateLocaleData
|
||||
"${CLDR_VERSION_FILE}"
|
||||
"${LOCALE_META_TARGET_PREFIX}"
|
||||
"${LOCALE_DATA_HEADER}"
|
||||
"${LOCALE_DATA_IMPLEMENTATION}"
|
||||
arguments -b "${CLDR_BCP47_PATH}" -r "${CLDR_CORE_PATH}" -l "${CLDR_LOCALES_PATH}" -m "${CLDR_MISC_PATH}" -n "${CLDR_NUMBERS_PATH}" -d "${CLDR_DATES_PATH}"
|
||||
)
|
||||
invoke_generator(
|
||||
"NumberFormatData"
|
||||
Lagom::GenerateNumberFormatData
|
||||
"${CLDR_VERSION_FILE}"
|
||||
"${LOCALE_META_TARGET_PREFIX}"
|
||||
"${NUMBER_FORMAT_DATA_HEADER}"
|
||||
"${NUMBER_FORMAT_DATA_IMPLEMENTATION}"
|
||||
arguments -r "${CLDR_CORE_PATH}" -n "${CLDR_NUMBERS_PATH}" -u "${CLDR_UNITS_PATH}"
|
||||
)
|
||||
invoke_generator(
|
||||
"PluralRulesData"
|
||||
Lagom::GeneratePluralRulesData
|
||||
"${CLDR_VERSION_FILE}"
|
||||
"${LOCALE_META_TARGET_PREFIX}"
|
||||
"${PLURAL_RULES_DATA_HEADER}"
|
||||
"${PLURAL_RULES_DATA_IMPLEMENTATION}"
|
||||
arguments -r "${CLDR_CORE_PATH}" -l "${CLDR_LOCALES_PATH}"
|
||||
)
|
||||
invoke_generator(
|
||||
"RelativeTimeFormatData"
|
||||
Lagom::GenerateRelativeTimeFormatData
|
||||
"${CLDR_VERSION_FILE}"
|
||||
"${LOCALE_META_TARGET_PREFIX}"
|
||||
"${RELATIVE_TIME_FORMAT_DATA_HEADER}"
|
||||
"${RELATIVE_TIME_FORMAT_DATA_IMPLEMENTATION}"
|
||||
arguments -d "${CLDR_DATES_PATH}"
|
||||
)
|
||||
|
||||
set(LOCALE_DATA_SOURCES
|
||||
${DATE_TIME_FORMAT_DATA_HEADER}
|
||||
${DATE_TIME_FORMAT_DATA_IMPLEMENTATION}
|
||||
${LOCALE_DATA_HEADER}
|
||||
${LOCALE_DATA_IMPLEMENTATION}
|
||||
${NUMBER_FORMAT_DATA_HEADER}
|
||||
${NUMBER_FORMAT_DATA_IMPLEMENTATION}
|
||||
${PLURAL_RULES_DATA_HEADER}
|
||||
${PLURAL_RULES_DATA_IMPLEMENTATION}
|
||||
${RELATIVE_TIME_FORMAT_DATA_HEADER}
|
||||
${RELATIVE_TIME_FORMAT_DATA_IMPLEMENTATION}
|
||||
)
|
||||
endif()
|
@ -1,13 +1,8 @@
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/utils.cmake)
|
||||
|
||||
set(UCD_VERSION 14.0.0)
|
||||
set(CLDR_VERSION 41.0.0)
|
||||
|
||||
set(UCD_PATH "${CMAKE_BINARY_DIR}/UCD" CACHE PATH "Download location for UCD files")
|
||||
set(CLDR_PATH "${CMAKE_BINARY_DIR}/CLDR" CACHE PATH "Download location for CLDR files")
|
||||
|
||||
set(UCD_VERSION_FILE "${UCD_PATH}/version.txt")
|
||||
set(CLDR_VERSION_FILE "${CLDR_PATH}/version.txt")
|
||||
|
||||
set(UCD_ZIP_URL "https://www.unicode.org/Public/${UCD_VERSION}/ucd/UCD.zip")
|
||||
set(UCD_ZIP_PATH "${UCD_PATH}/UCD.zip")
|
||||
@ -70,43 +65,8 @@ set(EMOJI_GENERATOR_PATH "${SerenityOS_SOURCE_DIR}/Meta/generate-emoji-txt.sh")
|
||||
set(EMOJI_RES_PATH "${SerenityOS_SOURCE_DIR}/Base/res/emoji")
|
||||
set(EMOJI_INSTALL_PATH "${CMAKE_BINARY_DIR}/Root/home/anon/Documents/emoji.txt")
|
||||
|
||||
set(CLDR_ZIP_URL "https://github.com/unicode-org/cldr-json/releases/download/${CLDR_VERSION}/cldr-${CLDR_VERSION}-json-modern.zip")
|
||||
set(CLDR_ZIP_PATH "${CLDR_PATH}/cldr.zip")
|
||||
|
||||
set(CLDR_BCP47_SOURCE cldr-bcp47)
|
||||
set(CLDR_BCP47_PATH "${CLDR_PATH}/${CLDR_BCP47_SOURCE}")
|
||||
|
||||
set(CLDR_CORE_SOURCE cldr-core)
|
||||
set(CLDR_CORE_PATH "${CLDR_PATH}/${CLDR_CORE_SOURCE}")
|
||||
|
||||
set(CLDR_DATES_SOURCE cldr-dates-modern)
|
||||
set(CLDR_DATES_PATH "${CLDR_PATH}/${CLDR_DATES_SOURCE}")
|
||||
|
||||
set(CLDR_LOCALES_SOURCE cldr-localenames-modern)
|
||||
set(CLDR_LOCALES_PATH "${CLDR_PATH}/${CLDR_LOCALES_SOURCE}")
|
||||
|
||||
set(CLDR_MISC_SOURCE cldr-misc-modern)
|
||||
set(CLDR_MISC_PATH "${CLDR_PATH}/${CLDR_MISC_SOURCE}")
|
||||
|
||||
set(CLDR_NUMBERS_SOURCE cldr-numbers-modern)
|
||||
set(CLDR_NUMBERS_PATH "${CLDR_PATH}/${CLDR_NUMBERS_SOURCE}")
|
||||
|
||||
set(CLDR_UNITS_SOURCE cldr-units-modern)
|
||||
set(CLDR_UNITS_PATH "${CLDR_PATH}/${CLDR_UNITS_SOURCE}")
|
||||
|
||||
function(extract_path dest_dir zip_path source_path dest_path)
|
||||
if (EXISTS "${zip_path}" AND NOT EXISTS "${dest_path}")
|
||||
message(STATUS "Extracting ${source_path} from ${zip_path}")
|
||||
execute_process(COMMAND "${UNZIP_TOOL}" -q "${zip_path}" "${source_path}" -d "${dest_dir}" RESULT_VARIABLE unzip_result)
|
||||
if (NOT unzip_result EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to unzip ${source_path} from ${zip_path} with status ${unzip_result}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
||||
remove_path_if_version_changed("${UCD_VERSION}" "${UCD_VERSION_FILE}" "${UCD_PATH}")
|
||||
remove_path_if_version_changed("${CLDR_VERSION}" "${CLDR_VERSION_FILE}" "${CLDR_PATH}")
|
||||
|
||||
download_file("${UCD_ZIP_URL}" "${UCD_ZIP_PATH}")
|
||||
extract_path("${UCD_PATH}" "${UCD_ZIP_PATH}" "${UNICODE_DATA_SOURCE}" "${UNICODE_DATA_PATH}")
|
||||
@ -129,54 +89,15 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
||||
|
||||
download_file("${EMOJI_TEST_URL}" "${EMOJI_TEST_PATH}")
|
||||
|
||||
download_file("${CLDR_ZIP_URL}" "${CLDR_ZIP_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_BCP47_SOURCE}/**" "${CLDR_BCP47_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_CORE_SOURCE}/**" "${CLDR_CORE_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_DATES_SOURCE}/**" "${CLDR_DATES_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_LOCALES_SOURCE}/**" "${CLDR_LOCALES_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_MISC_SOURCE}/**" "${CLDR_MISC_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_NUMBERS_SOURCE}/**" "${CLDR_NUMBERS_PATH}")
|
||||
extract_path("${CLDR_PATH}" "${CLDR_ZIP_PATH}" "${CLDR_UNITS_SOURCE}/**" "${CLDR_UNITS_PATH}")
|
||||
|
||||
set(UNICODE_DATA_HEADER LibUnicode/UnicodeData.h)
|
||||
set(UNICODE_DATA_IMPLEMENTATION LibUnicode/UnicodeData.cpp)
|
||||
|
||||
set(UNICODE_DATE_TIME_FORMAT_HEADER LibUnicode/UnicodeDateTimeFormat.h)
|
||||
set(UNICODE_DATE_TIME_FORMAT_IMPLEMENTATION LibUnicode/UnicodeDateTimeFormat.cpp)
|
||||
|
||||
set(UNICODE_LOCALE_HEADER LibUnicode/UnicodeLocale.h)
|
||||
set(UNICODE_LOCALE_IMPLEMENTATION LibUnicode/UnicodeLocale.cpp)
|
||||
|
||||
set(UNICODE_NUMBER_FORMAT_HEADER LibUnicode/UnicodeNumberFormat.h)
|
||||
set(UNICODE_NUMBER_FORMAT_IMPLEMENTATION LibUnicode/UnicodeNumberFormat.cpp)
|
||||
|
||||
set(UNICODE_PLURAL_RULES_HEADER LibUnicode/UnicodePluralRules.h)
|
||||
set(UNICODE_PLURAL_RULES_IMPLEMENTATION LibUnicode/UnicodePluralRules.cpp)
|
||||
|
||||
set(UNICODE_RELATIVE_TIME_FORMAT_HEADER LibUnicode/UnicodeRelativeTimeFormat.h)
|
||||
set(UNICODE_RELATIVE_TIME_FORMAT_IMPLEMENTATION LibUnicode/UnicodeRelativeTimeFormat.cpp)
|
||||
|
||||
set(UNICODE_META_TARGET_PREFIX LibUnicode_)
|
||||
|
||||
if (CMAKE_CURRENT_BINARY_DIR MATCHES ".*/LibUnicode") # Serenity build.
|
||||
set(UNICODE_DATA_HEADER UnicodeData.h)
|
||||
set(UNICODE_DATA_IMPLEMENTATION UnicodeData.cpp)
|
||||
|
||||
set(UNICODE_DATE_TIME_FORMAT_HEADER UnicodeDateTimeFormat.h)
|
||||
set(UNICODE_DATE_TIME_FORMAT_IMPLEMENTATION UnicodeDateTimeFormat.cpp)
|
||||
|
||||
set(UNICODE_LOCALE_HEADER UnicodeLocale.h)
|
||||
set(UNICODE_LOCALE_IMPLEMENTATION UnicodeLocale.cpp)
|
||||
|
||||
set(UNICODE_NUMBER_FORMAT_HEADER UnicodeNumberFormat.h)
|
||||
set(UNICODE_NUMBER_FORMAT_IMPLEMENTATION UnicodeNumberFormat.cpp)
|
||||
|
||||
set(UNICODE_PLURAL_RULES_HEADER UnicodePluralRules.h)
|
||||
set(UNICODE_PLURAL_RULES_IMPLEMENTATION UnicodePluralRules.cpp)
|
||||
|
||||
set(UNICODE_RELATIVE_TIME_FORMAT_HEADER UnicodeRelativeTimeFormat.h)
|
||||
set(UNICODE_RELATIVE_TIME_FORMAT_IMPLEMENTATION UnicodeRelativeTimeFormat.cpp)
|
||||
|
||||
set(UNICODE_META_TARGET_PREFIX "")
|
||||
endif()
|
||||
|
||||
@ -189,51 +110,6 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
||||
"${UNICODE_DATA_IMPLEMENTATION}"
|
||||
arguments -u "${UNICODE_DATA_PATH}" -s "${SPECIAL_CASING_PATH}" -g "${DERIVED_GENERAL_CATEGORY_PATH}" -p "${PROP_LIST_PATH}" -d "${DERIVED_CORE_PROP_PATH}" -b "${DERIVED_BINARY_PROP_PATH}" -a "${PROP_ALIAS_PATH}" -v "${PROP_VALUE_ALIAS_PATH}" -r "${SCRIPTS_PATH}" -x "${SCRIPT_EXTENSIONS_PATH}" -k "${BLOCKS_PATH}" -e "${EMOJI_DATA_PATH}" -m "${NAME_ALIAS_PATH}" -n "${NORM_PROPS_PATH}" -f "${GRAPHEME_BREAK_PROP_PATH}" -w "${WORD_BREAK_PROP_PATH}" -i "${SENTENCE_BREAK_PROP_PATH}"
|
||||
)
|
||||
invoke_generator(
|
||||
"UnicodeDateTimeFormat"
|
||||
Lagom::GenerateUnicodeDateTimeFormat
|
||||
"${CLDR_VERSION_FILE}"
|
||||
"${UNICODE_META_TARGET_PREFIX}"
|
||||
"${UNICODE_DATE_TIME_FORMAT_HEADER}"
|
||||
"${UNICODE_DATE_TIME_FORMAT_IMPLEMENTATION}"
|
||||
arguments -r "${CLDR_CORE_PATH}" -d "${CLDR_DATES_PATH}"
|
||||
)
|
||||
invoke_generator(
|
||||
"UnicodeLocale"
|
||||
Lagom::GenerateUnicodeLocale
|
||||
"${CLDR_VERSION_FILE}"
|
||||
"${UNICODE_META_TARGET_PREFIX}"
|
||||
"${UNICODE_LOCALE_HEADER}"
|
||||
"${UNICODE_LOCALE_IMPLEMENTATION}"
|
||||
arguments -b "${CLDR_BCP47_PATH}" -r "${CLDR_CORE_PATH}" -l "${CLDR_LOCALES_PATH}" -m "${CLDR_MISC_PATH}" -n "${CLDR_NUMBERS_PATH}" -d "${CLDR_DATES_PATH}"
|
||||
)
|
||||
invoke_generator(
|
||||
"UnicodeNumberFormat"
|
||||
Lagom::GenerateUnicodeNumberFormat
|
||||
"${CLDR_VERSION_FILE}"
|
||||
"${UNICODE_META_TARGET_PREFIX}"
|
||||
"${UNICODE_NUMBER_FORMAT_HEADER}"
|
||||
"${UNICODE_NUMBER_FORMAT_IMPLEMENTATION}"
|
||||
arguments -r "${CLDR_CORE_PATH}" -n "${CLDR_NUMBERS_PATH}" -u "${CLDR_UNITS_PATH}"
|
||||
)
|
||||
invoke_generator(
|
||||
"UnicodePluralRules"
|
||||
Lagom::GenerateUnicodePluralRules
|
||||
"${CLDR_VERSION_FILE}"
|
||||
"${UNICODE_META_TARGET_PREFIX}"
|
||||
"${UNICODE_PLURAL_RULES_HEADER}"
|
||||
"${UNICODE_PLURAL_RULES_IMPLEMENTATION}"
|
||||
arguments -r "${CLDR_CORE_PATH}" -l "${CLDR_LOCALES_PATH}"
|
||||
)
|
||||
invoke_generator(
|
||||
"UnicodeRelativeTimeFormat"
|
||||
Lagom::GenerateUnicodeRelativeTimeFormat
|
||||
"${CLDR_VERSION_FILE}"
|
||||
"${UNICODE_META_TARGET_PREFIX}"
|
||||
"${UNICODE_RELATIVE_TIME_FORMAT_HEADER}"
|
||||
"${UNICODE_RELATIVE_TIME_FORMAT_IMPLEMENTATION}"
|
||||
arguments -d "${CLDR_DATES_PATH}"
|
||||
)
|
||||
|
||||
if (CMAKE_CURRENT_BINARY_DIR MATCHES ".*/LibUnicode") # Serenity build.
|
||||
add_custom_command(
|
||||
@ -252,15 +128,5 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
||||
set(UNICODE_DATA_SOURCES
|
||||
${UNICODE_DATA_HEADER}
|
||||
${UNICODE_DATA_IMPLEMENTATION}
|
||||
${UNICODE_DATE_TIME_FORMAT_HEADER}
|
||||
${UNICODE_DATE_TIME_FORMAT_IMPLEMENTATION}
|
||||
${UNICODE_LOCALE_HEADER}
|
||||
${UNICODE_LOCALE_IMPLEMENTATION}
|
||||
${UNICODE_NUMBER_FORMAT_HEADER}
|
||||
${UNICODE_NUMBER_FORMAT_IMPLEMENTATION}
|
||||
${UNICODE_PLURAL_RULES_HEADER}
|
||||
${UNICODE_PLURAL_RULES_IMPLEMENTATION}
|
||||
${UNICODE_RELATIVE_TIME_FORMAT_HEADER}
|
||||
${UNICODE_RELATIVE_TIME_FORMAT_IMPLEMENTATION}
|
||||
)
|
||||
endif()
|
||||
|
@ -221,3 +221,13 @@ function(download_file url path)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(extract_path dest_dir zip_path source_path dest_path)
|
||||
if (EXISTS "${zip_path}" AND NOT EXISTS "${dest_path}")
|
||||
message(STATUS "Extracting ${source_path} from ${zip_path}")
|
||||
execute_process(COMMAND "${UNZIP_TOOL}" -q "${zip_path}" "${source_path}" -d "${dest_dir}" RESULT_VARIABLE unzip_result)
|
||||
if (NOT unzip_result EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to unzip ${source_path} from ${zip_path} with status ${unzip_result}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -502,9 +502,10 @@ if (BUILD_LAGOM)
|
||||
|
||||
# Unicode
|
||||
include(unicode_data)
|
||||
include(locale_data)
|
||||
file(GLOB LIBUNICODE_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibUnicode/*.cpp")
|
||||
lagom_lib(Unicode unicode
|
||||
SOURCES ${LIBUNICODE_SOURCES} ${UNICODE_DATA_SOURCES}
|
||||
SOURCES ${LIBUNICODE_SOURCES} ${UNICODE_DATA_SOURCES} ${LOCALE_DATA_SOURCES}
|
||||
)
|
||||
target_compile_definitions(LibUnicode PRIVATE ENABLE_UNICODE_DATA=$<BOOL:${ENABLE_UNICODE_DATABASE_DOWNLOAD}>)
|
||||
target_compile_options(LibUnicode PRIVATE -Wno-parentheses-equality)
|
||||
|
@ -1,5 +1,6 @@
|
||||
add_subdirectory(IPCCompiler)
|
||||
add_subdirectory(LibEDID)
|
||||
add_subdirectory(LibLocale)
|
||||
add_subdirectory(LibTimeZone)
|
||||
add_subdirectory(LibUnicode)
|
||||
add_subdirectory(LibWeb)
|
||||
|
5
Meta/Lagom/Tools/CodeGenerators/LibLocale/CMakeLists.txt
Normal file
5
Meta/Lagom/Tools/CodeGenerators/LibLocale/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
lagom_tool(GenerateDateTimeFormatData SOURCES GenerateDateTimeFormatData.cpp LIBS LibMain LibTimeZone)
|
||||
lagom_tool(GenerateLocaleData SOURCES GenerateLocaleData.cpp LIBS LibMain)
|
||||
lagom_tool(GenerateNumberFormatData SOURCES GenerateNumberFormatData.cpp LIBS LibMain)
|
||||
lagom_tool(GeneratePluralRulesData SOURCES GeneratePluralRulesData.cpp LIBS LibMain)
|
||||
lagom_tool(GenerateRelativeTimeFormatData SOURCES GenerateRelativeTimeFormatData.cpp LIBS LibMain)
|
@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "GeneratorUtil.h"
|
||||
#include "../LibUnicode/GeneratorUtil.h" // FIXME: Move this somewhere common.
|
||||
#include <AK/AllOf.h>
|
||||
#include <AK/CharacterTypes.h>
|
||||
#include <AK/Find.h>
|
||||
@ -1770,9 +1770,9 @@ static ErrorOr<void> generate_unicode_locale_implementation(Core::Stream::Buffer
|
||||
#include <AK/StringView.h>
|
||||
#include <LibTimeZone/TimeZone.h>
|
||||
#include <LibUnicode/DateTimeFormat.h>
|
||||
#include <LibUnicode/DateTimeFormatData.h>
|
||||
#include <LibUnicode/Locale.h>
|
||||
#include <LibUnicode/UnicodeDateTimeFormat.h>
|
||||
#include <LibUnicode/UnicodeLocale.h>
|
||||
#include <LibUnicode/LocaleData.h>
|
||||
|
||||
namespace Unicode {
|
||||
)~~~");
|
@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "GeneratorUtil.h"
|
||||
#include "../LibUnicode/GeneratorUtil.h" // FIXME: Move this somewhere common.
|
||||
#include <AK/AllOf.h>
|
||||
#include <AK/CharacterTypes.h>
|
||||
#include <AK/Format.h>
|
||||
@ -1105,7 +1105,7 @@ static ErrorOr<void> generate_unicode_locale_implementation(Core::Stream::Buffer
|
||||
#include <LibUnicode/CurrencyCode.h>
|
||||
#include <LibUnicode/DateTimeFormat.h>
|
||||
#include <LibUnicode/Locale.h>
|
||||
#include <LibUnicode/UnicodeLocale.h>
|
||||
#include <LibUnicode/LocaleData.h>
|
||||
|
||||
namespace Unicode {
|
||||
)~~~");
|
@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "GeneratorUtil.h"
|
||||
#include "../LibUnicode/GeneratorUtil.h" // FIXME: Move this somewhere common.
|
||||
#include <AK/AllOf.h>
|
||||
#include <AK/Array.h>
|
||||
#include <AK/CharacterTypes.h>
|
||||
@ -807,10 +807,10 @@ static ErrorOr<void> generate_unicode_locale_implementation(Core::Stream::Buffer
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibUnicode/Locale.h>
|
||||
#include <LibUnicode/LocaleData.h>
|
||||
#include <LibUnicode/NumberFormat.h>
|
||||
#include <LibUnicode/NumberFormatData.h>
|
||||
#include <LibUnicode/PluralRules.h>
|
||||
#include <LibUnicode/UnicodeLocale.h>
|
||||
#include <LibUnicode/UnicodeNumberFormat.h>
|
||||
|
||||
namespace Unicode {
|
||||
)~~~");
|
@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "GeneratorUtil.h"
|
||||
#include "../LibUnicode/GeneratorUtil.h" // FIXME: Move this somewhere common.
|
||||
#include <AK/Format.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/JsonParser.h>
|
||||
@ -461,9 +461,9 @@ static ErrorOr<void> generate_unicode_locale_implementation(Core::Stream::Buffer
|
||||
generator.append(R"~~~(
|
||||
#include <AK/Array.h>
|
||||
#include <LibUnicode/Locale.h>
|
||||
#include <LibUnicode/LocaleData.h>
|
||||
#include <LibUnicode/PluralRules.h>
|
||||
#include <LibUnicode/UnicodeLocale.h>
|
||||
#include <LibUnicode/UnicodePluralRules.h>
|
||||
#include <LibUnicode/PluralRulesData.h>
|
||||
#include <math.h>
|
||||
|
||||
namespace Unicode {
|
@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "GeneratorUtil.h"
|
||||
#include "../LibUnicode/GeneratorUtil.h" // FIXME: Move this somewhere common.
|
||||
#include <AK/Format.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/JsonObject.h>
|
||||
@ -205,7 +205,7 @@ static ErrorOr<void> generate_unicode_locale_implementation(Core::Stream::Buffer
|
||||
#include <LibUnicode/Locale.h>
|
||||
#include <LibUnicode/PluralRules.h>
|
||||
#include <LibUnicode/RelativeTimeFormat.h>
|
||||
#include <LibUnicode/UnicodeRelativeTimeFormat.h>
|
||||
#include <LibUnicode/RelativeTimeFormatData.h>
|
||||
|
||||
namespace Unicode {
|
||||
)~~~");
|
@ -1,6 +1 @@
|
||||
lagom_tool(GenerateUnicodeData SOURCES GenerateUnicodeData.cpp LIBS LibMain)
|
||||
lagom_tool(GenerateUnicodeDateTimeFormat SOURCES GenerateUnicodeDateTimeFormat.cpp LIBS LibMain LibTimeZone)
|
||||
lagom_tool(GenerateUnicodeLocale SOURCES GenerateUnicodeLocale.cpp LIBS LibMain)
|
||||
lagom_tool(GenerateUnicodeNumberFormat SOURCES GenerateUnicodeNumberFormat.cpp LIBS LibMain)
|
||||
lagom_tool(GenerateUnicodePluralRules SOURCES GenerateUnicodePluralRules.cpp LIBS LibMain)
|
||||
lagom_tool(GenerateUnicodeRelativeTimeFormat SOURCES GenerateUnicodeRelativeTimeFormat.cpp LIBS LibMain)
|
||||
|
@ -687,7 +687,7 @@ enum class @name@ : @underlying@ {)~~~");
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <LibUnicode/Forward.h>
|
||||
#include <LibUnicode/UnicodeLocale.h>
|
||||
#include <LibUnicode/LocaleData.h>
|
||||
|
||||
namespace Unicode {
|
||||
)~~~");
|
||||
|
@ -1,7 +1,8 @@
|
||||
include(${SerenityOS_SOURCE_DIR}/Meta/CMake/unicode_data.cmake)
|
||||
include(${SerenityOS_SOURCE_DIR}/Meta/CMake/locale_data.cmake)
|
||||
|
||||
if (DEFINED UNICODE_DATA_SOURCES)
|
||||
set(SOURCES ${UNICODE_DATA_SOURCES})
|
||||
set(SOURCES ${UNICODE_DATA_SOURCES} ${LOCALE_DATA_SOURCES})
|
||||
serenity_lib(LibUnicodeData unicodedata)
|
||||
target_compile_options(LibUnicodeData PRIVATE -g0 -Os -Wno-parentheses-equality)
|
||||
target_link_libraries(LibUnicodeData LibCore LibTimeZone)
|
||||
|
Loading…
Reference in New Issue
Block a user