Bug 1733869 [wpt PR 30916] - Add a note about counterintuitive send_keys() code point...
[gecko.git] / js / ffi.configure
blobec4e572c7a1b11b8ed6e4c6f60d2d7fd950df7f5
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/.
8 @depends(target)
9 def force_system_ffi(target):
10     # Pre-emptively move to system ffi for non-tier one platforms.
11     if target.cpu not in ("x86", "x86_64", "arm", "aarch64"):
12         return True
15 imply_option("--with-system-ffi", force_system_ffi, "target")
17 system_lib_option(
18     "--with-system-ffi", help="Use system libffi (located with pkgconfig)"
21 use_system_ffi = depends_if("--with-system-ffi")(lambda _: True)
23 system_ffi = pkg_check_modules("MOZ_FFI", "libffi > 3.0.9", when=use_system_ffi)
25 building_ffi = depends(system_ffi)(lambda v: v is None)
27 set_config("MOZ_SYSTEM_FFI", depends_if(system_ffi)(lambda _: True))
29 # Target selection, based on ffi/configure.ac.
30 @depends(target, when=building_ffi)
31 def ffi_target(target):
32     if target.cpu not in ("x86", "x86_64", "arm", "aarch64"):
33         die(
34             "Building libffi from the tree is not supported on this platform. "
35             "Use --with-system-ffi instead."
36         )
38     if target.cpu == "x86_64":
39         target_dir = "x86"
40         target_name = {
41             "WINNT": "X86_WIN64",
42         }.get(target.kernel, "X86_64")
44     elif target.cpu == "x86":
45         target_dir = "x86"
46         target_name = {
47             "WINNT": "X86_WIN32",
48             "Darwin": "X86_DARWIN",
49             "FreeBSD": "X86_FREEBSD",
50             "OpenBSD": "X86_FREEBSD",
51         }.get(target.kernel, "X86")
53     elif target.cpu == "aarch64":
54         target_dir = "aarch64"
55         target_name = {
56             "WINNT": "ARM_WIN64",
57         }.get(target.kernel, "AARCH64")
59     elif target.cpu == "arm":
60         target_dir = "arm"
61         target_name = "ARM"
63     return namespace(name=target_name, dir=target_dir)
66 set_config("FFI_TARGET", ffi_target.name)
67 set_config("FFI_TARGET_DIR", ffi_target.dir)