Build icu4c using meson on Windows.

This commit is contained in:
Matthieu Gautier 2023-11-29 14:42:03 +01:00
parent 765f2fa2d7
commit a2f659895e
1 changed files with 80 additions and 63 deletions

View File

@ -1,27 +1,32 @@
from .base import Dependency, ReleaseDownload, MakeBuilder
from .base import (
Dependency,
ReleaseDownload,
MakeBuilder, MesonBuilder
)
from kiwixbuild.utils import pj, SkipCommand, Remotefile, extract_archive
from kiwixbuild._global import get_target_step, neutralEnv
import os, shutil
import fileinput
import platform
class Icu(Dependency):
name = "icu4c"
class Source(ReleaseDownload):
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",
)
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')
meson_patch = Remotefile('icu_73.2-2_patch.zip',
'',
'https://wrapdb.mesonbuild.com/v2/icu_73.2-2/get_patch')
archives = [archive_src, archive_data]
archives = [archive_src, archive_data, meson_patch]
def _extract(self, context):
context.try_skip(self.extract_path)
@ -42,6 +47,12 @@ class Icu(Dependency):
topdir="data",
name="data",
)
extract_archive(
pj(neutralEnv('archive_dir'), self.meson_patch.name),
neutralEnv('source_dir'),
topdir='icu',
name= self.source_dir
)
patches = [
"icu4c_fix_static_lib_name_mingw.patch",
@ -53,6 +64,12 @@ class Icu(Dependency):
"icu4c_wasm.patch",
]
if platform.system() == 'Windows':
class Builder(MesonBuilder):
def set_env(self, env):
env['ICU_DATA_FILTER_FILE'] = pj(os.path.dirname(os.path.realpath(__file__)), "icu4c_data_filter.json")
else:
class Builder(MakeBuilder):
subsource_dir = "source"
make_install_targets = ["install"]