android/build.py: always build with clang
Support for GCC has been dropped from NDK r13. Let's switch everything to clang before they really remove GCC completely.
This commit is contained in:
parent
f3dd50de87
commit
307964d874
|
@ -39,7 +39,7 @@ build_arch = 'linux-x86_64'
|
||||||
|
|
||||||
class AndroidNdkToolchain:
|
class AndroidNdkToolchain:
|
||||||
def __init__(self, tarball_path, src_path, build_path,
|
def __init__(self, tarball_path, src_path, build_path,
|
||||||
use_cxx, use_clang):
|
use_cxx):
|
||||||
self.tarball_path = tarball_path
|
self.tarball_path = tarball_path
|
||||||
self.src_path = src_path
|
self.src_path = src_path
|
||||||
self.build_path = build_path
|
self.build_path = build_path
|
||||||
|
@ -67,14 +67,10 @@ class AndroidNdkToolchain:
|
||||||
common_flags = '-march=armv7-a -mfloat-abi=softfp'
|
common_flags = '-march=armv7-a -mfloat-abi=softfp'
|
||||||
|
|
||||||
toolchain_bin = os.path.join(toolchain_path, 'bin')
|
toolchain_bin = os.path.join(toolchain_path, 'bin')
|
||||||
if use_clang:
|
llvm_bin = os.path.join(llvm_path, 'bin')
|
||||||
llvm_bin = os.path.join(llvm_path, 'bin')
|
self.cc = os.path.join(llvm_bin, 'clang')
|
||||||
self.cc = os.path.join(llvm_bin, 'clang')
|
self.cxx = os.path.join(llvm_bin, 'clang++')
|
||||||
self.cxx = os.path.join(llvm_bin, 'clang++')
|
common_flags += ' -target ' + llvm_triple + ' -integrated-as -gcc-toolchain ' + toolchain_path
|
||||||
common_flags += ' -target ' + llvm_triple + ' -integrated-as -gcc-toolchain ' + toolchain_path
|
|
||||||
else:
|
|
||||||
self.cc = os.path.join(toolchain_bin, arch + '-gcc')
|
|
||||||
self.cxx = os.path.join(toolchain_bin, arch + '-g++')
|
|
||||||
|
|
||||||
self.ar = os.path.join(toolchain_bin, arch + '-ar')
|
self.ar = os.path.join(toolchain_bin, arch + '-ar')
|
||||||
self.ranlib = os.path.join(toolchain_bin, arch + '-ranlib')
|
self.ranlib = os.path.join(toolchain_bin, arch + '-ranlib')
|
||||||
|
@ -93,8 +89,6 @@ class AndroidNdkToolchain:
|
||||||
|
|
||||||
libstdcxx_path = os.path.join(ndk_path, 'sources/cxx-stl/gnu-libstdc++', gcc_version)
|
libstdcxx_path = os.path.join(ndk_path, 'sources/cxx-stl/gnu-libstdc++', gcc_version)
|
||||||
libstdcxx_cppflags = '-isystem ' + os.path.join(libstdcxx_path, 'include') + ' -isystem ' + os.path.join(libstdcxx_path, 'libs', android_abi, 'include')
|
libstdcxx_cppflags = '-isystem ' + os.path.join(libstdcxx_path, 'include') + ' -isystem ' + os.path.join(libstdcxx_path, 'libs', android_abi, 'include')
|
||||||
if use_clang:
|
|
||||||
libstdcxx_cppflags += ' -D__STRICT_ANSI__'
|
|
||||||
libstdcxx_ldadd = os.path.join(libstdcxx_path, 'libs', android_abi, 'libgnustl_static.a')
|
libstdcxx_ldadd = os.path.join(libstdcxx_path, 'libs', android_abi, 'libgnustl_static.a')
|
||||||
|
|
||||||
if use_cxx:
|
if use_cxx:
|
||||||
|
@ -124,13 +118,13 @@ thirdparty_libs = [
|
||||||
# build the third-party libraries
|
# build the third-party libraries
|
||||||
for x in thirdparty_libs:
|
for x in thirdparty_libs:
|
||||||
toolchain = AndroidNdkToolchain(tarball_path, src_path, build_path,
|
toolchain = AndroidNdkToolchain(tarball_path, src_path, build_path,
|
||||||
use_cxx=x.use_cxx, use_clang=x.use_clang)
|
use_cxx=x.use_cxx)
|
||||||
if not x.is_installed(toolchain):
|
if not x.is_installed(toolchain):
|
||||||
x.build(toolchain)
|
x.build(toolchain)
|
||||||
|
|
||||||
# configure and build MPD
|
# configure and build MPD
|
||||||
toolchain = AndroidNdkToolchain(tarball_path, src_path, build_path,
|
toolchain = AndroidNdkToolchain(tarball_path, src_path, build_path,
|
||||||
use_cxx=True, use_clang=True)
|
use_cxx=True)
|
||||||
|
|
||||||
configure = [
|
configure = [
|
||||||
os.path.join(mpd_path, 'configure'),
|
os.path.join(mpd_path, 'configure'),
|
||||||
|
|
|
@ -7,7 +7,7 @@ from build.tar import untar
|
||||||
class Project:
|
class Project:
|
||||||
def __init__(self, url, md5, installed, name=None, version=None,
|
def __init__(self, url, md5, installed, name=None, version=None,
|
||||||
base=None,
|
base=None,
|
||||||
use_cxx=False, use_clang=False):
|
use_cxx=False):
|
||||||
if base is None:
|
if base is None:
|
||||||
basename = os.path.basename(url)
|
basename = os.path.basename(url)
|
||||||
m = re.match(r'^(.+)\.(tar(\.(gz|bz2|xz|lzma))?|zip)$', basename)
|
m = re.match(r'^(.+)\.(tar(\.(gz|bz2|xz|lzma))?|zip)$', basename)
|
||||||
|
@ -29,7 +29,6 @@ class Project:
|
||||||
self.installed = installed
|
self.installed = installed
|
||||||
|
|
||||||
self.use_cxx = use_cxx
|
self.use_cxx = use_cxx
|
||||||
self.use_clang = use_clang
|
|
||||||
|
|
||||||
def download(self, toolchain):
|
def download(self, toolchain):
|
||||||
return download_and_verify(self.url, self.md5, toolchain.tarball_path)
|
return download_and_verify(self.url, self.md5, toolchain.tarball_path)
|
||||||
|
|
Loading…
Reference in New Issue