Correctly build ICU data when building for wasm.
When we use `--disable-tools` (ie, when we are cross-compiling), ICU will build the data only if it detects we are cross-compiling. This make sens until we cross-compiling for wasm. Wasm output is a script file with the interpreter in the sdk we have installed. So ICU's configure can run the test binary and so doesn't detect we are cross-compiling. So we have to patch ICU Makefile to make it build the ICU data anyway.
This commit is contained in:
parent
beadc3b16c
commit
2a5a5c3a42
|
@ -283,6 +283,8 @@ class Builder:
|
|||
if hasattr(self, '_pre_build_script'):
|
||||
self.command('pre_build_script', self._pre_build_script)
|
||||
self.command('configure', self._configure)
|
||||
if hasattr(self, '_post_configure_script'):
|
||||
self.command('post_configure_script', self._post_configure_script)
|
||||
self.command('compile', self._compile)
|
||||
if hasattr(self, '_test'):
|
||||
self.command('test', self._test)
|
||||
|
|
|
@ -7,6 +7,7 @@ from .base import (
|
|||
from kiwixbuild.utils import pj, SkipCommand, Remotefile, extract_archive
|
||||
from kiwixbuild._global import get_target_step, neutralEnv
|
||||
import os, shutil
|
||||
import fileinput
|
||||
|
||||
class Icu(Dependency):
|
||||
name = "icu4c"
|
||||
|
@ -77,3 +78,13 @@ class Icu(Dependency):
|
|||
|
||||
def set_env(self, env):
|
||||
env['ICU_DATA_FILTER_FILE'] = pj(os.path.dirname(os.path.realpath(__file__)), "icu4c_data_filter.json")
|
||||
|
||||
def _post_configure_script(self, context):
|
||||
if self.buildEnv.platformInfo.build != "wasm":
|
||||
context.skip()
|
||||
context.try_skip(self.build_path)
|
||||
for line in fileinput.input(pj(self.build_path, 'Makefile'), inplace=True):
|
||||
if line == "#DATASUBDIR = data\n":
|
||||
print("DATASUBDIR = data")
|
||||
else:
|
||||
print(line, end="")
|
||||
|
|
|
@ -189,6 +189,9 @@ class Context:
|
|||
self.autoskip_file = None
|
||||
self.no_skip = False
|
||||
|
||||
def skip(self, msg=""):
|
||||
raise SkipCommand(msg)
|
||||
|
||||
def try_skip(self, path, extra_name=""):
|
||||
if self.no_skip:
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue