[M73 Dev][EFL] Fix errors to generate ninja files
[platform/framework/web/chromium-efl.git] / build / symlink.gni
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 # Creates a symlink.
6 # Args:
7 #   source: Path to link to.
8 #   output: Where to create the symlink.
9 template("symlink") {
10   action(target_name) {
11     forward_variables_from(invoker,
12                            [
13                              "data_deps",
14                              "deps",
15                              "testonly",
16                              "visibility",
17                            ])
18     outputs = [
19       invoker.output,
20     ]
21     script = "//build/symlink.py"
22     args = [
23       "-f",
24       rebase_path(invoker.source, get_path_info(invoker.output, "dir")),
25       rebase_path(invoker.output, root_build_dir),
26     ]
27   }
28 }
29
30 # Creates a symlink from root_build_dir/target_name to |binary_label|. This rule
31 # is meant to be used within if (current_toolchain == default_toolchain) blocks
32 # and point to targets in the non-default toolchain.
33 # Note that for executables, using a copy (as opposed to a symlink) does not
34 # work when is_component_build=true, since dependent libraries are found via
35 # relative location.
36 #
37 # Args:
38 #   binary_label: Target that builds the file to symlink to. e.g.:
39 #       ":$target_name($host_toolchain)".
40 #   binary_output_name: The output_name set by the binary_label target
41 #       (if applicable).
42 #   output_name: Where to create the symlink
43 #       (default="$root_out_dir/$binary_output_name").
44 #
45 # Example:
46 #   if (current_toolchain == host_toolchain) {
47 #     executable("foo") { ... }
48 #   } else if (current_toolchain == default_toolchain) {
49 #     binary_symlink("foo") {
50 #       binary_label = ":foo($host_toolchain)"
51 #     }
52 #   }
53 template("binary_symlink") {
54   symlink(target_name) {
55     forward_variables_from(invoker,
56                            [
57                              "output",
58                              "testonly",
59                              "visibility",
60                            ])
61     deps = [
62       invoker.binary_label,
63     ]
64     data_deps = [
65       invoker.binary_label,
66     ]
67     if (defined(invoker.data_deps)) {
68       data_deps += invoker.data_deps
69     }
70
71     _out_dir = get_label_info(invoker.binary_label, "root_out_dir")
72     if (defined(invoker.binary_output_name)) {
73       _name = invoker.binary_output_name
74     } else {
75       _name = get_label_info(invoker.binary_label, "name")
76     }
77     source = "$_out_dir/$_name"
78
79     _output_name = _name
80     if (defined(invoker.output_name)) {
81       _output_name = invoker.output_name
82     }
83     output = "$root_out_dir/$_output_name"
84   }
85 }