aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-11-21 00:35:52 +0100
committerMax Kellermann <max@duempel.org>2015-11-21 00:35:52 +0100
commitfbcacb590beb981d252e9f46baec9461ff1e7fd9 (patch)
tree116ee2ad4e0c0981c71805615c17c747997a1440 /android
parentf97ad2b2ee566eb2212a1dc19128ad2213cc4f95 (diff)
downloadmpd-fbcacb590beb981d252e9f46baec9461ff1e7fd9.tar.gz
mpd-fbcacb590beb981d252e9f46baec9461ff1e7fd9.tar.xz
mpd-fbcacb590beb981d252e9f46baec9461ff1e7fd9.zip
{android,win32}/build.py: FfmpegProject detects CPU and OS
Diffstat (limited to 'android')
-rwxr-xr-xandroid/build.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/android/build.py b/android/build.py
index a549774fa..6555b1f21 100755
--- a/android/build.py
+++ b/android/build.py
@@ -93,6 +93,10 @@ class AndroidNdkToolchain:
self.ldflags = '--sysroot=' + self.sysroot + ' -L' + os.path.join(install_prefix, 'lib')
self.libs = ''
+ self.is_arm = self.ndk_arch == 'arm'
+ self.is_armv7 = self.is_arm and 'armv7' in self.cflags
+ self.is_windows = False
+
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')
if use_clang:
@@ -125,6 +129,16 @@ class FfmpegProject(Project):
src = self.unpack(toolchain)
build = self.make_build_path(toolchain)
+ if toolchain.is_arm:
+ arch = 'arm'
+ else:
+ arch = 'x86'
+
+ if toolchain.is_windows:
+ target_os = 'mingw32'
+ else:
+ target_os = 'linux'
+
configure = [
os.path.join(src, 'configure'),
'--cc=' + toolchain.cc,
@@ -136,12 +150,14 @@ class FfmpegProject(Project):
'--extra-libs=' + toolchain.libs,
'--ar=' + toolchain.ar,
'--enable-cross-compile',
- '--target-os=linux',
- '--arch=' + toolchain.ndk_arch,
- '--cpu=cortex-a8',
+ '--arch=' + arch,
+ '--target-os=' + target_os,
'--prefix=' + toolchain.install_prefix,
] + self.configure_args
+ if toolchain.is_armv7:
+ configure.append('--cpu=cortex-a8')
+
subprocess.check_call(configure, cwd=build, env=toolchain.env)
subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], cwd=build, env=toolchain.env)
subprocess.check_call(['/usr/bin/make', '--quiet', 'install'], cwd=build, env=toolchain.env)