summaryrefslogtreecommitdiff
path: root/config/ios.config
blob: 0d103440e3644a12bc84d9d2d60e05f7563f5316 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# 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
from cerbero.errors import FatalError

variants += ['nogtk3', 'noclutter', 'nopython', 'notestspackage']

# 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 == distro_version:
    target_distro_version = None

if target_arch in [Architecture.X86, Architecture.X86_64]:
    ios_platform = 'iPhoneSimulator'
else:
    ios_platform = 'iPhoneOS'

iphone_platform = '/Applications/Xcode.app/Contents/Developer/Platforms/%s.platform/Developer' % ios_platform
_toolchain_root = '%s/usr/bin' % iphone_platform

# Find the installed SDK
_sdk_version = None
for d,v in [(DistroVersion.IOS_9_1, '9.1'),
            (DistroVersion.IOS_9_0, '9.0'),
            (DistroVersion.IOS_8_4, '8.4'),
            (DistroVersion.IOS_8_3, '8.3'),
            (DistroVersion.IOS_8_2, '8.2'),
            (DistroVersion.IOS_8_1, '8.1'),
            (DistroVersion.IOS_8_0, '8.0'),
            (DistroVersion.IOS_7_1, '7.1'),
            (DistroVersion.IOS_7_0, '7.0'),
            (DistroVersion.IOS_6_1, '6.1'),
            (DistroVersion.IOS_6_0, '6.0')]:
  sysroot = os.path.join(iphone_platform, 'SDKs', '%s%s.sdk' %(ios_platform, v))
  if os.path.exists (sysroot):
     _sdk_version = d
     break

if target_distro_version is not None and target_distro_version != _sdk_version:
    raise FatalError("The SDK for %s is not installed" % target_distro_version)
elif _sdk_version is None:
    raise FatalError("The SDK for iOS could not be found in your system")
else:
    target_distro_version = _sdk_version


ccache = use_ccache and 'ccache ' or ''
extra_cflags='-Wall -g -Os'
extra_ldflags='-Wno-error=unused-command-line-argument'
if target_arch == Architecture.ARM64:
    arch_cflags = ' -arch arm64 -pipe'
    host = 'aarch64-apple-darwin10'
elif target_arch == Architecture.ARMv7S:
    arch_cflags = ' -arch armv7s -mcpu=cortex-a9 -pipe'
    host = 'arm-apple-darwin10'
elif target_arch == Architecture.ARMv7:
    arch_cflags = ' -arch armv7 -mcpu=cortex-a8 -pipe'
    host = 'arm-apple-darwin10'
elif target_arch == Architecture.ARM:
    arch_cflags = ' -arch armv6 -mcpu=arm1176jzf-s -pipe'
    host = 'arm-apple-darwin10'
elif target_arch == Architecture.X86:
    arch_cflags = ' -arch i386 '
    host = 'i386-apple-darwin10'
elif target_arch == Architecture.X86_64:
    arch_cflags = ' -arch x86_64 '
    host = 'x86_64-apple-darwin10'
elif target_arch == Architecture.UNIVERSAL:
    arch_cflags=''
else:
  raise FatalError("Arch %s not supported" % target_arch)

# Toolchain environment

if target_distro_version in [DistroVersion.IOS_7_0, DistroVersion.IOS_7_1, DistroVersion.IOS_8_0, DistroVersion.IOS_8_1, DistroVersion.IOS_8_2, DistroVersion.IOS_8_3, DistroVersion.IOS_8_4, DistroVersion.IOS_9_0, DistroVersion.IOS_9_1]:
  os.environ['CC']= 'clang'
  os.environ['CXX']= 'clang++'
  extra_cflags += ' -Wno-error=format-nonliteral -Wno-error=implicit-function-declaration '
else:
  os.environ['CC']= 'llvm-gcc-4.2'
  os.environ['CXX']= 'llvm-g++-4.2'

os.environ['PATH'] = '%s:%s' % (_toolchain_root, os.environ['PATH'])
os.environ['OBJC'] = os.environ['CC']
os.environ['CPP']= "%s -E" % os.environ['CC']
os.environ['CXXPP']= os.environ['CPP']
os.environ['LD']= 'ld'
os.environ['AR']= 'ar'
os.environ['NM']= 'nm'
os.environ['NMEDIT']= 'nmedit'
os.environ['RANLIB']= 'ranlib'
os.environ['AS']= 'as'
if not target_arch in [Architecture.X86, Architecture.X86_64]:
    os.environ['GAS']= '%s %s' % ('gas-preprocessor.pl', os.environ['CC'])
if ios_platform == 'iPhoneOS':
  os.environ['CFLAGS'] = '%s -isysroot %s -miphoneos-version-min=%s %s' %(arch_cflags, sysroot, min_version, extra_cflags)
  os.environ['LDFLAGS'] = '%s -isysroot %s -miphoneos-version-min=%s -Wl,-iphoneos_version_min,%s -Wl,-undefined,error -Wl,-headerpad_max_install_names %s' %(arch_cflags, sysroot, min_version, min_version, extra_ldflags)
else:
  os.environ['CFLAGS'] = '%s -isysroot %s -mios-simulator-version-min=%s %s' %(arch_cflags, sysroot, min_version, extra_cflags)
  os.environ['LDFLAGS'] = '%s -isysroot %s -mios-simulator-version-min=%s -Wl,-ios_simulator_version_min,%s -Wl,-undefined,error -Wl,-headerpad_max_install_names %s' %(arch_cflags, sysroot, min_version, min_version, extra_ldflags)
os.environ['OBJCFLAGS'] = os.environ['CFLAGS']
os.environ['OBJLDFLAGS'] = os.environ['LDFLAGS']
os.environ['CPPFLAGS'] = '%s -isysroot %s' % (arch_cflags, sysroot)
os.environ['CXXFLAGS'] = os.environ['CFLAGS']


if ios_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  %s' % os.environ['CC']
    os.environ['CXX'] = 'ccache  %s' % os.environ['CXX']

# For GLib
os.environ['glib_cv_stack_grows'] = 'yes'
os.environ['glib_cv_uscore'] = 'no'
os.environ['ac_cv_func_posix_getpwuid_r'] = 'yes'
os.environ['ac_cv_func_posix_getgrgid_r'] = 'yes'
os.environ['gt_cv_c_wchar_t'] = 'no'
os.environ['ac_cv_func__NSGetEnviron'] = 'no'

# For pixman
os.environ['ac_cv_tls'] = 'none'

# Workaround for https://openradar.appspot.com/22671534 on 10.11.
os.environ['gl_cv_func_getcwd_abort_bug'] = 'no'