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
|
# This file contains the default configuration to compile for Darwin
# 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.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
if target_arch == Architecture.X86_64:
build='x86_64-apple-darwinx'
elif target_arch == Architecture.X86:
build='i386-apple-darwinx'
elif target_arch == Architecture.PPC:
build='powerpc-apple-darwinx'
elif target_arch == Architecture.UNIVERSAL:
build='universal-apple-darwinx'
if distro_version == DistroVersion.OS_X_LEOPARD:
# autotools in OSX 10.5 (Leopard) are a bit oldy/broken.
# Bootstraping the system with macports seems to be enough to build.
# sudo port install git automake libtool gtk-doc
# The following enviorenment variables are needed in order to use the macports
# libtoolize and libtool.
os.environ['LIBTOOLIZE'] = 'glibtoolize'
os.environ['LIBTOOL'] = 'glibtool'
# XCode 3.1.4 comes with two versions of gcc. Using the newest one allows
# build gmp without needing to patch it.
os.environ['CC'] = 'gcc-4.2'
os.environ['OBJC'] = 'gcc-4.2'
os.environ['CXX'] = 'g++-4.2'
os.environ['CPP'] = 'cpp-4.2'
SDK_VERSION = {
DistroVersion.OS_X_LEOPARD: '10.5',
DistroVersion.OS_X_SNOW_LEOPARD: '10.6',
DistroVersion.OS_X_LION: '10.7',
DistroVersion.OS_X_MOUNTAIN_LION: '10.8',
DistroVersion.OS_X_MAVERICKS: '10.9',
}
# The SDK target can be overriden in configure with 'osx_target_sdk_version' for instance
# to target the 10.5 SDK
sdk_version = osx_target_sdk_version or SDK_VERSION[distro_version]
# For Xcode >= 4.3, the SDK is installed in a completely different path
sdk_root = '/Developer/SDKs/MacOSX%s.sdk' % sdk_version
if not os.path.exists(sdk_root):
sdk_root = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX%s.sdk' % sdk_version
min_osx_sdk_version = min_osx_sdk_version or '10.6'
sdk='-mmacosx-version-min=%s -isysroot %s' % (min_osx_sdk_version, sdk_root)
for f in ['CFLAGS', 'CCASFLAGS', 'CXXFLAGS', 'OBJCFLAGS', 'LDFLAGS']:
os.environ[f] = os.environ.get(f, '')
arch_cflags = '-Wall -g -O2'
arch_ldflags = ' -headerpad_max_install_names -Wl,-headerpad_max_install_names '
if target_arch == Architecture.X86_64:
arch_cflags += ' -arch x86_64 -m64'
arch_ldflags += ' -arch x86_64 -m64 -Wl,-arch,x86_64'
elif target_arch == Architecture.X86:
arch_cflags += ' -arch i386 -m32'
arch_ldflags += ' -arch i386 -m32 -Wl,-arch,i386'
elif target_arch == Architecture.PPC:
arch_cflags += ' -arch ppc'
arch_ldflags += ' -arch ppc -Wl,-arch,ppc'
arch_cflags += ' -Wno-error=format-nonliteral '
incl_dir = os.path.join(prefix, 'include')
if not os.path.exists(incl_dir):
os.makedirs(incl_dir)
for f in ['CFLAGS', 'CCASFLAGS', 'CXXFLAGS', 'OBJCFLAGS']:
os.environ[f] += ' %s -I%s %s ' % (arch_cflags, incl_dir, sdk)
os.environ['LDFLAGS'] += ' %s %s ' % (arch_ldflags, sdk)
os.environ['STRIP'] = 'strip'
os.environ['LD'] = 'ld'
os.environ['AR'] = 'ar'
os.environ['RANLIB'] = 'ranlib'
os.environ['NM'] = 'nm'
os.environ['OBJCOPY'] = 'objcopy'
os.environ['CC'] = 'gcc'
os.environ['CXX'] = 'g++'
# Link GL headers
gl_headers = os.path.join(sdk_root, 'usr', 'X11', 'include', 'GL')
if not os.path.exists(gl_headers):
gl_headers = os.path.join(sdk_root, 'System', 'Library', 'Frameworks', 'OpenGL.framework', 'Headers')
gl_headers_prefix = os.path.join(incl_dir, 'GL')
if not os.path.exists(gl_headers_prefix):
if os.path.lexists(gl_headers_prefix):
os.remove(gl_headers_prefix)
os.symlink(gl_headers, gl_headers_prefix)
if not os.path.exists(gl_headers_prefix):
raise Exception ("GL headers path not found: %s" % gl_headers)
if use_ccache:
os.environ['CC'] += 'ccache gcc'
os.environ['CXX'] += 'ccache g++'
|