# This file contains the default configuration to compile for Linux # 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, Distro # Set default values for some optional variants variants.override(['alsa', 'x11', 'pulse', 'cdparanoia', 'v4l2', 'gi', 'unwind', 'rust']) for f in ['CPPFLAGS', 'CFLAGS', 'CCASFLAGS', 'CXXFLAGS', 'LDFLAGS', 'OBJCFLAGS']: env[f] = env.get(f, '') arch_flags = '' if target_arch == Architecture.X86: arch_flags += ' -m32 ' _host = 'i686-linux-gnu' elif target_arch == Architecture.X86_64: arch_flags += ' -m64 ' _host = 'x86_64-linux-gnu' if target_arch in [Architecture.ARM, Architecture.ARMv7, Architecture.ARM64]: if target_arch == Architecture.ARMv7: arch_flags += ' -march=armv7-a ' if target_arch == Architecture.ARM64: _host = 'aarch64-linux-gnu' else: if distro == Distro.REDHAT: _host = 'arm-linux-gnu' else: _host = 'arm-linux-gnueabi' env['glib_cv_stack_grows'] = 'no' env['glib_cv_uscore'] = 'no' env['ac_cv_func_posix_getgrgid_r'] = 'yes' env['ac_cv_func_posix_getpwuid_r'] = 'yes' env['ac_cv_func_register_printf_specifier'] = 'no' env['ac_cv_func_register_printf_function'] = 'no' if toolchain_prefix: gcc_toolchain_path = os.path.join (toolchain_prefix, 'bin') env['PATH'] = '%s:%s:%s' % (toolchain_prefix, gcc_toolchain_path, env['PATH']) if target_distro == Distro.REDHAT: if target_arch == Architecture.X86_64: lib_suffix = '64' elif target_distro == Distro.DEBIAN: lib_suffix = '/' + _host if target_arch_flags is not None: arch_flags += ' %s ' % (target_arch_flags) if host is None and target_arch != arch: host = _host if tools_prefix is None: if host is not None and host != '': tools_prefix = '%s-' % host else: tools_prefix = '' if isysroot is not None: env['CPPFLAGS'] += ' -isysroot %s' % (isysroot) env['CFLAGS'] += ' -isysroot %s' % (isysroot) env['CXXFLAGS'] += ' -isysroot %s' % (isysroot) env['OBJCFLAGS'] += ' -isysroot %s' % (isysroot) if sysroot is not None: env['CPPFLAGS'] += ' --sysroot=%s' % (sysroot) env['CFLAGS'] += ' --sysroot=%s' % (sysroot) env['CXXFLAGS'] += ' --sysroot=%s' % (sysroot) env['OBJCFLAGS'] += ' --sysroot=%s' % (sysroot) env['LDFLAGS'] += ' --sysroot=%s' % (sysroot) # Some cross compilers have a bug in the search for indirect dependencies # during linking. # http://stackoverflow.com/questions/16593519/finding-shared-library-dependencies-when-linking-executable workaround_cflags = '' workaround_ldflags = '' if target_arch != arch: workaround_cflags = ' -Wl,-rpath-link=%s/lib ' % (prefix) workaround_ldflags = ' -Wl,-rpath-link=%s/lib ' % (prefix) # This needs to be added by hand on Fedora, for some reason if distro == Distro.REDHAT: workaround_cflags += '-I/usr/arm-linux-gnu/include' # Disable gi if we are cross-compiling variants.gi = False env['CFLAGS'] += arch_flags + workaround_cflags env['CXXFLAGS'] += arch_flags + workaround_cflags env['OBJCFLAGS'] += arch_flags env['CCASFLAGS'] += arch_flags env['LDFLAGS'] += arch_flags + workaround_ldflags def cmd(command): return '%s%s' % (tools_prefix, command) env['CC']= cmd('gcc') env['CXX']= cmd('g++') env['LD']= cmd('ld') env['CPP']= cmd('cpp') env['RANLIB']= cmd('ranlib') env['AR']= cmd('ar') env['AS']= cmd('as') env['NM']= cmd('nm') env['STRIP']= cmd('strip') env['OBJCOPY']= cmd('objcopy') if use_ccache: comp = env.get('CC', 'gcc') if not 'ccache' in comp: env['CC'] = 'ccache ' + comp comp = env.get('CXX', 'g++') if not 'ccache' in comp: env['CXX'] = 'ccache ' + comp