Chromium Code Reviews| Index: build/go/rules.gni |
| diff --git a/build/go/rules.gni b/build/go/rules.gni |
| index 79453d1872a9c9c2854814a6db284be13ec2a000..9825c1a1a30348a2dad275a33e761b02273e194c 100644 |
| --- a/build/go/rules.gni |
| +++ b/build/go/rules.gni |
| @@ -59,3 +59,40 @@ template("go_test_binary") { |
| ] + rebase_path(invoker.sources, build_dir) |
| } |
| } |
| + |
| +template("go_shared_library") { |
| + # Only available on linux for now. |
|
jamesr
2014/10/29 00:07:27
did you mean to assert(is_linux) here ?
gauthamt
2014/10/29 00:22:25
Actually, it works only on android. Changed commen
|
| + assert(defined(invoker.sources)) |
| + assert(go_build_tool != "") |
| + |
| + static_library_name = target_name + "_static_library" |
| + |
| + static_library(static_library_name) { |
| + complete_static_lib = true |
| + deps = invoker.deps |
| + } |
| + |
| + action(target_name) { |
| + deps = [ |
| + ":$static_library_name", |
|
jamesr
2014/10/29 00:07:27
nit: for one entry lists we prefer one-line e.g.
gauthamt
2014/10/29 00:22:25
Done.
|
| + ] |
| + script = "//build/go/go.py" |
| + outputs = [ "${target_out_dir}/${target_name}" ] |
| + # Since go test does not permit specifying an output directory or output |
| + # binary name, we create a temporary build directory, and the python |
| + # script will later identify the output, copy it to the target location, |
| + # and clean up the temporary build directory. |
| + build_dir = "${target_out_dir}/${target_name}_build" |
| + args = [ |
| + "--", |
| + "CGO_ENABLED=1 GOOS=android GOARCH=arm GOARM=7 ${go_build_tool}", |
| + rebase_path(build_dir, root_build_dir), |
| + rebase_path(target_out_dir, root_build_dir) + "/${target_name}", |
| + rebase_path("//", root_build_dir), |
| + "-I" + rebase_path("//"), |
| + " -L" + rebase_path(target_out_dir) + |
| + " -l" + static_library_name + "", |
| + "build -ldflags=-shared", |
| + ] + rebase_path(invoker.sources, build_dir) |
| + } |
| +} |