xref: /aosp_15_r20/external/angle/build/config/linux/libffi/BUILD.gn (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker# Copyright 2016 The Chromium Authors
2*8975f5c5SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be
3*8975f5c5SAndroid Build Coastguard Worker# found in the LICENSE file.
4*8975f5c5SAndroid Build Coastguard Worker
5*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/linux/pkg_config.gni")
6*8975f5c5SAndroid Build Coastguard Worker
7*8975f5c5SAndroid Build Coastguard Workerdeclare_args() {
8*8975f5c5SAndroid Build Coastguard Worker  # Controls whether the build should use the version of libffi library shipped
9*8975f5c5SAndroid Build Coastguard Worker  # with the system. By default, we only use the system version on Chrome OS:
10*8975f5c5SAndroid Build Coastguard Worker  # on Linux, libffi must be statically linked to prevent a situation where the
11*8975f5c5SAndroid Build Coastguard Worker  # runtime version of libffi is different from the build-time version from the
12*8975f5c5SAndroid Build Coastguard Worker  # sysroot.
13*8975f5c5SAndroid Build Coastguard Worker  use_system_libffi = default_toolchain == "//build/toolchain/cros:target"
14*8975f5c5SAndroid Build Coastguard Worker}
15*8975f5c5SAndroid Build Coastguard Worker
16*8975f5c5SAndroid Build Coastguard Workerif (use_system_libffi) {
17*8975f5c5SAndroid Build Coastguard Worker  pkg_config("libffi") {
18*8975f5c5SAndroid Build Coastguard Worker    packages = [ "libffi" ]
19*8975f5c5SAndroid Build Coastguard Worker  }
20*8975f5c5SAndroid Build Coastguard Worker} else {
21*8975f5c5SAndroid Build Coastguard Worker  config("libffi") {
22*8975f5c5SAndroid Build Coastguard Worker    libs = [ "ffi_pic" ]
23*8975f5c5SAndroid Build Coastguard Worker  }
24*8975f5c5SAndroid Build Coastguard Worker}
25