diff --git a/kiwixbuild/__init__.py b/kiwixbuild/__init__.py index 8711e56..2c778a4 100644 --- a/kiwixbuild/__init__.py +++ b/kiwixbuild/__init__.py @@ -132,11 +132,6 @@ PACKAGE_NAME_MAPPERS = { }, } -def xrun_find(name): - command = "xcrun -find {}".format(name) - output = subprocess.check_output(command, shell=True) - return output[:-1].decode() - class BuildEnv: def __init__(self, options, targetsDict): self.source_dir = pj(options.working_dir, "SOURCE") @@ -445,41 +440,6 @@ class BuildEnv: pass -class iOS_sdk(Toolchain): - @property - def root_path(self): - return self.buildEnv.platform_info.root_path - - @property - def binaries(self): - return { - 'CC': xrun_find('clang'), - 'CXX': xrun_find('clang++'), - 'AR': '/usr/bin/ar', - 'STRIP': '/usr/bin/strip', - 'RANLIB': '/usr/bin/ranlib', - 'LD': '/usr/bin/ld', - } - - @property - def configure_option(self): - return '--host=arm-apple-darwin' - - def get_bin_dir(self): - return [pj(self.root_path, 'bin')] - - def set_env(self, env): - arch = self.buildEnv.platform_info.arch - env['CFLAGS'] = " -fembed-bitcode -isysroot {SDKROOT} -arch {arch} -miphoneos-version-min=9.0 ".format(SDKROOT=self.root_path, arch=arch) + env['CFLAGS'] - env['CXXFLAGS'] = env['CFLAGS'] + " -stdlib=libc++ -std=c++11 "+env['CXXFLAGS'] - env['LDFLAGS'] = " -arch {arch} -isysroot {SDKROOT} ".format(SDKROOT=self.root_path, arch=arch) - env['MACOSX_DEPLOYMENT_TARGET'] = "10.7" - - def set_compiler(self, env): - env['CC'] = self.binaries['CC'] - env['CXX'] = self.binaries['CXX'] - - class Builder: def __init__(self, options): self.options = options diff --git a/kiwixbuild/toolchains/ios.py b/kiwixbuild/toolchains/ios.py index 16dd655..d3f7309 100644 --- a/kiwixbuild/toolchains/ios.py +++ b/kiwixbuild/toolchains/ios.py @@ -1,4 +1,37 @@ from .base_toolchain import Toolchain +from kiwixbuild.utils import pj, xrun_find + class iOS_sdk(Toolchain): - pass + @property + def root_path(self): + return self.buildEnv.platform_info.root_path + + @property + def binaries(self): + return { + 'CC': xrun_find('clang'), + 'CXX': xrun_find('clang++'), + 'AR': '/usr/bin/ar', + 'STRIP': '/usr/bin/strip', + 'RANLIB': '/usr/bin/ranlib', + 'LD': '/usr/bin/ld', + } + + @property + def configure_option(self): + return '--host=arm-apple-darwin' + + def get_bin_dir(self): + return [pj(self.root_path, 'bin')] + + def set_env(self, env): + arch = self.buildEnv.platform_info.arch + env['CFLAGS'] = " -fembed-bitcode -isysroot {SDKROOT} -arch {arch} -miphoneos-version-min=9.0 ".format(SDKROOT=self.root_path, arch=arch) + env['CFLAGS'] + env['CXXFLAGS'] = env['CFLAGS'] + " -stdlib=libc++ -std=c++11 "+env['CXXFLAGS'] + env['LDFLAGS'] = " -arch {arch} -isysroot {SDKROOT} ".format(SDKROOT=self.root_path, arch=arch) + env['MACOSX_DEPLOYMENT_TARGET'] = "10.7" + + def set_compiler(self, env): + env['CC'] = self.binaries['CC'] + env['CXX'] = self.binaries['CXX'] diff --git a/kiwixbuild/utils.py b/kiwixbuild/utils.py index a194da7..c0cf603 100644 --- a/kiwixbuild/utils.py +++ b/kiwixbuild/utils.py @@ -21,6 +21,11 @@ def which(name): output = subprocess.check_output(command, shell=True) return output[:-1].decode() +def xrun_find(name): + command = "xcrun -find {}".format(name) + output = subprocess.check_output(command, shell=True) + return output[:-1].decode() + def setup_print_progress(print_progress): global g_print_progress