OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/linux/pkg_config.gni") | 5 import("//build/config/linux/pkg_config.gni") |
6 import("//build/config/sysroot.gni") | 6 import("//build/config/sysroot.gni") |
7 | 7 |
8 config("sdk") { | 8 config("sdk") { |
9 if (sysroot != "") { | 9 if (sysroot != "") { |
10 cflags = [ "--sysroot=" + sysroot ] | 10 cflags = [ "--sysroot=" + sysroot ] |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 config("libresolv") { | 76 config("libresolv") { |
77 libs = [ "resolv" ] | 77 libs = [ "resolv" ] |
78 } | 78 } |
79 | 79 |
80 pkg_config("gconf") { | 80 pkg_config("gconf") { |
81 packages = [ "gconf-2.0" ] | 81 packages = [ "gconf-2.0" ] |
82 defines = [ "USE_GCONF" ] | 82 defines = [ "USE_GCONF" ] |
83 } | 83 } |
84 | 84 |
| 85 # name: Name to use for the value of the --name arg. |
| 86 # output_h/output_cc: Names for the generated header/cc file with no dir. |
| 87 # header: header file to process. Example: "<foo/bar.h>" |
| 88 # functions: List of strings for functions to process. |
| 89 # config: Label of the config generated by pkgconfig. |
| 90 template("generate_library_loader") { |
| 91 output_h = "$root_gen_dir/library_loaders/" + invoker.output_h |
| 92 output_cc = "$root_gen_dir/library_loaders/" + invoker.output_cc |
| 93 |
| 94 action_visibility = ":$target_name" |
| 95 action("${target_name}_loader") { |
| 96 visibility = action_visibility |
| 97 |
| 98 script = "//tools/generate_library_loader/generate_library_loader.py" |
| 99 if (defined(invoker.visibility)) { |
| 100 visibility = invoker.visibility |
| 101 } |
| 102 |
| 103 outputs = [ output_h, output_cc ] |
| 104 |
| 105 args = [ |
| 106 "--name", invoker.name, |
| 107 "--output-h", rebase_path(output_h), |
| 108 "--output-cc", rebase_path(output_cc), |
| 109 "--header", invoker.header, |
| 110 # Note GYP build exposes a per-target variable to control this, which, if |
| 111 # manually set to true, will disable dlopen(). Its not clear this is |
| 112 # needed, so here we just leave off. If this can be done globally, we |
| 113 # can expose one switch for this value, otherwise we need to add a templat
e |
| 114 # param for this. |
| 115 "--link-directly=0", |
| 116 ] + invoker.functions |
| 117 } |
| 118 |
| 119 source_set(target_name) { |
| 120 direct_dependent_configs = [ invoker.config ] |
| 121 sources = [ output_h, output_cc ] |
| 122 deps = [ ":${target_name}_loader" ] |
| 123 } |
| 124 } |
| 125 |
85 pkg_config("gio_config") { | 126 pkg_config("gio_config") { |
86 packages = [ "gio-2.0" ] | 127 packages = [ "gio-2.0" ] |
87 defines = [ "USE_GIO" ] | 128 defines = [ "USE_GIO" ] |
| 129 ignore_libs = true # Loader generated below. |
88 } | 130 } |
89 | 131 |
90 gio_output_h = "$root_gen_dir/library_loaders/libgio.h" | 132 # This generates a target named "gio". |
91 gio_output_cc = "$root_gen_dir/library_loaders/libgio_loader.cc" | 133 generate_library_loader("gio") { |
| 134 name = "LibGioLoader" |
| 135 output_h = "libgio.h" |
| 136 output_cc = "libgio_loader.cc" |
| 137 # TODO(brettw) convert ti "<gio/gio.h>" once GN doesn't mangle <>. |
| 138 header = "\"gio/gio.h\"" |
| 139 config = ":gio_config" |
92 | 140 |
93 action("make_gio_headers") { | 141 functions = [ |
94 visibility = ":gio" | |
95 | |
96 script = "//tools/generate_library_loader/generate_library_loader.py" | |
97 | |
98 outputs = [ gio_output_h, gio_output_cc ] | |
99 | |
100 args = [ | |
101 "--name", "LibGioLoader", | |
102 "--output-h", rebase_path(gio_output_h), | |
103 "--output-cc", rebase_path(gio_output_cc), | |
104 # TODO(brettw) convert ti "<gio/gio.h>" once GN doesn't mangle <>. | |
105 "--header", "\"gio/gio.h\"", | |
106 # Note GYP build exposes a variable linux_link_gsettings to control this, | |
107 # which, if manually set to true, will disable dlopen() for this. Its not | |
108 # clear this is needed, so here we just leave off. | |
109 "--link-directly=0", | |
110 "g_settings_new", | 142 "g_settings_new", |
111 "g_settings_get_child", | 143 "g_settings_get_child", |
112 "g_settings_get_string", | 144 "g_settings_get_string", |
113 "g_settings_get_boolean", | 145 "g_settings_get_boolean", |
114 "g_settings_get_int", | 146 "g_settings_get_int", |
115 "g_settings_get_strv", | 147 "g_settings_get_strv", |
116 "g_settings_list_schemas", | 148 "g_settings_list_schemas", |
117 ] | 149 ] |
118 } | 150 } |
119 | 151 |
120 source_set("gio") { | 152 # pkgconfig doesn't return anything interesting for this other than -lpci |
121 direct_dependent_configs = [ ":gio_config" ] | 153 # on suppotred systems, so we hardcode. |
122 sources = [ gio_output_h, gio_output_cc ] | 154 config("libpci_config") { |
123 deps = [ ":make_gio_headers" ] | 155 # This is not needed as long as we're setting link_directly=0 for the library |
| 156 # loaders. |
| 157 #libs = [ "pci" ] |
124 } | 158 } |
| 159 |
| 160 # This generates a target named "libpci". |
| 161 generate_library_loader("libpci") { |
| 162 name = "LibPciLoader" |
| 163 output_h = "libpci.h" |
| 164 output_cc = "libpci_loader.cc" |
| 165 # TODO(brettw) convert to "<pci/pci.h>" once GN doesn't mangle <>. |
| 166 header = "\"pci/pci.h\"" |
| 167 config = ":libpci_config" |
| 168 |
| 169 functions = [ |
| 170 "pci_alloc", |
| 171 "pci_init", |
| 172 "pci_cleanup", |
| 173 "pci_scan_bus", |
| 174 "pci_fill_info", |
| 175 "pci_lookup_name", |
| 176 ] |
| 177 } |
OLD | NEW |