summaryrefslogtreecommitdiffstats
path: root/build/config
diff options
context:
space:
mode:
authorrjkroege <rjkroege@chromium.org>2016-01-06 18:11:46 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-07 02:12:58 +0000
commita7efe0d67a564d1dbe540d70de2bf1f4ef409bb4 (patch)
tree1f3c55e7bec8c8bc47f40a6792dd3f028481dd04 /build/config
parent187634d7c83361bfd0bb0bf312f66f079611a60e (diff)
downloadchromium_src-a7efe0d67a564d1dbe540d70de2bf1f4ef409bb4.zip
chromium_src-a7efe0d67a564d1dbe540d70de2bf1f4ef409bb4.tar.gz
chromium_src-a7efe0d67a564d1dbe540d70de2bf1f4ef409bb4.tar.bz2
Introduce a GN arg controlling the path prefix in pkg-config and modify pkg-config.py to use it.
Review URL: https://codereview.chromium.org/1564503002 Cr-Commit-Position: refs/heads/master@{#367987}
Diffstat (limited to 'build/config')
-rw-r--r--build/config/linux/pkg-config.py18
-rw-r--r--build/config/linux/pkg_config.gni15
2 files changed, 27 insertions, 6 deletions
diff --git a/build/config/linux/pkg-config.py b/build/config/linux/pkg-config.py
index deaeed3..759d0a8 100644
--- a/build/config/linux/pkg-config.py
+++ b/build/config/linux/pkg-config.py
@@ -26,6 +26,15 @@ from optparse import OptionParser
# When using a sysroot, you must also specify the architecture via
# "-a <arch>" where arch is either "x86" or "x64".
#
+# CrOS systemroots place pkgconfig files at <systemroot>/usr/share/pkgconfig
+# and one of <systemroot>/usr/lib/pkgconfig or <systemroot>/usr/lib64/pkgconfig
+# depending on whether the systemroot is for a 32 or 64 bit architecture. They
+# specify the 'lib' or 'lib64' of the pkgconfig path by defining the
+# 'system_libdir' variable in the args.gn file. pkg_config.gni communicates this
+# variable to this script with the "--system_libdir <system_libdir>" flag. If no
+# flag is provided, then pkgconfig files are assumed to come from
+# <systemroot>/usr/lib/pkgconfig.
+#
# Additionally, you can specify the option --atleast-version. This will skip
# the normal outputting of a dictionary and instead print true or false,
# depending on the return value of pkg-config for the given package.
@@ -52,13 +61,8 @@ def SetConfigPath(options):
print "You must specify an architecture via -a if using a sysroot."
sys.exit(1)
- # In the gyp world this is configurable via the 'system_libdir' variable,
- # which doesn't seem to have an equivelent in gn yet.
- # TOOD(sbc): Make this configurable like it is under gyp.
- libpath = 'lib'
-
# Add the sysroot path to the environment's PKG_CONFIG_PATH
- config_path = sysroot + '/usr/' + libpath + '/pkgconfig'
+ config_path = sysroot + '/usr/' + options.system_libdir + '/pkgconfig'
config_path += ':' + sysroot + '/usr/share/pkgconfig'
if 'PKG_CONFIG_PATH' in os.environ:
os.environ['PKG_CONFIG_PATH'] += ':' + config_path
@@ -110,6 +114,8 @@ parser.add_option('-p', action='store', dest='pkg_config', type='string',
parser.add_option('-v', action='append', dest='strip_out', type='string')
parser.add_option('-s', action='store', dest='sysroot', type='string')
parser.add_option('-a', action='store', dest='arch', type='string')
+parser.add_option('--system_libdir', action='store', dest='system_libdir',
+ type='string', default='lib')
parser.add_option('--atleast-version', action='store',
dest='atleast_version', type='string')
parser.add_option('--libdir', action='store_true', dest='libdir')
diff --git a/build/config/linux/pkg_config.gni b/build/config/linux/pkg_config.gni
index 914ca8d..58769e2 100644
--- a/build/config/linux/pkg_config.gni
+++ b/build/config/linux/pkg_config.gni
@@ -31,6 +31,17 @@ declare_args() {
# Leaving it blank defaults to searching PATH for 'pkg-config' and relying on
# the sysroot mechanism to find the right .pc files.
pkg_config = ""
+
+ # CrOS systemroots place pkgconfig files at <systemroot>/usr/share/pkgconfig
+ # and one of <systemroot>/usr/lib/pkgconfig or <systemroot>/usr/lib64/pkgconfig
+ # depending on whether the systemroot is for a 32 or 64 bit architecture.
+ #
+ # When build under GYP, CrOS board builds specify the 'system_libdir' variable
+ # as part of the GYP_DEFINES provided by the CrOS emerge build or simple
+ # chrome build scheme. This variable permits controlling this for GN builds
+ # in similar fashion by setting the `system_libdir` variable in the build's
+ # args.gn file to 'lib' or 'lib64' as appropriate for the target architecture.
+ system_libdir = "lib"
}
pkg_config_script = "//build/config/linux/pkg-config.py"
@@ -44,11 +55,15 @@ if (sysroot != "") {
sysroot,
"-a",
current_cpu,
+ "--system_libdir",
+ system_libdir,
]
} else if (pkg_config != "") {
pkg_config_args = [
"-p",
pkg_config,
+ "--system_libdir",
+ system_libdir,
]
} else {
pkg_config_args = []