diff --git a/kiwixbuild/platforms/ios.py b/kiwixbuild/platforms/ios.py index 7c94a27..75f1070 100644 --- a/kiwixbuild/platforms/ios.py +++ b/kiwixbuild/platforms/ios.py @@ -9,6 +9,7 @@ class iOSPlatformInfo(PlatformInfo): build = 'iOS' static = True compatible_hosts = ['Darwin'] + min_iphoneos_version = '9.0' def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -17,7 +18,7 @@ class iOSPlatformInfo(PlatformInfo): @property def root_path(self): if self._root_path is None: - command = "xcodebuild -version -sdk {} | grep -E '^Path' | sed 's/Path: //'".format(self.sdk_name) + command = "xcrun --sdk {} --show-sdk-path".format(self.sdk_name) self._root_path = subprocess.check_output(command, shell=True)[:-1].decode() return self._root_path @@ -34,8 +35,8 @@ class iOSPlatformInfo(PlatformInfo): 'root_path': self.root_path, 'binaries': self.binaries, 'exe_wrapper_def': '', - 'extra_libs': ['-fembed-bitcode', '-isysroot', self.root_path, '-arch', self.arch, '-miphoneos-version-min=9.0', '-stdlib=libc++'], - 'extra_cflags': ['-fembed-bitcode', '-isysroot', self.root_path, '-arch', self.arch, '-miphoneos-version-min=9.0', '-stdlib=libc++', '-I{}'.format(pj(self.buildEnv.install_dir, 'include'))], + 'extra_libs': ['-fembed-bitcode', '-isysroot', self.root_path, '-arch', self.arch, '-miphoneos-version-min={}'.format(self.min_iphoneos_version), '-stdlib=libc++'], + 'extra_cflags': ['-fembed-bitcode', '-isysroot', self.root_path, '-arch', self.arch, '-miphoneos-version-min={}'.format(self.min_iphoneos_version), '-stdlib=libc++', '-I{}'.format(pj(self.buildEnv.install_dir, 'include'))], 'host_machine': { 'system': 'Darwin', 'lsystem': 'darwin', @@ -47,7 +48,7 @@ class iOSPlatformInfo(PlatformInfo): } def set_env(self, env): - env['CFLAGS'] = " -fembed-bitcode -isysroot {SDKROOT} -arch {arch} -miphoneos-version-min=9.0 ".format(SDKROOT=self.root_path, arch=self.arch) + env['CFLAGS'] + env['CFLAGS'] = " -fembed-bitcode -isysroot {SDKROOT} -arch {arch} -miphoneos-version-min={min_iphoneos_version} ".format(SDKROOT=self.root_path, min_iphoneos_version=self.min_iphoneos_version, arch=self.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=self.arch) env['MACOSX_DEPLOYMENT_TARGET'] = "10.10" @@ -60,10 +61,10 @@ class iOSPlatformInfo(PlatformInfo): 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', + 'AR': xrun_find('ar'), + 'STRIP': xrun_find('strip'), + 'RANLIB': xrun_find('ranlib'), + 'LD': xrun_find('ld'), 'PKGCONFIG': 'pkg-config', }