# 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 # Enable introspection by default variants.override(['gi', 'rust']) if arch == Architecture.X86_64: build = 'x86_64-apple-darwin12' elif arch == Architecture.X86: build = 'i386-apple-darwin12' elif arch == Architecture.ARM64: build = 'aarch64-apple-darwin12' elif arch == Architecture.UNIVERSAL: build = 'universal-apple-darwin12' if target_arch == Architecture.X86_64: host = 'x86_64-apple-darwin12' elif target_arch == Architecture.X86: host = 'i386-apple-darwin12' elif target_arch == Architecture.ARM64: host = 'aarch64-apple-darwin12' elif target_arch == Architecture.UNIVERSAL: host = '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_output(['xcodebuild', '-sdk', 'macosx' + sdk_requested_version, '-version', 'Path'], fail=False).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); ret = shell.check_output(['xcodebuild', '-version']).strip() assert(ret.startswith('Xcode')) xcode_version = tuple(int(c) for c in ret.split()[1].split('.')) min_osx_sdk_version = min_osx_sdk_version or '10.13' 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', 'OBJCXXFLAGS', 'CPPFLAGS', 'LDFLAGS']: env[f] = env.get(f, '') arch_cflags = '' 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' env['VERSIONER_PYTHON_PREFER_32_BIT'] = 'yes' elif target_arch == Architecture.ARM64: arch_cflags += ' -arch arm64 -m64' arch_ldflags += ' -arch arm64 -m64 -Wl,-arch,arm64' arch_cflags += ' -Wno-error=format-nonliteral -Werror=unguarded-availability-new ' # Starting with XCode 14, clang emits code that makes all binaries incompatible # with older XCode versions. Disable that feature. arch_objcflags = '' if xcode_version >= (14, 0): arch_objcflags = ' -fno-objc-msgsend-selector-stubs ' 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', 'OBJCXXFLAGS']: if arch_cflags not in env[f]: env[f] += ' %s ' % arch_cflags incflag = '-I' + incl_dir if incflag not in env[f]: env[f] += ' %s ' % incflag if sdk not in env[f]: env[f] += ' %s ' % sdk env['OBJCFLAGS'] += arch_objcflags env['OBJCXXFLAGS'] += arch_objcflags # To ensure that AC_CHECK_HEADER etc detect the right headers if arch_cflags not in env['CPPFLAGS']: env['CPPFLAGS'] += ' %s ' % arch_cflags if sdk not in env['CPPFLAGS']: env['CPPFLAGS'] += ' %s ' % sdk if arch_ldflags not in env['LDFLAGS']: env['LDFLAGS'] += ' %s ' % arch_ldflags if sdk not in env['LDFLAGS']: env['LDFLAGS'] += ' %s ' % sdk env['STRIP'] = 'strip' env['LD'] = 'ld' env['AR'] = 'ar' env['RANLIB'] = 'ranlib' env['NM'] = 'nm' env['OBJCOPY'] = 'objcopy' env['CC'] = 'clang' env['OBJC'] = 'clang' env['CXX'] = 'clang++' env['OBJCXX'] = 'clang++' # Since 10.10 libstdc++ is deprecated, and might no longer be # shipped. Make sure we use libc++ instead env['CXXFLAGS'] += ' -stdlib=libc++ ' env['AS']= 'as' if target_arch in [Architecture.X86, Architecture.X86_64]: env.pop('GAS', None) else: env['GAS']= '%s %s %s' % ('gas-preprocessor.pl', env['CC'], env['CFLAGS']) if target_arch != Architecture.UNIVERSAL: # Ensure lightweight architectures are build when only targetting one arch env['ARCHFLAGS'] = '-arch %s' % target_arch if use_ccache: comp = env.get('CC', 'clang') if not 'ccache' in comp: env['CC'] = 'ccache ' + comp comp = env.get('CXX', 'clang++') if not 'ccache' in comp: env['CXX'] = 'ccache ' + comp # Workaround for https://openradar.appspot.com/22671534 on 10.11. env['gl_cv_func_getcwd_abort_bug'] = 'no' # for glib inside pkg-config env['glib_cv_stack_grows'] = 'yes' env['glib_cv_uscore'] = 'no' env['ac_cv_func_posix_getpwuid_r'] = 'yes' env['ac_cv_func_posix_getgrgid_r'] = 'yes' moltenvk_prefix = os.path.join(home_dir, 'moltenvk')