summaryrefslogtreecommitdiff
path: root/config/darwin.config
blob: f788bde1bbf802c1b32b4d302d776d015bd288a1 (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
# This file contains the default configuration to compile for darwin
# platforms. It contains sensitive enviroment configurations that
# shouldn't be modified unless you now what's 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'
    prefix=prefix or os.path.expanduser('~/cerbero/dist/osx_x86_64')
    sources=sources or os.path.expanduser('~/cerbero/sources/osx_x86_64')
    cache_file='osx_x86_64'
elif target_arch == Architecture.X86:
    build='i386-apple-darwinx'
    prefix=prefix or os.path.expanduser('~/cerbero/dist/osx_i386')
    sources=sources or os.path.expanduser('~/cerbero/sources/osx_i386')
    cache_file='osx_i386'
elif target_arch == Architecture.PPC:
    build='powerpc-apple-darwinx'
    prefix=prefix or os.path.expanduser('~/cerbero/dist/osx_ppc')
    sources=sources or os.path.expanduser('~/cerbero/sources/osx_ppc')
    cache_file='osx_ppc'
    osx_sdk_version='10.5'

if distro_version == DistroVersion.OS_X_LEOPARD:
    osx_sdk_version = '10.5'
    # 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['CXX'] = 'g++-4.2'
    os.environ['CPP'] = 'cpp-4.2'
else:
    osx_sdk_version = '10.6'

sdk_root = '/Developer/SDKs/MacOSX%s.sdk' % osx_sdk_version

#Mountain Lion has a completely different path
if distro_version == DistroVersion.OS_X_MOUNTAIN_LION:
    osx_sdk_version = '10.7'
    sdk_root = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX%s.sdk' % osx_sdk_version

sdk='-mmacosx-version-min=%s -isysroot %s' % (osx_sdk_version, sdk_root)

for f in ['CFLAGS', 'CCASFLAGS', 'CXXFLAGS', 'LDFLAGS', 'OBJCFLAGS']:
    os.environ[f] = os.environ.get(f, '')

os.environ['CFLAGS'] += ' -g -O2'
os.environ['CXXFLAGS'] += ' -g -O2'
os.environ['OBJCFLAGS'] += ' -g -O2'

if target_arch == Architecture.X86_64:
    os.environ['CFLAGS'] += ' -arch x86_64 -m64'
    os.environ['LDFLAGS'] += ' -arch x86_64 -m64'
    os.environ['CCASFLAGS'] += ' -arch x86_64 -m64'
    os.environ['OBJCFLAGS'] += ' -arch x86_64 -m64'
elif target_arch == Architecture.X86:
    os.environ['CFLAGS'] += ' -arch i386 -m32'
    os.environ['LDFLAGS'] += ' -arch i386 -m32'
    os.environ['CCASFLAGS'] += ' -arch i386 -m32'
    os.environ['OBJCFLAGS'] += ' -arch i386 -m32'
if target_arch == Architecture.PPC:
    os.environ['CFLAGS'] += ' -arch ppc'
    os.environ['LDFLAGS'] += ' -arch ppc'
    os.environ['CCASFLAGS'] += ' -arch ppc'
    os.environ['OBJCFLAGS'] += ' -arch ppc'

os.environ['CFLAGS'] += ' -I%s -I%s' % (os.path.join(prefix, 'include'), os.path.join(sdk_root, 'usr', 'X11', 'include'))
os.environ['CXXFLAGS'] += os.environ['CFLAGS']
os.environ['LDFLAGS'] += ' %s -L%s ' % (sdk, os.path.join(sdk_root, 'usr', 'X11', 'lib'))