# 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 from cerbero.utils import shell from cerbero.errors import FatalError # 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 'nogi' not in variants: variants.append('gi') if target_arch == Architecture.X86_64: build='x86_64-apple-darwin12' elif target_arch == Architecture.X86: build='i386-apple-darwin12' elif target_arch == Architecture.UNIVERSAL: build='universal-apple-darwin12' # By default we ask for the 'latest' SDK. This can be overriden by # configure using 'osx_target_sdk_version' (e.g. set to '10.10') sdk_requested_version = '' # Empty == latest if osx_target_sdk_version is not None: sdk_requested_version = osx_target_sdk_version sdk_root = None ret = shell.check_call('xcodebuild -sdk macosx%s -version Path' % sdk_requested_version).strip() if ret.startswith('/Applications'): sdk_root = ret if sdk_root is None: raise FatalError("Could not determine SDK path with requested version %s: %s" % (sdk_requested_version, ret)) elif not os.path.exists(sdk_root): raise FatalError("Determined SDK path %s does not exist. Is your XCode installation broken?" % sdk_root); min_osx_sdk_version = min_osx_sdk_version or '10.10' sdk='-mmacosx-version-min=%s -isysroot %s' % (min_osx_sdk_version, sdk_root) # Initialize all these so we can just do += later for f in ['CFLAGS', 'CCASFLAGS', 'CXXFLAGS', 'OBJCFLAGS', 'CPPFLAGS', 'LDFLAGS']: os.environ[f] = os.environ.get(f, '') arch_cflags = '-Wall -g -O2' arch_ldflags = ' -headerpad_max_install_names -Wl,-headerpad_max_install_names -Wno-error=unused-command-line-argument ' 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' os.environ['VERSIONER_PYTHON_PREFER_32_BIT'] = 'yes' arch_cflags += ' -Wno-error=format-nonliteral ' incl_dir = os.path.join(prefix, 'include') if not os.path.exists(incl_dir): os.makedirs(incl_dir) # Append to these flags if not already present for f in ['CFLAGS', 'CCASFLAGS', 'CXXFLAGS', 'OBJCFLAGS']: if arch_cflags not in os.environ[f]: os.environ[f] += ' %s ' % arch_cflags incflag = '-I' + incl_dir if incflag not in os.environ[f]: os.environ[f] += ' %s ' % incflag if sdk not in os.environ[f]: os.environ[f] += ' %s ' % sdk # To ensure that AC_CHECK_HEADER etc detect the right headers if arch_cflags not in os.environ['CPPFLAGS']: os.environ['CPPFLAGS'] += ' %s ' % arch_cflags if sdk not in os.environ['CPPFLAGS']: os.environ['CPPFLAGS'] += ' %s ' % sdk if arch_ldflags not in os.environ['LDFLAGS']: os.environ['LDFLAGS'] += ' %s ' % arch_ldflags if sdk not in os.environ['LDFLAGS']: os.environ['LDFLAGS'] += ' %s ' % 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'] = 'clang' os.environ['OBJC'] = 'clang' os.environ['CXX'] = 'clang++' if target_arch != Architecture.UNIVERSAL: # Ensure lightweight architectures are build when only targetting one arch os.environ['ARCHFLAGS'] = '-arch %s' % target_arch # 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: comp = os.environ.get('CC', 'clang') if not 'ccache' in comp: os.environ['CC'] = 'ccache ' + comp comp = os.environ.get('CXX', 'clang++') if not 'ccache' in comp: os.environ['CXX'] = 'ccache ' + comp # Workaround for https://openradar.appspot.com/22671534 on 10.11. os.environ['gl_cv_func_getcwd_abort_bug'] = 'no'