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 import("//build/config/ui.gni") | 7 import("//build/config/ui.gni") |
| 8 import("//tools/generate_library_loader/generate_library_loader.gni") |
8 | 9 |
9 config("sdk") { | 10 config("sdk") { |
10 if (sysroot != "") { | 11 if (sysroot != "") { |
11 cflags = [ "--sysroot=" + sysroot ] | 12 cflags = [ "--sysroot=" + sysroot ] |
12 ldflags = [ "--sysroot=" + sysroot ] | 13 ldflags = [ "--sysroot=" + sysroot ] |
13 | 14 |
14 # Need to get some linker flags out of the sysroot. | 15 # Need to get some linker flags out of the sysroot. |
15 ldflags += [ exec_script("sysroot_ld_path.py", | 16 ldflags += [ exec_script("sysroot_ld_path.py", |
16 [ rebase_path("//build/linux/sysroot_ld_path.sh", root_build_dir), | 17 [ rebase_path("//build/linux/sysroot_ld_path.sh", root_build_dir), |
17 sysroot ], | 18 sysroot ], |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 101 |
101 config("libresolv") { | 102 config("libresolv") { |
102 libs = [ "resolv" ] | 103 libs = [ "resolv" ] |
103 } | 104 } |
104 | 105 |
105 pkg_config("gconf") { | 106 pkg_config("gconf") { |
106 packages = [ "gconf-2.0" ] | 107 packages = [ "gconf-2.0" ] |
107 defines = [ "USE_GCONF" ] | 108 defines = [ "USE_GCONF" ] |
108 } | 109 } |
109 | 110 |
110 # name: Name to use for the value of the --name arg. | |
111 # output_h/output_cc: Names for the generated header/cc file with no dir. | |
112 # header: header file to process. Example: "<foo/bar.h>" | |
113 # functions: List of strings for functions to process. | |
114 # config: Label of the config generated by pkgconfig. | |
115 template("generate_library_loader") { | |
116 output_h = "$root_gen_dir/library_loaders/" + invoker.output_h | |
117 output_cc = "$root_gen_dir/library_loaders/" + invoker.output_cc | |
118 | |
119 action_visibility = ":$target_name" | |
120 action("${target_name}_loader") { | |
121 visibility = action_visibility | |
122 | |
123 script = "//tools/generate_library_loader/generate_library_loader.py" | |
124 if (defined(invoker.visibility)) { | |
125 visibility = invoker.visibility | |
126 } | |
127 | |
128 outputs = [ output_h, output_cc ] | |
129 | |
130 args = [ | |
131 "--name", invoker.name, | |
132 "--output-h", rebase_path(output_h), | |
133 "--output-cc", rebase_path(output_cc), | |
134 "--header", invoker.header, | |
135 # Note GYP build exposes a per-target variable to control this, which, if | |
136 # manually set to true, will disable dlopen(). Its not clear this is | |
137 # needed, so here we just leave off. If this can be done globally, we | |
138 # can expose one switch for this value, otherwise we need to add a templat
e | |
139 # param for this. | |
140 "--link-directly=0", | |
141 ] + invoker.functions | |
142 } | |
143 | |
144 source_set(target_name) { | |
145 direct_dependent_configs = [ invoker.config ] | |
146 sources = [ output_h, output_cc ] | |
147 deps = [ ":${target_name}_loader" ] | |
148 } | |
149 } | |
150 | |
151 pkg_config("gio_config") { | 111 pkg_config("gio_config") { |
152 packages = [ "gio-2.0" ] | 112 packages = [ "gio-2.0" ] |
153 defines = [ "USE_GIO" ] | 113 defines = [ "USE_GIO" ] |
154 ignore_libs = true # Loader generated below. | 114 ignore_libs = true # Loader generated below. |
155 } | 115 } |
156 | 116 |
157 # This generates a target named "gio". | 117 # This generates a target named "gio". |
158 generate_library_loader("gio") { | 118 generate_library_loader("gio") { |
159 name = "LibGioLoader" | 119 name = "LibGioLoader" |
160 output_h = "libgio.h" | 120 output_h = "libgio.h" |
161 output_cc = "libgio_loader.cc" | 121 output_cc = "libgio_loader.cc" |
162 header = "<gio/gio.h>" | 122 header = "<gio/gio.h>" |
163 config = ":gio_config" | 123 config = ":gio_config" |
164 | 124 |
165 functions = [ | 125 functions = [ |
166 "g_settings_new", | 126 "g_settings_new", |
167 "g_settings_get_child", | 127 "g_settings_get_child", |
168 "g_settings_get_string", | 128 "g_settings_get_string", |
169 "g_settings_get_boolean", | 129 "g_settings_get_boolean", |
170 "g_settings_get_int", | 130 "g_settings_get_int", |
171 "g_settings_get_strv", | 131 "g_settings_get_strv", |
172 "g_settings_list_schemas", | 132 "g_settings_list_schemas", |
173 ] | 133 ] |
174 } | 134 } |
175 | 135 |
176 # pkgconfig doesn't return anything interesting for this other than -lpci | |
177 # on suppotred systems, so we hardcode. | |
178 config("libpci_config") { | |
179 # This is not needed as long as we're setting link_directly=0 for the library | |
180 # loaders. | |
181 #libs = [ "pci" ] | |
182 } | |
183 | |
184 # This generates a target named "libpci". | 136 # This generates a target named "libpci". |
185 generate_library_loader("libpci") { | 137 generate_library_loader("libpci") { |
186 name = "LibPciLoader" | 138 name = "LibPciLoader" |
187 output_h = "libpci.h" | 139 output_h = "libpci.h" |
188 output_cc = "libpci_loader.cc" | 140 output_cc = "libpci_loader.cc" |
189 header = "<pci/pci.h>" | 141 header = "<pci/pci.h>" |
190 config = ":libpci_config" | |
191 | 142 |
192 functions = [ | 143 functions = [ |
193 "pci_alloc", | 144 "pci_alloc", |
194 "pci_init", | 145 "pci_init", |
195 "pci_cleanup", | 146 "pci_cleanup", |
196 "pci_scan_bus", | 147 "pci_scan_bus", |
197 "pci_fill_info", | 148 "pci_fill_info", |
198 "pci_lookup_name", | 149 "pci_lookup_name", |
199 ] | 150 ] |
200 } | 151 } |
| 152 |
| 153 generate_library_loader("libspeechd") { |
| 154 name = "LibSpeechdLoader" |
| 155 output_h = "libspeechd.h" |
| 156 output_cc = "libspeechd.cc" |
| 157 header = "<libspeechd.h>" |
| 158 bundled_header = "\"third_party/speech-dispatcher/libspeechd.h\"" |
| 159 |
| 160 functions = [ |
| 161 "spd_open", |
| 162 "spd_say", |
| 163 "spd_stop", |
| 164 "spd_close", |
| 165 "spd_pause", |
| 166 "spd_resume", |
| 167 "spd_set_notification_on", |
| 168 "spd_set_voice_rate", |
| 169 "spd_set_voice_pitch", |
| 170 "spd_list_synthesis_voices", |
| 171 "spd_set_synthesis_voice", |
| 172 "spd_list_modules", |
| 173 "spd_set_output_module", |
| 174 ] |
| 175 } |
OLD | NEW |