initial mips platform support, import from issue 48
The target mips32r2_dyn is tested to fully compile, but untested to run. Target mips32r2_static reaches kiwix-lib and fails linking pthread. For further details see the comments in #48. Some known problems: * hardcoded values of icudt58l in some dependent packages unnoticable during compile, but will affect runtimes * the libdir name problem x86_64-linux-gnu <> mips-linux-gnu * pthread linking problem when compiling kiwix-lib statically may be a meson issue, since it somewhat claims to properly handle pthread linking in cross-compile situations; there are some url links in #48 laying out a proper workaround.
This commit is contained in:
parent
d0ecf70284
commit
c1f281eedf
|
@ -20,7 +20,8 @@ class Icu(Dependency):
|
||||||
"icu4c_custom_data.patch",
|
"icu4c_custom_data.patch",
|
||||||
"icu4c_noxlocale.patch",
|
"icu4c_noxlocale.patch",
|
||||||
"icu4c_rpath.patch",
|
"icu4c_rpath.patch",
|
||||||
"icu4c_build_config.patch"]
|
"icu4c_build_config.patch",
|
||||||
|
"icu4c_run_tools_w_qemu_if_endianess_differs.patch"]
|
||||||
|
|
||||||
|
|
||||||
class Builder(MakeBuilder):
|
class Builder(MakeBuilder):
|
||||||
|
@ -41,8 +42,10 @@ class Icu(Dependency):
|
||||||
icu_native_builder = get_target_step(
|
icu_native_builder = get_target_step(
|
||||||
'icu4c',
|
'icu4c',
|
||||||
'native_static' if platformInfo.static else 'native_dyn')
|
'native_static' if platformInfo.static else 'native_dyn')
|
||||||
options += " --with-cross-build={} --disable-tools".format(
|
options += " --with-cross-build={}".format(
|
||||||
icu_native_builder.build_path)
|
icu_native_builder.build_path)
|
||||||
|
if platformInfo.build == 'iOS':
|
||||||
|
options += " --disable-tools"
|
||||||
if platformInfo.build == 'android':
|
if platformInfo.build == 'android':
|
||||||
options += " --with-data-packaging=archive"
|
options += " --with-data-packaging=archive"
|
||||||
return options
|
return options
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
diff -ur icu4c/source/data/Makefile.in icu4c.patched/source/data/Makefile.in
|
||||||
|
--- icu4c/source/data/Makefile.in 2018-06-17 03:28:46.646446362 +0200
|
||||||
|
+++ icu4c.patched/source/data/Makefile.in 2018-06-17 03:30:44.072860064 +0200
|
||||||
|
@@ -577,9 +577,9 @@
|
||||||
|
# There must be a nicer way to do this.
|
||||||
|
|
||||||
|
$(CFU_FILES): $(ALL_CFU_SOURCE) $(TOOLBINDIR)/gencfu$(TOOLEXEEXT) $(DAT_FILES)
|
||||||
|
- $(INVOKE) echo ALL_CFU_SOURCE: $(ALL_CFU_SOURCE)
|
||||||
|
- $(INVOKE) echo CFU_FILES: $(CFU_FILES)
|
||||||
|
- $(INVOKE) echo CFU_FILES_SHORT: $(CFU_FILES_SHORT)
|
||||||
|
+ echo ALL_CFU_SOURCE: $(ALL_CFU_SOURCE)
|
||||||
|
+ echo CFU_FILES: $(CFU_FILES)
|
||||||
|
+ echo CFU_FILES_SHORT: $(CFU_FILES_SHORT)
|
||||||
|
$(INVOKE) $(TOOLBINDIR)/gencfu -c -i $(BUILDDIR) -r $(word 1,$(ALL_CFU_SOURCE)) -w $(word 2,$(ALL_CFU_SOURCE)) -o $@
|
||||||
|
|
||||||
|
|
||||||
|
diff -ur icu4c/source/Makefile.in icu4c.patched/source/Makefile.in
|
||||||
|
--- icu4c/source/Makefile.in 2018-06-17 03:28:45.222465606 +0200
|
||||||
|
+++ icu4c.patched/source/Makefile.in 2018-06-17 03:29:33.757809798 +0200
|
||||||
|
@@ -243,9 +243,20 @@
|
||||||
|
@(echo "CROSS_ICU_VERSION=$(VERSION)" ;\
|
||||||
|
echo "TOOLEXEEXT=$(EXEEXT)" \
|
||||||
|
) > $@
|
||||||
|
- @(echo 'TOOLBINDIR=$$(cross_buildroot)/bin' ;\
|
||||||
|
+ @(echo '' ;\
|
||||||
|
+ echo 'ifneq ($$(ICUDATA_PLATFORM_NAME),$(ICUDATA_PLATFORM_NAME))' ;\
|
||||||
|
+ echo 'cross_buildroot=$$(top_builddir)' ;\
|
||||||
|
+ echo 'endif' ;\
|
||||||
|
+ echo '' ;\
|
||||||
|
+ echo 'TOOLBINDIR=$$(cross_buildroot)/bin' ;\
|
||||||
|
echo 'TOOLLIBDIR=$$(cross_buildroot)/lib' ;\
|
||||||
|
echo "INVOKE=$(LDLIBRARYPATH_ENVVAR)=$(LIBRARY_PATH_PREFIX)"'$$(TOOLLIBDIR):$$(cross_buildroot)/stubdata:$$(cross_buildroot)/tools/ctestfw:$$$$'"$(LDLIBRARYPATH_ENVVAR)" ;\
|
||||||
|
echo "PKGDATA_INVOKE=$(LDLIBRARYPATH_ENVVAR)=$(LIBRARY_PATH_PREFIX)"'$$(cross_buildroot)/stubdata:$$(cross_buildroot)/tools/ctestfw:$$(TOOLLIBDIR):$$$$'"$(LDLIBRARYPATH_ENVVAR) " ;\
|
||||||
|
+ echo '' ;\
|
||||||
|
+ echo 'ifneq ($$(ICUDATA_PLATFORM_NAME),$(ICUDATA_PLATFORM_NAME))' ;\
|
||||||
|
+ echo 'export QEMU_SET_ENV:=$$(strip $$(subst $$$$'"$(LDLIBRARYPATH_ENVVAR)"',,$$(INVOKE)))$$(strip $$(subst LD_LIBRARY_PATH=,,$$(QEMU_SET_ENV)))' ;\
|
||||||
|
+ echo '$$(eval $$(shell grep host_cpu $$(top_builddir)/config/Makefile.inc))' ;\
|
||||||
|
+ echo 'INVOKE=qemu-$$(host_cpu)-static' ;\
|
||||||
|
+ echo 'endif' ;\
|
||||||
|
echo ) >> $@
|
||||||
|
|
||||||
|
config/icucross.inc: $(top_builddir)/icudefs.mk $(top_builddir)/Makefile @platform_make_fragment@
|
|
@ -6,6 +6,7 @@ from . import (
|
||||||
armhf,
|
armhf,
|
||||||
i586,
|
i586,
|
||||||
ios,
|
ios,
|
||||||
|
mips32r2,
|
||||||
native,
|
native,
|
||||||
neutral,
|
neutral,
|
||||||
win32
|
win32
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
from .base import PlatformInfo
|
||||||
|
|
||||||
|
from kiwixbuild.utils import pj
|
||||||
|
from kiwixbuild._global import get_target_step
|
||||||
|
|
||||||
|
|
||||||
|
class MIPS32R2PlatformInfo(PlatformInfo):
|
||||||
|
build = 'mips'
|
||||||
|
arch_full = 'mips-linux-gnu'
|
||||||
|
compatible_hosts = ['fedora', 'debian']
|
||||||
|
|
||||||
|
def get_cross_config(self):
|
||||||
|
return {
|
||||||
|
'binaries': self.binaries,
|
||||||
|
'exec_wrapper_def': '',
|
||||||
|
'root_path': self.root_path,
|
||||||
|
'extra_libs': [],
|
||||||
|
'extra_cflags': [],
|
||||||
|
'host_machine': {
|
||||||
|
'system': 'linux',
|
||||||
|
'lsystem': 'linux',
|
||||||
|
'cpu_family': 'mips32r2',
|
||||||
|
'cpu': '24kc',
|
||||||
|
'endian': 'big',
|
||||||
|
'abi': ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def root_path(self):
|
||||||
|
return '/usr/mips-linux-gnu'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def binaries(self):
|
||||||
|
binaries = ((k,'{}-{}'.format(self.arch_full, v))
|
||||||
|
for k, v in (('CC', 'gcc'),
|
||||||
|
('CXX', 'g++'),
|
||||||
|
('AR', 'ar'),
|
||||||
|
('STRIP', 'strip'),
|
||||||
|
('WINDRES', 'windres'),
|
||||||
|
('RANLIB', 'ranlib'),
|
||||||
|
('LD', 'ld'))
|
||||||
|
)
|
||||||
|
return {k:pj('/usr', 'bin', v)
|
||||||
|
for k,v in binaries}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def exec_wrapper_def(self):
|
||||||
|
try:
|
||||||
|
which('qemu-mips-static')
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
return ""
|
||||||
|
else:
|
||||||
|
return "exec_wrapper = 'qemu-mips-static'"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def configure_option(self):
|
||||||
|
return '--host={}'.format(self.arch_full)
|
||||||
|
|
||||||
|
def get_bin_dir(self):
|
||||||
|
return [pj(self.root_path, 'bin')]
|
||||||
|
|
||||||
|
def set_env(self, env):
|
||||||
|
env['PKG_CONFIG_LIBDIR'] = pj(self.root_path, 'lib', 'pkgconfig')
|
||||||
|
# soft float is another abi and thus unsupported by current maintained (apt-get'able) debian/ubuntu tcs,
|
||||||
|
# additionally these are (gnu) libc only; if uclibc is needed, see https://buildroot.org/downloads/ and
|
||||||
|
# make a toolchain and rootfs, then checkout and use kiwixbuild --target_platform native_* within chroot env
|
||||||
|
# (it needs qemu-mips-static from host copied to rootfs/usr/bin, in order to chroot into using a non-mips-host)
|
||||||
|
#env['CFLAGS'] = " -march=mips32r2 -mtune=24kc -msoft-float "+env['CFLAGS']
|
||||||
|
#env['CXXFLAGS'] = " -march=mips32r2 -mtune=24kc -msoft-float "+env['CXXFLAGS']
|
||||||
|
env['CFLAGS'] = " -march=mips32r2 -mtune=24kc "+env['CFLAGS']
|
||||||
|
env['CXXFLAGS'] = " -march=mips32r2 -mtune=24kc "+env['CXXFLAGS']
|
||||||
|
env['QEMU_LD_PREFIX'] = pj(self.root_path)
|
||||||
|
env['QEMU_SET_ENV'] = "LD_LIBRARY_PATH={}".format(
|
||||||
|
':'.join([
|
||||||
|
pj(self.root_path, "lib"),
|
||||||
|
env['LD_LIBRARY_PATH']
|
||||||
|
]))
|
||||||
|
|
||||||
|
def set_compiler(self, env):
|
||||||
|
env['CC'] = self.binaries['CC']
|
||||||
|
env['CXX'] = self.binaries['CXX']
|
||||||
|
|
||||||
|
def finalize_setup(self):
|
||||||
|
super().finalize_setup()
|
||||||
|
self.buildEnv.cmake_crossfile = self._gen_crossfile('cmake_cross_file.txt')
|
||||||
|
self.buildEnv.meson_crossfile = self._gen_crossfile('meson_cross_file.txt')
|
||||||
|
|
||||||
|
class MIPS32R2Dyn(MIPS32R2PlatformInfo):
|
||||||
|
name = 'mips32r2_dyn'
|
||||||
|
static = False
|
||||||
|
|
||||||
|
class MIPS32R2Static(MIPS32R2PlatformInfo):
|
||||||
|
name = 'mips32r2_static'
|
||||||
|
static = True
|
Loading…
Reference in New Issue