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
3 # found in the LICENSE file.
5 import("//build/config/linux/pkg_config.gni")
6 import("//build/config/features.gni")
7 import("//build/config/sysroot.gni")
8 import("//build/config/ui.gni")
9 import("//tools/generate_library_loader/generate_library_loader.gni")
11 gypi_values = exec_script("//build/gypi_to_gn.py",
12 [ rebase_path("../../linux/system.gyp") ],
14 [ "../../linux/system.gyp" ])
18 cflags = [ "--sysroot=" + sysroot ]
19 ldflags = [ "--sysroot=" + sysroot ]
21 # Need to get some linker flags out of the sysroot.
22 ldflags += [ exec_script("sysroot_ld_path.py",
24 rebase_path("//build/linux/sysroot_ld_path.sh",
31 # Set here because OS_CHROMEOS cannot be autodetected in build_config.h like
32 # OS_LINUX and the like.
34 defines = [ "OS_CHROMEOS" ]
40 atk_lib_dir = exec_script(pkg_config_script,
46 defines = [ "ATK_LIB_DIR=\"$atk_lib_dir\"" ]
49 # gn orders flags on a target before flags from configs. The default config
50 # adds -Wall, and these flags have to be after -Wall -- so they need to come
51 # from a config and can't be on the target directly.
52 config("atk_warnings") {
53 # glib uses the pre-c++11 typedef-as-static_assert hack.
54 cflags = [ "-Wno-unused-local-typedef" ]
57 config("fontconfig") {
58 libs = [ "fontconfig" ]
61 pkg_config("freetype2") {
62 packages = [ "freetype2" ]
74 pkg_config("pangocairo") {
75 packages = [ "pangocairo" ]
78 pkg_config("pangoft2") {
79 packages = [ "pangoft2" ]
82 # Note: if your target also depends on //dbus, you don't need to add this
83 # config (it will get added automatically if you depend on //dbus).
85 packages = [ "dbus-1" ]
88 if (use_evdev_gestures) {
89 pkg_config("libevdev-cros") {
90 packages = [ "libevdev-cros" ]
93 pkg_config("libgestures") {
94 packages = [ "libgestures" ]
112 config("xcomposite") {
113 libs = [ "Xcomposite" ]
124 config("xscrnsaver") {
144 config("libresolv") {
148 # CrOS doesn't install GTK, gconf or any gnome packages.
150 # These packages should _only_ be expected when building for a target.
151 # If these extra checks are not run, gconf is required when building host
152 # tools for a CrOS build.
153 if (current_toolchain == default_toolchain) {
154 pkg_config("gconf") {
155 packages = [ "gconf-2.0" ]
156 defines = [ "USE_GCONF" ]
161 # If brlapi isn't needed, don't require it to be installed.
163 config("brlapi_config") {
164 defines = [ "USE_BRLAPI" ]
167 # TODO(GYP) linux_link_brlapi support. Is this needed?
168 generate_library_loader("libbrlapi") {
169 name = "LibBrlapiLoader"
170 output_h = "libbrlapi.h"
171 output_cc = "libbrlapi_loader.cc"
172 header = "<brlapi.h>"
173 config = ":brlapi_config"
175 functions = gypi_values.libbrlapi_functions
179 pkg_config("gio_config") {
180 packages = [ "gio-2.0" ]
182 # glib >=2.40 deprecate g_settings_list_schemas in favor of
183 # g_settings_schema_source_list_schemas. This function is not available on
184 # earlier versions that we still need to support (specifically, 2.32), so
185 # disable the warning with the GLIB_DISABLE_DEPRECATION_WARNINGS define.
186 # TODO(mgiuca): Remove this suppression when we drop support for Ubuntu 13.10
187 # (saucy) and earlier. Update the code to use
188 # g_settings_schema_source_list_schemas instead.
191 "GLIB_DISABLE_DEPRECATION_WARNINGS",
194 # TODO(brettw) Theoretically I think ignore_libs should be set so that we
195 # don't link directly to GIO and use the loader generated below. But the gio
196 # target in GYP doesn't make any sense to me and appears to link directly to
197 # GIO in addition to making a loader. This this uncommented, the link in
198 # component build fails, so I think this is closer to the GYP build.
199 #ignore_libs = true # Loader generated below.
202 if (is_desktop_linux) {
203 # This generates a target named "gio".
204 generate_library_loader("gio") {
205 name = "LibGioLoader"
206 output_h = "libgio.h"
207 output_cc = "libgio_loader.cc"
208 header = "<gio/gio.h>"
209 config = ":gio_config"
211 functions = gypi_values.libgio_functions
215 # This generates a target named "libpci".
216 generate_library_loader("libpci") {
217 name = "LibPciLoader"
218 output_h = "libpci.h"
219 output_cc = "libpci_loader.cc"
220 header = "<pci/pci.h>"
222 functions = gypi_values.libpci_functions
225 # Looking for libspeechd? Use //third_party/speech-dispatcher
227 # This generates a target named "udev0_loader".
228 generate_library_loader("udev0_loader") {
229 name = "LibUdev0Loader"
230 output_h = "libudev0.h"
231 output_cc = "libudev0_loader.cc"
232 header = "\"third_party/libudev/libudev0.h\""
234 functions = gypi_values.libudev_functions
237 # This generates a target named "udev1_loader".
238 generate_library_loader("udev1_loader") {
239 name = "LibUdev1Loader"
240 output_h = "libudev1.h"
241 output_cc = "libudev1_loader.cc"
242 header = "\"third_party/libudev/libudev1.h\""
244 functions = gypi_values.libudev_functions