summaryrefslogtreecommitdiff
path: root/config/android.config
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2012-08-21 10:03:30 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-08-21 10:03:30 +0200
commitf4b9b0c1daeb0f3d26f31fbfb423436603c4e138 (patch)
treeab80d32c94590a2f6048754807b167a399537e52 /config/android.config
parenta239976959b2caa1948283f4a81df678e696f6ad (diff)
Initial Android build support
Diffstat (limited to 'config/android.config')
-rw-r--r--config/android.config57
1 files changed, 57 insertions, 0 deletions
diff --git a/config/android.config b/config/android.config
new file mode 100644
index 0000000..93d76d7
--- /dev/null
+++ b/config/android.config
@@ -0,0 +1,57 @@
+# This file contains the default configuration to compile for linux
+# platforms. It contains sensitive enviroment configurations that
+# shouldn't be modified unless you now what's you are doing.
+# PLEASE, DO NOT EDIT THIS FILE
+
+import os
+from cerbero.config import Architecture, DistroVersion
+
+if target_arch == Architecture.ARM:
+ prefix=prefix or os.path.expanduser('~/cerbero/dist/android_arm')
+ sources=sources or os.path.expanduser('~/cerbero/sources/android_arm')
+ cache_file= cache_file or 'android_arm'
+ 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 -I%s/usr/include" % (sysroot, sysroot)
+os.environ['CFLAGS'] += "--sysroot=%s -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -march=armv5te -mtune=xscale -msoft-float -mthumb -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -Wa,--noexecstack -I%s/usr/include" % (sysroot, sysroot)
+os.environ['LDFLAGS'] = "--sysroot=%s -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections -Wl,-z,nocopyreloc -L%s/usr/lib %s" % (sysroot, sysroot, os.environ.get('LDFLAGS', ''))
+os.environ['CXXFLAGS']=os.environ['CFLAGS']
+os.environ['CXXFLAGS']+="-fno-exceptions -fno-rtti"
+
+def cmd(command):
+ return '%s-%s' % (tools_prefix, command)
+
+os.environ['CC']= '%s%s' % (ccache, cmd('gcc'))
+os.environ['CXX']= '%s%s' % (ccache, 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['PATH'] = '%s:%s/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin:%s' % (toolchain_prefix, toolchain_prefix, os.environ['PATH'])
+