Use custom data.

ICU is used to:
- List locales (`locales_tree`)
- Get information about those locales in different languages (`lang_tree`)
- Remove accents (`translit`)

Tracing ICU without custom data, we also load `likelySubtags` and
`metadata`. Not sure why and what happen when missing but let's be
conservatives and include them.
This commit is contained in:
Matthieu Gautier 2023-10-31 18:20:50 +01:00
parent 717dcd801d
commit beadc3b16c
4 changed files with 49 additions and 6 deletions

View File

@ -1,2 +1,3 @@
include kiwixbuild/templates/*_cross_file.txt
include kiwixbuild/patches/*.patch
include kiwixbuild/dependencies/icu4c_data_filter.json

View File

@ -4,16 +4,41 @@ from .base import (
MakeBuilder
)
from kiwixbuild.utils import SkipCommand, Remotefile
from kiwixbuild._global import get_target_step
from kiwixbuild.utils import pj, SkipCommand, Remotefile, extract_archive
from kiwixbuild._global import get_target_step, neutralEnv
import os, shutil
class Icu(Dependency):
name = "icu4c"
class Source(ReleaseDownload):
archive = Remotefile('icu4c-73_2-src.tgz',
'818a80712ed3caacd9b652305e01afc7fa167e6f2e94996da44b90c2ab604ce1',
'https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-src.tgz')
archive_src = Remotefile('icu4c-73_2-src.tgz',
'818a80712ed3caacd9b652305e01afc7fa167e6f2e94996da44b90c2ab604ce1',
'https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-src.tgz')
archive_data = Remotefile('icu4c-73_2-data.zip',
'ca1ee076163b438461e484421a7679fc33a64cd0a54f9d4b401893fa1eb42701',
'https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-data.zip')
archives = [archive_src, archive_data]
def _extract(self, context):
context.try_skip(self.extract_path)
if os.path.exists(self.extract_path):
shutil.rmtree(self.extract_path)
extract_archive(
pj(neutralEnv('archive_dir'), self.archive_src.name),
neutralEnv('source_dir'),
topdir=None,
name=self.source_dir)
shutil.rmtree(pj(neutralEnv('source_dir'), self.source_dir, 'source', 'data'))
extract_archive(
pj(neutralEnv('archive_dir'), self.archive_data.name),
pj(neutralEnv('source_dir'), self.source_dir, 'source'),
topdir='data',
name='data'
)
patches = [
"icu4c_fix_static_lib_name_mingw.patch",
# "icu4c_android_elf64_st_info.patch",
@ -49,3 +74,6 @@ class Icu(Dependency):
if platformInfo.build in ('android', 'wasm'):
options += " --with-data-packaging=archive"
return options
def set_env(self, env):
env['ICU_DATA_FILTER_FILE'] = pj(os.path.dirname(os.path.realpath(__file__)), "icu4c_data_filter.json")

View File

@ -0,0 +1,14 @@
{
"strategy": "additive",
"featureFilters": {
"lang_tree": "include",
"locales_tree": "include",
"translit": "include",
"misc": {
"includelist": [
"likelySubtags",
"metadata"
]
}
}
}

View File

@ -39,7 +39,7 @@ release_versions = {
# This is the "version" of the whole base_deps_versions dict.
# Change this when you change base_deps_versions.
base_deps_meta_version = '93'
base_deps_meta_version = '94'
base_deps_versions = {
'zlib' : '1.2.12',