Skip to content

Commit

Permalink
Use custom data.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mgautierfr committed Nov 2, 2023
1 parent 717dcd8 commit beadc3b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 6 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include kiwixbuild/templates/*_cross_file.txt
include kiwixbuild/patches/*.patch
include kiwixbuild/dependencies/icu4c_data_filter.json
38 changes: 33 additions & 5 deletions kiwixbuild/dependencies/icu4c.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,41 @@
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",
Expand Down Expand Up @@ -49,3 +74,6 @@ def configure_option(self):
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")
14 changes: 14 additions & 0 deletions kiwixbuild/dependencies/icu4c_data_filter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"strategy": "additive",
"featureFilters": {
"lang_tree": "include",
"locales_tree": "include",
"translit": "include",
"misc": {
"includelist": [
"likelySubtags",
"metadata"
]
}
}
}
2 changes: 1 addition & 1 deletion kiwixbuild/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

# 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',
Expand Down

0 comments on commit beadc3b

Please sign in to comment.