summaryrefslogtreecommitdiff
path: root/config/android.config
blob: a61c98b58a3d74906934b91ce158f0b15e38f610 (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
# This file contains the default configuration to compile for Android
# 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

if target_arch == Architecture.ARM or target_arch == Architecture.ARMv7:
    tools_prefix = 'arm-linux-androideabi'
else:
  raise FatalError("Arch not supported")

if not toolchain_prefix:
    toolchain_prefix = os.path.expanduser('~/cerbero/android-ndk-r8b')

if target_distro_version == DistroVersion.ANDROID_GINGERBREAD:
  sysroot = "%s/platforms/android-9/arch-arm" % (toolchain_prefix)
elif target_distro_version == DistroVersion.ANDROID_ICE_CREAM_SANDWICH:
  sysroot = "%s/platforms/android-14/arch-arm" % (toolchain_prefix)
elif target_distro_version == DistroVersion.ANDROID_JELLY_BEAN:
  sysroot = "%s/platforms/android-14/arch-arm" % (toolchain_prefix)
else:
  raise FatalError("DistroVersion not supported")

# Default compiler flags
os.environ['CFLAGS'] = '-g -Os '
os.environ['CXXFLAGS'] = '-g -Os '
os.environ['OBJCFLAGS'] = '-g -Os '

ccache = use_ccache and 'ccache ' or ''

# Toolchain environment
os.environ['CPPFLAGS'] = "--sysroot=%s -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -DPIC -I%s/usr/include" % (sysroot, sysroot)
os.environ['CFLAGS'] += "--sysroot=%s -fPIC -DPIC -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -mthumb -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -Wa,--noexecstack -I%s/usr/include " % (sysroot, sysroot)
os.environ['LDFLAGS'] = "--sysroot=%s -fPIC -Wl,-no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections -Wl,-z,nocopyreloc -Wl,-dynamic-linker,/system/bin/linker -L%s/usr/lib " % (sysroot, sysroot)

if target_arch == Architecture.ARM:
  os.environ['CFLAGS'] += "-march=armv5te -mtune=xscale -msoft-float "
elif target_arch == Architecture.ARMv7:
  os.environ['CFLAGS'] += "-march=armv7-a -mfloat-abi=softfp -mfpu=vfp "
  os.environ['LDFLAGS'] += "-Wl,--fix-cortex-a8 "
os.environ['CXXFLAGS']=os.environ['CFLAGS']

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

os.environ['CC']= '%s%s' % (ccache, cmd('gcc'))
os.environ['CC'] += ' -fuse-ld=gold'
os.environ['CXX']= '%s%s' % (ccache, cmd('g++'))
os.environ['CXX'] += ' -fuse-ld=gold'
os.environ['LD']= cmd('ld.gold')
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['PATH'] = '%s:%s/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin:%s' % (toolchain_prefix, toolchain_prefix, os.environ['PATH'])


# For GLib
os.environ['glib_cv_stack_grows'] = 'yes'
os.environ['glib_cv_uscore'] = 'no'
os.environ['ac_cv_func_posix_getpwuid_r'] = 'no'
os.environ['ac_cv_func_nonposix_getpwuid_r'] = 'no'
os.environ['ac_cv_func_posix_getgrgid_r'] = 'no'
os.environ['ac_cv_func_nonposix_getgrgid_r'] = 'no'

# For pixman
os.environ['ac_cv_tls'] = 'none'