summaryrefslogtreecommitdiff
path: root/build/moz.configure
diff options
context:
space:
mode:
Diffstat (limited to 'build/moz.configure')
-rw-r--r--build/moz.configure/android-ndk.configure149
-rw-r--r--build/moz.configure/compilers-util.configure5
-rw-r--r--build/moz.configure/toolchain.configure9
3 files changed, 2 insertions, 161 deletions
diff --git a/build/moz.configure/android-ndk.configure b/build/moz.configure/android-ndk.configure
deleted file mode 100644
index c99ffba2d3..0000000000
--- a/build/moz.configure/android-ndk.configure
+++ /dev/null
@@ -1,149 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-js_option('--with-android-ndk', nargs=1,
- help='location where the Android NDK can be found')
-
-js_option('--with-android-toolchain', nargs=1,
- help='location of the Android toolchain')
-
-js_option('--with-android-gnu-compiler-version', nargs=1,
- help='GNU compiler version to use')
-
-min_android_version = dependable(lambda: '9')
-
-js_option('--with-android-version',
- nargs=1,
- help='android platform version',
- default=min_android_version)
-
-@depends('--with-android-version', min_android_version)
-@imports(_from='__builtin__', _import='ValueError')
-def android_version(value, min_version):
- if not value:
- # Someone has passed --without-android-version.
- die('--with-android-version cannot be disabled.')
-
- try:
- version = int(value[0])
- except ValueError:
- die('--with-android-version expects an integer value')
-
- if version < int(min_version):
- die('--with-android-version must be at least %s (got %s)',
- min_version, value[0])
-
- return version
-
-add_old_configure_assignment('android_version', android_version)
-
-@depends('--with-android-ndk', build_project)
-def ndk(value, build_project):
- if build_project == 'mobile/android' and not value:
- die('You must specify --with-android-ndk=/path/to/ndk when '
- 'building mobile/android')
- if value:
- return value[0]
-
-set_config('ANDROID_NDK', ndk)
-add_old_configure_assignment('android_ndk', ndk)
-
-@depends(target, android_version, ndk)
-@checking('for android platform directory')
-@imports(_from='os.path', _import='isdir')
-def android_platform(target, android_version, ndk):
- if target.os != 'Android':
- return
-
- if 'mips' in target.cpu:
- target_dir_name = 'mips'
- elif 'aarch64' == target.cpu:
- target_dir_name = 'arm64'
- else:
- target_dir_name = target.cpu
-
- # Not all Android releases have their own platform release. We use
- # the next lower platform version in these cases.
- if android_version in (11, 10):
- platform_version = 9
- elif android_version in (20, 22):
- platform_version = android_version - 1
- else:
- platform_version = android_version
-
- platform_dir = os.path.join(ndk,
- 'platforms',
- 'android-%s' % platform_version,
- 'arch-%s' % target_dir_name)
-
- if not isdir(platform_dir):
- die("Android platform directory not found. With the current "
- "configuration, it should be in %s" % platform_dir)
-
- return platform_dir
-
-add_old_configure_assignment('android_platform', android_platform)
-
-@depends(android_platform)
-def extra_toolchain_flags(platform_dir):
- if not platform_dir:
- return []
- return ['-idirafter',
- os.path.join(platform_dir, 'usr', 'include')]
-
-@depends(target, host, ndk, '--with-android-toolchain',
- '--with-android-gnu-compiler-version')
-@checking('for the Android toolchain directory', lambda x: x or 'not found')
-@imports(_from='os.path', _import='isdir')
-@imports(_from='mozbuild.shellutil', _import='quote')
-def android_toolchain(target, host, ndk, toolchain, gnu_compiler_version):
- if not ndk:
- return
- if toolchain:
- return toolchain[0]
- else:
- if target.cpu == 'arm' and target.endianness == 'little':
- target_base = 'arm-linux-androideabi'
- elif target.cpu == 'x86':
- target_base = 'x86'
- elif target.cpu == 'mips32' and target.endianness == 'little':
- target_base = 'mipsel-linux-android'
- elif target.cpu == 'aarch64' and target.endianness == 'little':
- target_base = 'aarch64-linux-android'
- else:
- die('Target cpu is not supported.')
-
- toolchain_format = '%s/toolchains/%s-%s/prebuilt/%s-%s'
-
- for version in gnu_compiler_version or ['4.9', '4.8', '4.7']:
- toolchain = toolchain_format % (ndk, target_base, version,
- host.kernel.lower(), host.cpu)
- log.debug('Trying %s' % quote(toolchain))
- if not isdir(toolchain) and host.cpu == 'x86_64':
- toolchain = toolchain_format % (ndk, target_base, version,
- host.kernel.lower(), 'x86')
- log.debug('Trying %s' % quote(toolchain))
- if isdir(toolchain):
- return toolchain
- else:
- if gnu_compiler_version:
- die('Your --with-android-gnu-compiler-version may be wrong')
- die('You have to specify --with-android-toolchain='
- '/path/to/ndk/toolchain.')
-
-set_config('ANDROID_TOOLCHAIN', android_toolchain)
-
-@depends(target, android_toolchain)
-def android_toolchain_prefix(target, toolchain):
- if toolchain:
- if target.cpu == 'x86':
- # Ideally, the --target should just have the right x86 variant
- # in the first place.
- return '%s/bin/i686-linux-android-' % toolchain
- return '%s/bin/%s-' % (toolchain, target.toolchain)
-
-imply_option('--with-toolchain-prefix', android_toolchain_prefix,
- reason='--with-android-ndk')
diff --git a/build/moz.configure/compilers-util.configure b/build/moz.configure/compilers-util.configure
index 884ab54098..341615836c 100644
--- a/build/moz.configure/compilers-util.configure
+++ b/build/moz.configure/compilers-util.configure
@@ -42,11 +42,10 @@ def compiler_class(compiler):
def checking_fn(fn):
return fn
- @depends_when(self, dependable(flags), extra_toolchain_flags, when=when)
+ @depends_when(self, dependable(flags), when=when)
@checking_fn
- def func(compiler, flags, extra_flags):
+ def func(compiler, flags):
flags = flags or []
- flags += extra_flags or []
flags.append('-c')
if try_invoke_compiler(
diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
index 5c8abb974a..056c6a9328 100644
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -61,15 +61,6 @@ set_config('HAVE_YASM', have_yasm)
# Until the YASM variable is not necessary in old-configure.
add_old_configure_assignment('YASM', have_yasm)
-# Android NDK
-# ==============================================================
-
-@depends('--disable-compile-environment', build_project, gonkdir, '--help')
-def compiling_android(compile_env, build_project, gonkdir, _):
- return compile_env and (gonkdir or build_project in ('mobile/android', 'js'))
-
-include('android-ndk.configure', when=compiling_android)
-
# MacOS deployment target version
# ==============================================================
# This needs to happen before any compilation test is done.