| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/sysroot.gni") | 5 import("//build/config/sysroot.gni") |
| 6 | 6 |
| 7 # Defines a config specifying the result of running pkg-config for the given | 7 # Defines a config specifying the result of running pkg-config for the given |
| 8 # packages. Put the package names you want to query in the "packages" variable | 8 # packages. Put the package names you want to query in the "packages" variable |
| 9 # inside the template invocation. | 9 # inside the template invocation. |
| 10 # | 10 # |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 # when doing manual dynamic linking), set: | 24 # when doing manual dynamic linking), set: |
| 25 # ignore_libs = true | 25 # ignore_libs = true |
| 26 | 26 |
| 27 declare_args() { | 27 declare_args() { |
| 28 # A pkg-config wrapper to call instead of trying to find and call the right | 28 # A pkg-config wrapper to call instead of trying to find and call the right |
| 29 # pkg-config directly. Wrappers like this are common in cross-compilation | 29 # pkg-config directly. Wrappers like this are common in cross-compilation |
| 30 # environments. | 30 # environments. |
| 31 # Leaving it blank defaults to searching PATH for 'pkg-config' and relying on | 31 # Leaving it blank defaults to searching PATH for 'pkg-config' and relying on |
| 32 # the sysroot mechanism to find the right .pc files. | 32 # the sysroot mechanism to find the right .pc files. |
| 33 pkg_config = "" | 33 pkg_config = "" |
| 34 |
| 35 # CrOS systemroots place pkgconfig files at <systemroot>/usr/share/pkgconfig |
| 36 # and one of <systemroot>/usr/lib/pkgconfig or <systemroot>/usr/lib64/pkgconfi
g |
| 37 # depending on whether the systemroot is for a 32 or 64 bit architecture. |
| 38 # |
| 39 # When build under GYP, CrOS board builds specify the 'system_libdir' variable |
| 40 # as part of the GYP_DEFINES provided by the CrOS emerge build or simple |
| 41 # chrome build scheme. This variable permits controlling this for GN builds |
| 42 # in similar fashion by setting the `system_libdir` variable in the build's |
| 43 # args.gn file to 'lib' or 'lib64' as appropriate for the target architecture. |
| 44 system_libdir = "lib" |
| 34 } | 45 } |
| 35 | 46 |
| 36 pkg_config_script = "//build/config/linux/pkg-config.py" | 47 pkg_config_script = "//build/config/linux/pkg-config.py" |
| 37 | 48 |
| 38 # Define the args we pass to the pkg-config script for other build files that | 49 # Define the args we pass to the pkg-config script for other build files that |
| 39 # need to invoke it manually. | 50 # need to invoke it manually. |
| 40 if (sysroot != "") { | 51 if (sysroot != "") { |
| 41 # Pass the sysroot if we're using one (it requires the CPU arch also). | 52 # Pass the sysroot if we're using one (it requires the CPU arch also). |
| 42 pkg_config_args = [ | 53 pkg_config_args = [ |
| 43 "-s", | 54 "-s", |
| 44 sysroot, | 55 sysroot, |
| 45 "-a", | 56 "-a", |
| 46 current_cpu, | 57 current_cpu, |
| 58 "--system_libdir", |
| 59 system_libdir, |
| 47 ] | 60 ] |
| 48 } else if (pkg_config != "") { | 61 } else if (pkg_config != "") { |
| 49 pkg_config_args = [ | 62 pkg_config_args = [ |
| 50 "-p", | 63 "-p", |
| 51 pkg_config, | 64 pkg_config, |
| 65 "--system_libdir", |
| 66 system_libdir, |
| 52 ] | 67 ] |
| 53 } else { | 68 } else { |
| 54 pkg_config_args = [] | 69 pkg_config_args = [] |
| 55 } | 70 } |
| 56 | 71 |
| 57 template("pkg_config") { | 72 template("pkg_config") { |
| 58 assert(defined(invoker.packages), | 73 assert(defined(invoker.packages), |
| 59 "Variable |packages| must be defined to be a list in pkg_config.") | 74 "Variable |packages| must be defined to be a list in pkg_config.") |
| 60 config(target_name) { | 75 config(target_name) { |
| 61 args = pkg_config_args + invoker.packages | 76 args = pkg_config_args + invoker.packages |
| (...skipping 11 matching lines...) Expand all Loading... |
| 73 ldflags = pkgresult[4] | 88 ldflags = pkgresult[4] |
| 74 } | 89 } |
| 75 | 90 |
| 76 forward_variables_from(invoker, | 91 forward_variables_from(invoker, |
| 77 [ | 92 [ |
| 78 "defines", | 93 "defines", |
| 79 "visibility", | 94 "visibility", |
| 80 ]) | 95 ]) |
| 81 } | 96 } |
| 82 } | 97 } |
| OLD | NEW |