Merge pull request #145 from kiwix/i586

I586
This commit is contained in:
Matthieu Gautier 2018-04-09 11:49:45 +02:00 committed by GitHub
commit ee11333249
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 134 additions and 27 deletions

View File

@ -46,6 +46,8 @@ env:
- PLATFORM="win32_static"
- PLATFORM="armhf_dyn"
- PLATFORM="armhf_static"
- PLATFORM="i586_dyn"
- PLATFORM="i586_static"
- PLATFORM="android_arm"
- PLATFORM="android_arm64"
- PLATFORM="android_mips"
@ -90,3 +92,7 @@ addons:
- mingw-w64-tools
- default-jdk
- autopoint
- libc6-dev:i386
- libstdc++-6-dev:i386
- gcc-5-multilib
- g++-5-multilib

View File

@ -1,4 +1,5 @@
include kiwixbuild/templates/cmake_cross_file.txt
include kiwixbuild/templates/meson_cross_file.txt
include kiwixbuild/templates/cmake_android_cross_file.txt
include kiwixbuild/templates/cmake_i586_cross_file.txt
include kiwixbuild/patches/*.patch

View File

@ -52,6 +52,12 @@ PACKAGE_NAME_MAPPERS = {
'lzma': ['xz-devel', 'xz-static']
# Either there is no packages, or no static or too old
},
'fedora_i586_dyn': {
'COMMON': _fedora_common + ['glibc-devel.i686', 'libstdc++-devel.i686'],
},
'fedora_i586_static': {
'COMMON': _fedora_common + ['glibc-devel.i686'],
},
'fedora_win32_dyn': {
'COMMON': _fedora_common + ['mingw32-gcc-c++', 'mingw32-bzip2', 'mingw32-win-iconv', 'mingw32-winpthreads', 'wine'],
'zlib': ['mingw32-zlib'],
@ -89,6 +95,12 @@ PACKAGE_NAME_MAPPERS = {
'ctpp2': ['libctpp2-dev'],
'ctpp2c': ['ctpp2-utils'],
},
'debian_i586_dyn': {
'COMMON': _debian_common + ['libc6-dev:i386', 'libstdc++-6-dev:i386', 'gcc-multilib', 'g++-multilib', 'libxml2-dev:i386', 'libsqlite3-dev:i386'],
},
'debian_i586_static': {
'COMMON': _debian_common + ['libc6-dev:i386', 'libstdc++-6-dev:i386', 'gcc-multilib', 'g++-multilib', 'libxml2-dev:i386', 'libsqlite3-dev:i386'],
},
'debian_win32_dyn': {
'COMMON': _debian_common + ['g++-mingw-w64-i686', 'gcc-mingw-w64-i686', 'gcc-mingw-w64-base', 'mingw-w64-tools'],
'ctpp2c': ['ctpp2-utils'],
@ -162,6 +174,19 @@ class TargetInfo:
'abi': ''
}
}
elif self.build == 'i586':
return {
'extra_libs': ['-m32', '-march=i586'],
'extra_cflags': ['-m32', '-march=i586'],
'host_machine': {
'system': 'linux',
'lsystem': 'linux',
'cpu_family': 'x86',
'cpu': 'i586',
'endian': 'little',
'abi': ''
}
}
class AndroidTargetInfo(TargetInfo):
__arch_infos = {
@ -209,6 +234,10 @@ class BuildEnv:
hosts=['fedora', 'debian', 'Darwin']),
'native_static': TargetInfo('native', True, [],
hosts=['fedora', 'debian']),
'i586_dyn': TargetInfo('i586', False, ['linux_i586_toolchain'],
hosts=['fedora', 'debian']),
'i586_static': TargetInfo('i586', True, ['linux_i586_toolchain'],
hosts=['fedora', 'debian']),
'win32_dyn': TargetInfo('win32', False, ['mingw32_toolchain'],
hosts=['fedora', 'debian']),
'win32_static': TargetInfo('win32', True, ['mingw32_toolchain'],
@ -332,6 +361,10 @@ class BuildEnv:
def setup_iOS(self):
pass
def setup_i586(self):
self.cmake_crossfile = self._gen_crossfile('cmake_i586_cross_file.txt')
self.meson_crossfile = self._gen_crossfile('meson_cross_file.txt')
def __getattr__(self, name):
return getattr(self.options, name)
@ -543,6 +576,9 @@ class Builder:
dependencies = self.order_dependencies(_targets, targetDef)
dependencies = list(remove_duplicates(dependencies))
if options.build_nodeps:
self.targets[targetDef] = _targets[targetDef]
else:
for dep in dependencies:
if self.options.build_deps_only and dep == targetDef:
continue
@ -633,6 +669,8 @@ def parse_args():
help="Skip the source download part")
parser.add_argument('--build-deps-only', action='store_true',
help="Build only the dependencies of the specified targets.")
parser.add_argument('--build-nodeps', action='store_true',
help="Build only the target, not its dependencies.")
parser.add_argument('--make-dist', action='store_true',
help="Build distrubution (dist) source archive")
parser.add_argument('--make-release', action='store_true',

View File

@ -147,7 +147,7 @@ class CTPP2(Dependency):
]
class Builder(CMakeBuilder):
configure_option = "-DMD5_SUPPORT=OFF"
configure_option = "-DMD5_SUPPORT=OFF -DICONV_SUPPORT=OFF"
class CTPP2C(CTPP2):

View File

@ -0,0 +1,18 @@
SET(CMAKE_SYSTEM_NAME {host_machine[system]})
SET(CMAKE_SYSTEM_PROCESSOR {host_machine[cpu_family]})
# specify the cross compiler
SET(CMAKE_C_COMPILER "{toolchain.binaries[CC]}")
SET(CMAKE_CXX_COMPILER "{toolchain.binaries[CXX]}")
SET(C_FLAGS "-m32 -march=i586")
SET(CXX_FLAGS "-m32 -march=i586")
SET(CMAKE_LD_FLAGS "-m32 -march=i586")
SET(CMAKE_AR:FILEPATH {toolchain.binaries[AR]})
SET(CMAKE_RANLIB:FILEPATH {toolchain.binaries[RANLIB]})
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)

View File

@ -1,4 +1,4 @@
from . import android_ndk, android_sdk, armhf, ios, mingw32
from . import android_ndk, android_sdk, armhf, ios, mingw32, linux_i586
from .base_toolchain import Toolchain

View File

@ -0,0 +1,38 @@
import os
import subprocess
from .base_toolchain import Toolchain
from kiwixbuild.dependency_utils import GitClone
from kiwixbuild.utils import Remotefile, which
pj = os.path.join
class linux_i586_toolchain(Toolchain):
name = 'linux_i586'
arch_full = 'i586-linux-gnu'
@property
def configure_option(self):
return '--host={}'.format(self.arch_full)
@property
def binaries(self):
return {k:which(v)
for k, v in (('CC', os.environ.get('CC', 'gcc')),
('CXX', os.environ.get('CXX', 'g++')),
('AR', 'ar'),
('STRIP', 'strip'),
('RANLIB', 'ranlib'),
('LD', 'ld'))
}
@property
def configure_option(self):
return '--host={}'.format(self.arch_full)
def set_env(self, env):
env['CFLAGS'] = "-m32 -march=i586 "+env['CFLAGS']
env['CXXFLAGS'] = "-m32 -march=i586 "+env['CXXFLAGS']
env['LDFLAGS'] = "-m32 -march=i586 "+env['LDFLAGS']
def get_bin_dir(self):
return []

View File

@ -101,6 +101,7 @@ def download_remote(what, where, check_certificate=True):
batch_size = 1024 * 8
extra_args = {'context':context} if sys.version_info >= (3, 4, 3) else {}
progress_chars = "/-\|"
try:
with urllib.request.urlopen(file_url, **extra_args) as resource, open(file_path, 'wb') as file:
tsize = resource.getheader('Content-Length', None)
if tsize is not None:
@ -117,6 +118,9 @@ def download_remote(what, where, check_certificate=True):
print_progress(progress_chars[current])
current = (current+1)%4
file.write(batch)
except urllib.error.HTTPError:
print("Cannot download url {}".format(file_url))
raise StopBuild()
if not what.sha256:
print('Sha256 for {} not set, do no verify download'.format(what.name))

View File

@ -255,6 +255,8 @@ elif PLATFORM == 'win32_static':
make_archive('kiwix-tools', 'win32')
elif PLATFORM == 'armhf_static':
make_archive('kiwix-tools', 'armhf')
elif PLATFORM == 'i586_static':
make_archive('kiwix-tools', 'i586')
elif PLATFORM.startswith('android_') and 'kiwix-android' in TARGETS:
APK_NAME = "kiwix-{}".format(PLATFORM)
source_debug_dir = BASE_DIR/'kiwix-android'/'app'/'build'/'outputs'/'apk'/'kiwix'/'debug'