Commit 6241d536 authored by brettw@chromium.org's avatar brettw@chromium.org

Update .gn files to use new template syntax.

This uses the invoker() syntax.

R=scottmg@chromium.org, scottmg

Review URL: https://codereview.chromium.org/212843007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260151 0039d316-1c4b-4281-b951-d872f2087c98
parent b90439bd
...@@ -19,14 +19,14 @@ import("//build/config/sysroot.gni") ...@@ -19,14 +19,14 @@ import("//build/config/sysroot.gni")
# } # }
template("pkg_config") { template("pkg_config") {
assert(defined(packages), assert(defined(invoker.packages),
"Variable |packages| must be defined to be a list in pkg_config.") "Variable |packages| must be defined to be a list in pkg_config.")
config(target_name) { config(target_name) {
if (sysroot != "") { if (sysroot != "") {
# Pass the sysroot if we're using one (it requires the CPU arch also). # Pass the sysroot if we're using one (it requires the CPU arch also).
args = ["-s", sysroot, "-a", cpu_arch] + packages args = ["-s", sysroot, "-a", cpu_arch] + invoker.packages
} else { } else {
args = packages args = invoker.packages
} }
pkgresult = exec_script("//build/config/linux/pkg-config.py", pkgresult = exec_script("//build/config/linux/pkg-config.py",
args, "value") args, "value")
...@@ -35,5 +35,9 @@ template("pkg_config") { ...@@ -35,5 +35,9 @@ template("pkg_config") {
libs = pkgresult[2] libs = pkgresult[2]
lib_dirs = pkgresult[3] lib_dirs = pkgresult[3]
ldflags = pkgresult[4] ldflags = pkgresult[4]
if (defined(invoker.defines)) {
defines = invoker.defines
}
} }
} }
...@@ -16,6 +16,23 @@ ...@@ -16,6 +16,23 @@
# toolchain.) # toolchain.)
template("gcc_toolchain") { template("gcc_toolchain") {
toolchain(target_name) { toolchain(target_name) {
assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value")
assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value")
assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value")
assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ld\" value")
assert(defined(invoker.toolchain_cpu_arch),
"gcc_toolchain() must specify a \"toolchain_cpu_arch\"")
assert(defined(invoker.toolchain_os),
"gcc_toolchain() must specify a \"toolchain_os\"")
# We can't do string interpolation ($ in strings) on things with dots in
# them. To allow us to use $cc below, for example, we create copies of
# these values in our scope.
cc = invoker.cc
cxx = invoker.cxx
ar = invoker.ar
ld = invoker.ld
# Make these apply to all tools below. # Make these apply to all tools below.
lib_prefix = "-l" lib_prefix = "-l"
lib_dir_prefix="-L" lib_dir_prefix="-L"
...@@ -61,8 +78,8 @@ template("gcc_toolchain") { ...@@ -61,8 +78,8 @@ template("gcc_toolchain") {
# When invoking this toolchain not as the default one, these args will be # When invoking this toolchain not as the default one, these args will be
# passed to the build. They are ignored when this is the default toolchain. # passed to the build. They are ignored when this is the default toolchain.
toolchain_args() { toolchain_args() {
cpu_arch = toolchain_cpu_arch cpu_arch = invoker.toolchain_cpu_arch
os = toolchain_os os = invoker.toolchain_os
} }
} }
} }
ade654e0c892453f382cf72afeb3dcf6dafaf9fc 19d0fda98eff41476d011f24ccc40e9740d8eb5c
\ No newline at end of file \ No newline at end of file
abd05606b6f4a809c44c114e5897aae405853fd9 fdbb87e903677c6aeb66ba0e0edf1e7ffaef32bc
\ No newline at end of file \ No newline at end of file
e1de81ffac848645ff07e9b52be6d4a42c022890 21ac865cd8d426cf46c1061190c7bd5e98d5fe3f
f719db572913a20db5f85290bd48dc7754700d37 a6e110ec959cd56c82e0c8d03546209f85ff2ac8
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
# # files. # # files.
# } # }
template("grit") { template("grit") {
assert(defined(source), assert(defined(invoker.source),
"\"source\" must be defined for the grit template $target_name") "\"source\" must be defined for the grit template $target_name")
assert(!defined(sources) && !defined(outputs), assert(!defined(invoker.sources) && !defined(invoker.outputs),
"Neither \"sources\" nor \"outputs\" can be defined for the grit " + "Neither \"sources\" nor \"outputs\" can be defined for the grit " +
"template $target_name") "template $target_name")
...@@ -26,9 +26,11 @@ template("grit") { ...@@ -26,9 +26,11 @@ template("grit") {
resource_ids = resource_ids =
rebase_path("//tools/gritsettings/resource_ids", root_build_dir) rebase_path("//tools/gritsettings/resource_ids", root_build_dir)
output_dir = rebase_path(target_gen_dir, root_build_dir) output_dir = rebase_path(target_gen_dir, root_build_dir)
source_path = rebase_path(source, root_build_dir) source_path = rebase_path(invoker.source, root_build_dir)
if (!defined(grit_flags)) { if (defined(invoker.grit_flags)) {
grit_flags = invoker.grit_flags
} else {
grit_flags = [] # These are optional so default to empty list. grit_flags = [] # These are optional so default to empty list.
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment