diff --git a/config/linux/pkg-config.py b/config/linux/pkg-config.py index c1c0dc4f5..70cb5e961 100644 --- a/config/linux/pkg-config.py +++ b/config/linux/pkg-config.py @@ -12,8 +12,8 @@ from optparse import OptionParser # This script runs pkg-config, optionally filtering out some results, and # returns the result. # -# The result will be [ , , , ] where each -# member is itself a list of strings. +# The result will be [ , , , , ] +# where each member is itself a list of strings. # # You can filter out matches using "-v " where all results from # pkgconfig matching the given regular expression will be ignored. You can @@ -138,6 +138,7 @@ includes = [] cflags = [] libs = [] lib_dirs = [] +ldflags = [] for flag in all_flags[:]: if len(flag) == 0 or MatchesAnyRegexp(flag, strip_out): @@ -145,14 +146,21 @@ for flag in all_flags[:]: if flag[:2] == '-l': libs.append(RewritePath(flag[2:], prefix, sysroot)) - if flag[:2] == '-L': + elif flag[:2] == '-L': lib_dirs.append(RewritePath(flag[2:], prefix, sysroot)) elif flag[:2] == '-I': 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/config/linux/pkg_config.gni b/config/linux/pkg_config.gni index dd592236a..fdd31ba84 100644 --- a/config/linux/pkg_config.gni +++ b/config/linux/pkg_config.gni @@ -34,5 +34,6 @@ template("pkg_config") { cflags = pkgresult[1] libs = pkgresult[2] lib_dirs = pkgresult[3] + ldflags = pkgresult[4] } } diff --git a/toolchain/linux/BUILD.gn b/toolchain/linux/BUILD.gn index 74d287fec..38f4b184c 100644 --- a/toolchain/linux/BUILD.gn +++ b/toolchain/linux/BUILD.gn @@ -2,10 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("../clang.gni") -import("../goma.gni") -import("../gcc_toolchain.gni") import("//build/config/sysroot.gni") +import("//build/toolchain/clang.gni") +import("//build/toolchain/gcc_toolchain.gni") +import("//build/toolchain/goma.gni") if (is_gyp) { # Set the compilers for GYP to use. This logic is only relevant to GYP where @@ -47,8 +47,6 @@ if (is_gyp) { } } -# ARM -------------------------------------------------------------------------- - gcc_toolchain("arm") { cc = "arm-linux-gnueabi-gcc" cxx = "arm-linux-gnueabi-g++" @@ -59,11 +57,22 @@ gcc_toolchain("arm") { toolchain_os = "linux" } -# 32-bit ----------------------------------------------------------------------- - gcc_toolchain("x86") { - cc = "gcc" - cxx = "g++" + if (is_clang) { + if (use_clang_type_profiler) { + prefix = rebase_path("//third_party/llvm-allocated-type/Linux_ia32/bin", + ".", root_build_dir) + } else { + prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", + ".", root_build_dir) + } + cc = "$prefix/clang" + cxx = "$prefix/clang++" + } else { + cc = "gcc" + cxx = "g++" + } + ar = "ar" ld = cxx @@ -72,8 +81,21 @@ gcc_toolchain("x86") { } gcc_toolchain("x64") { - cc = "gcc" - cxx = "g++" + if (is_clang) { + if (use_clang_type_profiler) { + prefix = rebase_path("//third_party/llvm-allocated-type/Linux_x64/bin", + ".", root_build_dir) + } else { + prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", + ".", root_build_dir) + } + cc = "$prefix/clang" + cxx = "$prefix/clang++" + } else { + cc = "gcc" + cxx = "g++" + } + ar = "ar" ld = cxx @@ -81,8 +103,6 @@ gcc_toolchain("x64") { toolchain_os = "linux" } -# MIPS ----------------------------------------------------------------------- - gcc_toolchain("mipsel") { cc = "mipsel-linux-gnu-gcc" cxx = "mipsel-linux-gnu-g++"