diff options
author | Andoni Morales Alastruey <ylatuya@gmail.com> | 2013-01-15 16:49:18 +0100 |
---|---|---|
committer | Andoni Morales Alastruey <ylatuya@gmail.com> | 2013-01-15 16:49:18 +0100 |
commit | 2be464703eca96bc77c65ab8d5afb40dbc21ef3a (patch) | |
tree | 01634b6a1dc8740bfaf73fe714f82f0e3dbca751 /config | |
parent | 010183a91236c12e42aee1817bc0a087612dacd4 (diff) |
android.config: Add support for x86
Diffstat (limited to 'config')
-rw-r--r-- | config/android.config | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/config/android.config b/config/android.config index a61c98b..5d9ef9f 100644 --- a/config/android.config +++ b/config/android.config @@ -8,21 +8,30 @@ from cerbero.config import Architecture, DistroVersion if target_arch == Architecture.ARM or target_arch == Architecture.ARMv7: tools_prefix = 'arm-linux-androideabi' + arch = 'arm' + tc_path = 'arm-linux-androideabi-4.6' +elif target_arch == Architecture.X86: + tools_prefix = 'i686-linux-android' + arch = 'x86' + tc_path = 'x86-4.6' else: raise FatalError("Arch not supported") if not toolchain_prefix: toolchain_prefix = os.path.expanduser('~/cerbero/android-ndk-r8b') +toolchain_path = '%s/toolchains/%s/prebuilt/linux-x86/bin' % (toolchain_prefix, tc_path) if target_distro_version == DistroVersion.ANDROID_GINGERBREAD: - sysroot = "%s/platforms/android-9/arch-arm" % (toolchain_prefix) + v = '9' elif target_distro_version == DistroVersion.ANDROID_ICE_CREAM_SANDWICH: - sysroot = "%s/platforms/android-14/arch-arm" % (toolchain_prefix) + v = '14' elif target_distro_version == DistroVersion.ANDROID_JELLY_BEAN: - sysroot = "%s/platforms/android-14/arch-arm" % (toolchain_prefix) + v = '14' else: raise FatalError("DistroVersion not supported") +sysroot = "%s/platforms/android-%s/arch-%s" % (toolchain_prefix, v, arch) + # Default compiler flags os.environ['CFLAGS'] = '-g -Os ' os.environ['CXXFLAGS'] = '-g -Os ' @@ -30,17 +39,28 @@ 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) +defines = '-DANDROID -DPIC' +cflags = '--sysroot=%s -I%s/usr/include -ffunction-sections -funwind-tables -fPIC' % (sysroot, sysroot) +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) + +# from android-ndk-r8b/toolchains/$NAME-$VERSION/setup.mk +if target_arch in [Architecture.ARM, Architecture.ARMv7]: + defines += ' -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ ' + cflags += ' -mthumb -fstack-protector -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 ' + if target_arch == Architecture.ARM: + cflags += ' -march=armv5te -mtune=xscale -msoft-float' + elif target_arch == Architecture.ARMv7: + cflags += ' -march=armv7-a -mfloat-abi=softfp -mfpu=vfp' + ldflags = " -Wl,--fix-cortex-a8 " +if target_arch == Architecture.X86: + cflags += ' -march=i686 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300' -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'] + +# Toolchain environment +os.environ['CPPFLAGS'] = '--sysroot=%s -I%s/usr/include %s' % (sysroot, sysroot, defines) +os.environ['CFLAGS'] += "%s %s -Wa,--noexecstack" % (cflags, defines) +os.environ['CXXFLAGS'] = os.environ['CFLAGS'] +os.environ['LDFLAGS'] = '%s' % (ldflags,) def cmd(command): return '%s-%s' % (tools_prefix, command) @@ -57,7 +77,10 @@ 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']) +os.environ['PATH'] = '%s:%s:%s' % (toolchain_prefix, toolchain_path, os.environ['PATH']) +# For the libc.so dependency in i686-linux-android-as +if target_arch == Architecture.X86: + extra_lib_path = '%s/usr/lib' % (sysroot) # For GLib |