Bug 1575399 [wpt PR 18572] - [LayoutNG] Give flex items their stretched size earlier...
[gecko.git] / js / ffi.configure
blob5bd6de9cc076e61ee1e4f1e021cb3507180f1784
1 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2 # vim: set filetype=python:
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 @depends(target)
8 def force_system_ffi(target):
9     # Pre-emptively move to system ffi for non-tier one platforms.
10     if target.cpu not in ('x86', 'x86_64', 'arm', 'aarch64'):
11         return True
13 imply_option('--with-system-ffi', force_system_ffi, "target")
15 js_option('--with-system-ffi',
16           help='Use system libffi (located with pkgconfig)')
18 use_system_ffi = depends_if('--with-system-ffi')(lambda _: True)
20 system_ffi = pkg_check_modules('MOZ_FFI', 'libffi > 3.0.9',
21                                when=use_system_ffi)
23 building_ffi = depends(system_ffi)(lambda v: v is None)
25 set_config('MOZ_SYSTEM_FFI', depends_if(system_ffi)(lambda _: True))
27 # Target selection, based on ffi/configure.ac.
28 @depends(target, when=building_ffi)
29 def ffi_target(target):
30     if target.cpu not in ('x86', 'x86_64', 'arm', 'aarch64'):
31         die('Building libffi from the tree is not supported on this platform. '
32             'Use --with-system-ffi instead.')
34     if target.os == 'WINNT':
35         target_dir, target_name = {
36             'x86_64': ('x86', 'X86_WIN64'),
37             'x86': ('x86', 'X86_WIN32'),
38             'aarch64': ('aarch64', 'ARM64_WIN64'),
39         }[target.cpu]
40     elif target.os == 'OSX':
41         target_dir = 'x86'
42         target_name = 'X86_DARWIN'
43     elif target.cpu == 'arm':
44         target_dir = 'arm'
45         target_name = 'ARM'
46     elif target.cpu == 'aarch64':
47         target_dir = 'aarch64'
48         target_name = 'AARCH64'
49     else:
50         target_dir = 'x86'
51         target_name = target.cpu.upper()
53     return namespace(
54         name=target_name,
55         dir=target_dir
56     )
58 set_config('FFI_TARGET', ffi_target.name)
59 set_config('FFI_TARGET_DIR', ffi_target.dir)