summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorThibault Saunier <thibault.saunier@collabora.com>2013-01-21 11:19:29 -0300
committerAndoni Morales Alastruey <ylatuya@gmail.com>2013-02-22 22:22:39 +0100
commit5dbecff03922ef0ee326e8a8dbc5dc1b313a1459 (patch)
tree3b0706e7888299dce607c233e8230beb7a1ce153 /config
parent8a153a3d8057a9c316e3b159b512f34efcbbffa8 (diff)
Add support to iOS
Diffstat (limited to 'config')
-rw-r--r--config/cross-ios-arm7.cbc8
-rw-r--r--config/cross-ios-x86.cbc8
-rw-r--r--config/ios.config67
3 files changed, 83 insertions, 0 deletions
diff --git a/config/cross-ios-arm7.cbc b/config/cross-ios-arm7.cbc
new file mode 100644
index 0000000..93f1d76
--- /dev/null
+++ b/config/cross-ios-arm7.cbc
@@ -0,0 +1,8 @@
+from cerbero.config import Platform, Architecture, Distro, DistroVersion
+
+target_platform=Platform.IOS
+target_arch=Architecture.ARMv7
+target_distro=Distro.IOS
+target_distro_version=DistroVersion.IOS_6_0
+host='arm-apple-darwin'
+platform='iPhoneOS'
diff --git a/config/cross-ios-x86.cbc b/config/cross-ios-x86.cbc
new file mode 100644
index 0000000..5b31f9b
--- /dev/null
+++ b/config/cross-ios-x86.cbc
@@ -0,0 +1,8 @@
+from cerbero.config import Platform, Architecture, Distro, DistroVersion
+
+target_platform=Platform.IOS
+target_arch=Architecture.X86
+target_distro=Distro.IOS
+target_distro_version=DistroVersion.IOS_6_0
+host='i386-apple-darwin'
+platform='iPhoneSimulator'
diff --git a/config/ios.config b/config/ios.config
new file mode 100644
index 0000000..754a376
--- /dev/null
+++ b/config/ios.config
@@ -0,0 +1,67 @@
+# This file contains the default configuration to compile for iPhoneOS
+# platforms. It contains sensitive enviroment configuration that
+# shouldn't be modified unless you know what you are doing.
+# PLEASE, DO NOT EDIT THIS FILE
+
+import os
+from cerbero.utils import shell
+from cerbero.config import Architecture, DistroVersion
+
+# We don't want anything from macports detected in configure and
+# used later. System libs are passed through the -isysroot option
+allow_system_libs=False
+
+min_version='6.0'
+
+if target_distro_version == DistroVersion.IOS_6_0:
+ v = '6.0'
+ v1 = '60'
+else:
+ raise FatalError("Distro version %s not supported" %(target_distro_version))
+
+# For Xcode >= 4.3, the SDK is installed in a completely different path
+# FIXME This has not been tested, we should check what is the iOS toolchain path
+# for xcode 4.3
+sysroot = '/Developer/SDKs/%s%s.sdk' % (platform, v)
+if not os.path.exists(sysroot):
+ iphone_platform = '/Applications/Xcode.app/Contents/Developer/Platforms/%s.platform/Developer' %platform
+ sysroot = os.path.join(iphone_platform, 'SDKs', '%s%s.sdk' %(platform, v))
+
+ccache = use_ccache and 'ccache ' or ''
+extra_cflags=''
+if target_arch == Architecture.ARMv7:
+ str_arch = ' armv7'
+elif target_arch == Architecture.ARM:
+ str_arch = ' armv6'
+elif target_arch == Architecture.X86:
+ str_arch = ' i386 '
+ extra_cflags='-D__IPHONE_OS_VERSION_MIN_REQUIRED=%s0000' %v1
+else:
+ raise FatalError("Arch not supported")
+
+# Toolchain environment
+os.environ['CC']= os.path.join(iphone_platform, 'usr', 'bin', 'llvm-gcc-4.2')
+os.environ['CFLAGS'] = '-arch %s -isysroot %s -miphoneos-version-min=%s %s' %(str_arch, sysroot, min_version, extra_cflags)
+os.environ['LDFLAGS'] = '-arch %s -isysroot %s -Wl,-iphoneos_version_min,%s -Wl,-undefined,error -Wl,-headerpad_max_install_names' %(str_arch, sysroot, min_version)
+os.environ['OBJC'] = os.environ['CC']
+
+os.environ['CXX']= os.path.join(iphone_platform, 'usr', 'bin', 'llvm-g++-4.2')
+os.environ['CPP']= os.path.join(iphone_platform, 'usr', 'bin', 'llvm-cpp-4.2')
+os.environ['CXXPP']= os.environ['CPP']
+#os.environ['CPPFLAGS'] = '-arch armv7 -isysroot %s' %(sysroot)
+os.environ['CXXFLAGS'] = os.environ['CFLAGS']
+
+
+if platform == "iPhoneOS":
+ simulator_headers = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator%s.sdk/usr/include' % v
+ for missing_header in ["bzlib.h", "crt_externs.h"]:
+ missing_path = os.path.join(sysroot, "usr", "include", missing_header)
+ if not os.path.lexists(missing_path):
+ # FIXME This is not smart especially as we need to sudo
+ print "We need to create a syslink between %s and %s as they are missing in the device SDK" %(os.path.join(simulator_headers, missing_header), missing_path)
+ shell.call("sudo ln -s %s %s" %(os.path.join(simulator_headers, missing_header), missing_path))
+
+
+if use_ccache:
+ os.environ['CC'] += 'ccache gcc'
+ os.environ['CXX'] += 'ccache g++'