diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-08-22 10:31:06 -0400 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-08-22 16:00:29 +0100 |
commit | d86b25c460e6d51ac70319423a94f6bb94b7d56a (patch) | |
tree | 91d461301ecbddab0d39513131155a1b14059d6b /Meta/CMake/unicode_data.cmake | |
parent | cde45527102b67ffeaf30ccac5d14dfca355de3f (diff) | |
download | serenity-d86b25c460e6d51ac70319423a94f6bb94b7d56a.zip |
Meta: Move downloading of emoji-test.txt to unicode_data.cmake
The current emoji_txt.cmake does not handle download errors (which were
a common source of issues in the build problems channel) or Unicode
versioning. These are both handled by unicode_data.cmake. Move the
download to unicode_data.cmake so that we can more easily handle next
month's Unicode 15 release.
Diffstat (limited to 'Meta/CMake/unicode_data.cmake')
-rw-r--r-- | Meta/CMake/unicode_data.cmake | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Meta/CMake/unicode_data.cmake b/Meta/CMake/unicode_data.cmake index 0adbed2d50..7af21f69f1 100644 --- a/Meta/CMake/unicode_data.cmake +++ b/Meta/CMake/unicode_data.cmake @@ -63,6 +63,12 @@ set(WORD_BREAK_PROP_PATH "${UCD_PATH}/${WORD_BREAK_PROP_SOURCE}") set(SENTENCE_BREAK_PROP_SOURCE "auxiliary/SentenceBreakProperty.txt") set(SENTENCE_BREAK_PROP_PATH "${UCD_PATH}/${SENTENCE_BREAK_PROP_SOURCE}") +string(REGEX REPLACE "([0-9]+\\.[0-9]+)\\.[0-9]+" "\\1" EMOJI_VERSION "${UCD_VERSION}") +set(EMOJI_TEST_URL "https://unicode.org/Public/emoji/${EMOJI_VERSION}/emoji-test.txt") +set(EMOJI_TEST_PATH "${UCD_PATH}/emoji-test.txt") +set(EMOJI_RES_PATH "${SerenityOS_SOURCE_DIR}/Base/res/emoji") +set(EMOJI_INSTALL_PATH "${SerenityOS_SOURCE_DIR}/Base/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") @@ -120,6 +126,8 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) extract_path("${UCD_PATH}" "${UCD_ZIP_PATH}" "${WORD_BREAK_PROP_SOURCE}" "${WORD_BREAK_PROP_PATH}") extract_path("${UCD_PATH}" "${UCD_ZIP_PATH}" "${SENTENCE_BREAK_PROP_SOURCE}" "${SENTENCE_BREAK_PROP_PATH}") + 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}") @@ -226,6 +234,18 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) arguments -d "${CLDR_DATES_PATH}" ) + add_custom_command( + OUTPUT "${EMOJI_INSTALL_PATH}" + COMMAND "${SerenityOS_SOURCE_DIR}/Meta/generate-emoji-txt.sh" "${EMOJI_TEST_PATH}" "${EMOJI_RES_PATH}" "${EMOJI_INSTALL_PATH}" + # This will make this command only run when the modified time of the directory changes, + # which only happens if files within it are added or deleted, but not when a file is modified. + # This is fine for this use-case, because the contents of a file changing should not affect + # the generated emoji.txt file. + DEPENDS "${EMOJI_RES_PATH}" "${EMOJI_TEST_PATH}" + USES_TERMINAL + ) + add_custom_target(generate_emoji_txt ALL DEPENDS "${EMOJI_INSTALL_PATH}") + set(UNICODE_DATA_SOURCES ${UNICODE_DATA_HEADER} ${UNICODE_DATA_IMPLEMENTATION} |