diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-08 14:30:41 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-12 13:49:54 +0200 |
commit | ab0a50979b9eb4dfa3320eff7e187e41efedf7a9 (patch) | |
tree | 498dfb8a97ff3361a9f7486863a52bb4e26bb898 /chromium/build/config/linux | |
parent | 4ce69f7403811819800e7c5ae1318b2647e778d1 (diff) | |
download | qtwebengine-chromium-ab0a50979b9eb4dfa3320eff7e187e41efedf7a9.tar.gz |
Update Chromium to beta version 37.0.2062.68
Change-Id: I188e3b5aff1bec75566014291b654eb19f5bc8ca
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/build/config/linux')
-rw-r--r-- | chromium/build/config/linux/BUILD.gn | 161 | ||||
-rw-r--r-- | chromium/build/config/linux/pkg-config.py | 123 | ||||
-rw-r--r-- | chromium/build/config/linux/pkg_config.gni | 38 | ||||
-rw-r--r-- | chromium/build/config/linux/sysroot.gni | 27 | ||||
-rw-r--r-- | chromium/build/config/linux/sysroot_ld_path.py | 20 |
5 files changed, 311 insertions, 58 deletions
diff --git a/chromium/build/config/linux/BUILD.gn b/chromium/build/config/linux/BUILD.gn index a7b841c7adc..bfe242c3f7b 100644 --- a/chromium/build/config/linux/BUILD.gn +++ b/chromium/build/config/linux/BUILD.gn @@ -2,17 +2,25 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("pkg_config.gni") +import("//build/config/linux/pkg_config.gni") +import("//build/config/sysroot.gni") +import("//build/config/ui.gni") -# Sets up the dynamic library search path to include our "lib" directory. -config("executable_ldconfig") { - ldflags = [ - # Want to pass "\$". Need to escape both '\' and '$'. GN will re-escape as - # required for ninja. - "-Wl,-rpath=\\\$ORIGIN/lib/", +config("sdk") { + if (sysroot != "") { + cflags = [ "--sysroot=" + sysroot ] + ldflags = [ "--sysroot=" + sysroot ] - "-Wl,-rpath-link=lib/", - ] + # Need to get some linker flags out of the sysroot. + ldflags += [ exec_script("sysroot_ld_path.py", + [ rebase_path("//build/linux/sysroot_ld_path.sh", root_build_dir), + sysroot ], + "value") ] + } +} + +pkg_config("dridrm") { + packages = [ "libdrm" ] } config("fontconfig") { @@ -31,7 +39,6 @@ pkg_config("gtk") { # Gtk requires gmodule, but it does not list it as a dependency in some # misconfigured systems. packages = [ "gmodule-2.0", "gtk+-2.0", "gthread-2.0" ] - defines = [ "TOOLKIT_GTK" ] } pkg_config("pangocairo") { @@ -42,10 +49,25 @@ pkg_config("udev") { packages = [ "libudev" ] } +# Note: if your target also depends on //dbus, you don't need to add this +# config (it will get added automatically if you depend on //dbus). +pkg_config("dbus") { + packages = [ "dbus-1" ] +} + +if (use_evdev_gestures) { + pkg_config("libevdev-cros") { + packages = [ "libevdev-cros" ] + } + + pkg_config("libgestures") { + packages = [ "libgestures" ] + } +} + config("x11") { # Don't bother running pkg-config for these X related libraries since it just # returns the same libs, and forking pkg-config is slow. - defines = [ "USE_X11" ] libs = [ "X11", "Xcomposite", @@ -59,3 +81,120 @@ config("x11") { "Xtst", ] } + +config("xcomposite") { + libs = [ "Xcomposite" ] +} + +config("xext") { + libs = [ "Xext" ] +} + +config("xrandr") { + libs = [ "xrandr" ] +} + +config("libcap") { + libs = [ "cap" ] +} + +config("libresolv") { + libs = [ "resolv" ] +} + +pkg_config("gconf") { + packages = [ "gconf-2.0" ] + defines = [ "USE_GCONF" ] +} + +# name: Name to use for the value of the --name arg. +# output_h/output_cc: Names for the generated header/cc file with no dir. +# header: header file to process. Example: "<foo/bar.h>" +# functions: List of strings for functions to process. +# config: Label of the config generated by pkgconfig. +template("generate_library_loader") { + output_h = "$root_gen_dir/library_loaders/" + invoker.output_h + output_cc = "$root_gen_dir/library_loaders/" + invoker.output_cc + + action_visibility = ":$target_name" + action("${target_name}_loader") { + visibility = action_visibility + + script = "//tools/generate_library_loader/generate_library_loader.py" + if (defined(invoker.visibility)) { + visibility = invoker.visibility + } + + outputs = [ output_h, output_cc ] + + args = [ + "--name", invoker.name, + "--output-h", rebase_path(output_h), + "--output-cc", rebase_path(output_cc), + "--header", invoker.header, + # Note GYP build exposes a per-target variable to control this, which, if + # manually set to true, will disable dlopen(). Its not clear this is + # needed, so here we just leave off. If this can be done globally, we + # can expose one switch for this value, otherwise we need to add a template + # param for this. + "--link-directly=0", + ] + invoker.functions + } + + source_set(target_name) { + direct_dependent_configs = [ invoker.config ] + sources = [ output_h, output_cc ] + deps = [ ":${target_name}_loader" ] + } +} + +pkg_config("gio_config") { + packages = [ "gio-2.0" ] + defines = [ "USE_GIO" ] + ignore_libs = true # Loader generated below. +} + +# This generates a target named "gio". +generate_library_loader("gio") { + name = "LibGioLoader" + output_h = "libgio.h" + output_cc = "libgio_loader.cc" + header = "<gio/gio.h>" + config = ":gio_config" + + functions = [ + "g_settings_new", + "g_settings_get_child", + "g_settings_get_string", + "g_settings_get_boolean", + "g_settings_get_int", + "g_settings_get_strv", + "g_settings_list_schemas", + ] +} + +# pkgconfig doesn't return anything interesting for this other than -lpci +# on suppotred systems, so we hardcode. +config("libpci_config") { + # This is not needed as long as we're setting link_directly=0 for the library + # loaders. + #libs = [ "pci" ] +} + +# This generates a target named "libpci". +generate_library_loader("libpci") { + name = "LibPciLoader" + output_h = "libpci.h" + output_cc = "libpci_loader.cc" + header = "<pci/pci.h>" + config = ":libpci_config" + + functions = [ + "pci_alloc", + "pci_init", + "pci_cleanup", + "pci_scan_bus", + "pci_fill_info", + "pci_lookup_name", + ] +} diff --git a/chromium/build/config/linux/pkg-config.py b/chromium/build/config/linux/pkg-config.py index 40988d9792e..b107e74f277 100644 --- a/chromium/build/config/linux/pkg-config.py +++ b/chromium/build/config/linux/pkg-config.py @@ -3,6 +3,7 @@ # found in the LICENSE file. import json +import os import subprocess import sys import re @@ -11,22 +12,98 @@ from optparse import OptionParser # This script runs pkg-config, optionally filtering out some results, and # returns the result. # -# The result will be [ <includes>, <cflags>, <libs>, <lib_dirs> ] where each -# member is itself a list of strings. +# The result will be [ <includes>, <cflags>, <libs>, <lib_dirs>, <ldflags> ] +# where each member is itself a list of strings. # # You can filter out matches using "-v <regexp>" where all results from # pkgconfig matching the given regular expression will be ignored. You can # specify more than one regular expression my specifying "-v" more than once. +# +# You can specify a sysroot using "-s <sysroot>" where sysroot is the absolute +# system path to the sysroot used for compiling. This script will attempt to +# generate correct paths for the sysroot. +# +# When using a sysroot, you must also specify the architecture via +# "-a <arch>" where arch is either "x86" or "x64". # If this is run on non-Linux platforms, just return nothing and indicate # success. This allows us to "kind of emulate" a Linux build from other # platforms. if sys.platform.find("linux") == -1: - print "[[],[],[]]" + print "[[],[],[],[],[]]" sys.exit(0) + +def SetConfigPath(options): + """Set the PKG_CONFIG_PATH environment variable. + This takes into account any sysroot and architecture specification from the + options on the given command line.""" + + sysroot = options.sysroot + if not sysroot: + sysroot = "" + + # Compute the library path name based on the architecture. + arch = options.arch + if sysroot and not arch: + print "You must specify an architecture via -a if using a sysroot." + sys.exit(1) + if arch == 'x64': + libpath = 'lib64' + else: + libpath = 'lib' + + # Add the sysroot path to the environment's PKG_CONFIG_PATH + config_path = sysroot + '/usr/' + libpath + '/pkgconfig' + config_path += ':' + sysroot + '/usr/share/pkgconfig' + if 'PKG_CONFIG_PATH' in os.environ: + os.environ['PKG_CONFIG_PATH'] += ':' + config_path + else: + os.environ['PKG_CONFIG_PATH'] = config_path + + +def GetPkgConfigPrefixToStrip(args): + """Returns the prefix from pkg-config where packages are installed. + This returned prefix is the one that should be stripped from the beginning of + directory names to take into account sysroots.""" + # Some sysroots, like the Chromium OS ones, may generate paths that are not + # relative to the sysroot. For example, + # /path/to/chroot/build/x86-generic/usr/lib/pkgconfig/pkg.pc may have all + # paths relative to /path/to/chroot (i.e. prefix=/build/x86-generic/usr) + # instead of relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr). + # To support this correctly, it's necessary to extract the prefix to strip + # from pkg-config's |prefix| variable. + prefix = subprocess.check_output(["pkg-config", "--variable=prefix"] + args, + env=os.environ) + if prefix[-4] == '/usr': + return prefix[4:] + return prefix + + +def MatchesAnyRegexp(flag, list_of_regexps): + """Returns true if the first argument matches any regular expression in the + given list.""" + for regexp in list_of_regexps: + if regexp.search(flag) != None: + return True + return False + + +def RewritePath(path, strip_prefix, sysroot): + """Rewrites a path by stripping the prefix and prepending the sysroot.""" + if os.path.isabs(path) and not path.startswith(sysroot): + if path.startswith(strip_prefix): + path = path[len(strip_prefix):] + path = path.lstrip('/') + return os.path.join(sysroot, path) + else: + return path + + parser = OptionParser() 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') (options, args) = parser.parse_args() # Make a list of regular expressions to strip out. @@ -35,9 +112,16 @@ if options.strip_out != None: for regexp in options.strip_out: strip_out.append(re.compile(regexp)) +SetConfigPath(options) +if options.sysroot: + prefix = GetPkgConfigPrefixToStrip(args) +else: + prefix = '' + try: - flag_string = subprocess.check_output(["pkg-config", "--cflags", "--libs"] + - args) + flag_string = subprocess.check_output( + [ "pkg-config", "--cflags", "--libs-only-l", "--libs-only-L" ] + + args, env=os.environ) # For now just split on spaces to get the args out. This will break if # pkgconfig returns quoted things with spaces in them, but that doesn't seem # to happen in practice. @@ -46,31 +130,38 @@ except: print "Could not run pkg-config." sys.exit(1) + +sysroot = options.sysroot +if not sysroot: + sysroot = '' + includes = [] cflags = [] libs = [] lib_dirs = [] - -def MatchesAnyRegexp(flag, list_of_regexps): - for regexp in list_of_regexps: - if regexp.search(flag) != None: - return True - return False +ldflags = [] for flag in all_flags[:]: if len(flag) == 0 or MatchesAnyRegexp(flag, strip_out): continue; if flag[:2] == '-l': - libs.append(flag[2:]) - if flag[:2] == '-L': - lib_dirs.append(flag[2:]) + libs.append(RewritePath(flag[2:], prefix, sysroot)) + elif flag[:2] == '-L': + lib_dirs.append(RewritePath(flag[2:], prefix, sysroot)) elif flag[:2] == '-I': - includes.append(flag[2:]) + includes.append(RewritePath(flag[2:], prefix, sysroot)) + elif flag[:3] == '-Wl': + ldflags.append(flag) + elif flag == '-pthread': + # Many libs specify "-pthread" which we don't need since we always include + # this anyway. Removing it here prevents a bunch of duplicate inclusions on + # the command line. + pass else: cflags.append(flag) # Output a GN array, the first one is the cflags, the second are the libs. The # JSON formatter prints GN compatible lists when everything is a list of # strings. -print json.dumps([includes, cflags, libs, lib_dirs]) +print json.dumps([includes, cflags, libs, lib_dirs, ldflags]) diff --git a/chromium/build/config/linux/pkg_config.gni b/chromium/build/config/linux/pkg_config.gni index 50e21f1d009..46f7d7590e6 100644 --- a/chromium/build/config/linux/pkg_config.gni +++ b/chromium/build/config/linux/pkg_config.gni @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/sysroot.gni") + # Defines a config specifying the result of running pkg-config for the given # packages. Put the package names you want to query in the "packages" variable # inside the template invocation. @@ -15,16 +17,44 @@ # packages = [ "mything1", "mything2" ] # defines = [ "ENABLE_AWESOME" ] # } +# +# You can also use "extra args" to filter out results (see pkg-config.py): +# extra_args = [ "-v, "foo" ] +# To ignore libs and ldflags (only cflags/defines will be set, which is useful +# when doing manual dynamic linking), set: +# ignore_libs = true template("pkg_config") { - assert(defined(packages), + assert(defined(invoker.packages), "Variable |packages| must be defined to be a list in pkg_config.") config(target_name) { + if (sysroot != "") { + # Pass the sysroot if we're using one (it requires the CPU arch also). + args = ["-s", sysroot, "-a", cpu_arch] + invoker.packages + } else { + args = invoker.packages + } + + if (defined(invoker.extra_args)) { + args += invoker.extra_args + } + pkgresult = exec_script("//build/config/linux/pkg-config.py", - packages, "value") + args, "value") include_dirs = pkgresult[0] cflags = pkgresult[1] - libs = pkgresult[2] - lib_dirs = pkgresult[3] + + if (!defined(invoker.ignore_libs) || !invoker.ignore_libs) { + libs = pkgresult[2] + lib_dirs = pkgresult[3] + ldflags = pkgresult[4] + } + + if (defined(invoker.defines)) { + defines = invoker.defines + } + if (defined(invoker.visibility)) { + visibility = invoker.visibility + } } } diff --git a/chromium/build/config/linux/sysroot.gni b/chromium/build/config/linux/sysroot.gni deleted file mode 100644 index 78a8790d869..00000000000 --- a/chromium/build/config/linux/sysroot.gni +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This header file defines the "sysroot" variable which is the absolute path -# of the sysroot. If no sysroot applies, the variable will be an empty string. - -# For official builds, use the sysroot checked into the internal source repo so -# that the builds work on older versions of Linux. -if (is_linux && is_chrome_branded && is_official_build && !is_chromeos) { - if (cpu_arch == "x64") { - sysroot = rebase_path( - "//chrome/installer/linux/debian_wheezy_amd64-sysroot", ".", "") - } else if (cpu_arch == "x86") { - sysroot = rebase_path( - "//chrome/installer/linux/debian_wheezy_i386-sysroot", ".", "") - } else { - assert(false, - "Official builds on non-x86/64 processors not supported.") - } -} else if (is_mac) { - # Set which SDK to use. - # TODO(brettw) this needs to be configurable somehow. - sysroot = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk" -} else { - sysroot = "" -} diff --git a/chromium/build/config/linux/sysroot_ld_path.py b/chromium/build/config/linux/sysroot_ld_path.py new file mode 100644 index 00000000000..4bce7ee3e2b --- /dev/null +++ b/chromium/build/config/linux/sysroot_ld_path.py @@ -0,0 +1,20 @@ +# Copyright (c) 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This file takes two arguments, the relative location of the shell script that +# does the checking, and the name of the sysroot. + +# TODO(brettw) the build/linux/sysroot_ld_path.sh script should be rewritten in +# Python in this file. + +import subprocess +import sys + +if len(sys.argv) != 3: + print "Need two arguments" + sys.exit(1) + +result = subprocess.check_output([sys.argv[1], sys.argv[2]]).strip() + +print '"' + result + '"' |