summaryrefslogtreecommitdiff
path: root/config/linux.config
blob: af74a2fb002b12d9864b67de89d35233d45b2775 (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
# 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

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

arch_flags = ''
tools_prefix = ''
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]:
    _host = 'arm-linux-gnueabi'
    tools_prefix = 'arm-linux-gnueabi-'
    os.environ['glib_cv_stack_grows'] = 'no'
    os.environ['glib_cv_uscore'] = 'no'
    os.environ['ac_cv_func_posix_getgrgid_r'] = 'yes'
    os.environ['ac_cv_func_posix_getpwuid_r'] = 'yes'

if host is None and target_arch != arch:
    host = _host

os.environ['CFLAGS'] += ' -Wall -g -O2' + arch_flags
os.environ['CXXFLAGS'] += ' -Wall -g -O2' + arch_flags
os.environ['OBJCFLAGS'] += ' -Wall -g -O2' + arch_flags
os.environ['CCASFLAGS'] += ' -Wall -g -O2' + arch_flags
os.environ['LDFLAGS'] += arch_flags
os.environ['am_cv_python_pyexecdir'] = '%s/%s/site-packages' % (prefix, py_prefix)
os.environ['am_cv_python_pythondir'] = '%s/%s/site-packages' % (prefix, py_prefix)

def cmd(command):
    return '%s%s' % (tools_prefix, command)

os.environ['CC']= cmd('gcc')
os.environ['CXX']= cmd('g++')
os.environ['LD']= cmd('ld')
os.environ['CPP']= cmd('cpp')
os.environ['RANLIB']= cmd('ranlib')
os.environ['AR']= cmd('ar')
os.environ['AS']= cmd('as')
os.environ['NM']= cmd('nm')
os.environ['STRIP']= cmd('strip')
os.environ['OBJCOPY']= cmd('objcopy')

if use_ccache:
    comp = os.environ.get('CC', 'gcc')
    if not 'ccache' in comp:
        os.environ['CC'] = 'ccache ' + comp
    comp = os.environ.get('CXX', 'g++')
    if not 'ccache' in comp:
        os.environ['CXX'] = 'ccache ' + comp