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. 4 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") 10 11 config("sdk") { 12 if (sysroot != "") { 13 cflags = [ "--sysroot=" + sysroot ] 14 ldflags = [ "--sysroot=" + sysroot ] 15 16 # Need to get some linker flags out of the sysroot. 17 ldflags += [ exec_script("sysroot_ld_path.py", 18 [ rebase_path("//build/linux/sysroot_ld_path.sh", root_build_dir), 19 sysroot ], 20 "value") ] 21 } 22 23 # Set here because OS_CHROMEOS cannot be autodetected in build_config.h like 24 # OS_LINUX and the like. 25 if (is_chromeos) { 26 defines = [ "OS_CHROMEOS" ] 27 } 28 } 29 30 config("fontconfig") { 31 libs = [ "fontconfig" ] 32 } 33 34 pkg_config("freetype2") { 35 packages = [ "freetype2" ] 36 } 37 38 pkg_config("glib") { 39 packages = [ "glib-2.0", "gmodule-2.0", "gobject-2.0", "gthread-2.0" ] 40 } 41 42 pkg_config("pangocairo") { 43 packages = [ "pangocairo" ] 44 } 45 46 pkg_config("pangoft2") { 47 packages = [ "pangoft2" ] 48 } 49 50 pkg_config("udev") { 51 packages = [ "libudev" ] 52 } 53 54 # Note: if your target also depends on //dbus, you don't need to add this 55 # config (it will get added automatically if you depend on //dbus). 56 pkg_config("dbus") { 57 packages = [ "dbus-1" ] 58 } 59 60 if (use_evdev_gestures) { 61 pkg_config("libevdev-cros") { 62 packages = [ "libevdev-cros" ] 63 } 64 65 pkg_config("libgestures") { 66 packages = [ "libgestures" ] 67 } 68 } 69 70 config("x11") { 71 # Don't bother running pkg-config for these X related libraries since it just 72 # returns the same libs, and forking pkg-config is slow. 73 libs = [ 74 "X11", 75 "Xcomposite", 76 "Xcursor", 77 "Xdamage", 78 "Xext", 79 "Xfixes", 80 "Xi", 81 "Xrender", 82 "Xss", 83 "Xtst", 84 ] 85 } 86 87 config("xcomposite") { 88 libs = [ "Xcomposite" ] 89 } 90 91 config("xext") { 92 libs = [ "Xext" ] 93 } 94 95 config("xrandr") { 96 libs = [ "Xrandr" ] 97 } 98 99 config("xscrnsaver") { 100 libs = [ "Xss" ] 101 } 102 103 config("xfixes") { 104 libs = [ "Xfixes" ] 105 } 106 107 config("libcap") { 108 libs = [ "cap" ] 109 } 110 111 config("xi") { 112 libs = [ "Xi" ] 113 } 114 115 config("libresolv") { 116 libs = [ "resolv" ] 117 } 118 119 # CrOS doesn't install GTK, gconf or any gnome packages. 120 if (!is_chromeos) { 121 pkg_config("gtk") { 122 # Gtk requires gmodule, but it does not list it as a dependency in some 123 # misconfigured systems. 124 packages = [ "gmodule-2.0", "gtk+-2.0", "gthread-2.0" ] 125 } 126 127 pkg_config("gtkprint") { 128 packages = [ "gtk+-unix-print-2.0" ] 129 } 130 131 pkg_config("gnome_keyring") { 132 packages = [ "gnome-keyring-1" ] 133 } 134 135 pkg_config("gconf") { 136 packages = [ "gconf-2.0" ] 137 defines = [ "USE_GCONF" ] 138 } 139 } 140 141 # If brlapi isn't needed, don't require it to be installed. 142 if (use_brlapi) { 143 config("brlapi_config") { 144 defines = [ "USE_BRLAPI" ] 145 } 146 147 # TODO(GYP) linux_link_brlapi support. Is this needed? 148 generate_library_loader("libbrlapi") { 149 name = "LibBrlapiLoader" 150 output_h = "libbrlapi.h" 151 output_cc = "libbrlapi_loader.cc" 152 header = "<brlapi.h>" 153 config = ":brlapi_config" 154 155 functions = [ 156 "brlapi_getHandleSize", 157 "brlapi_error_location", 158 "brlapi_strerror", 159 "brlapi__acceptKeys", 160 "brlapi__openConnection", 161 "brlapi__closeConnection", 162 "brlapi__getDisplaySize", 163 "brlapi__enterTtyModeWithPath", 164 "brlapi__leaveTtyMode", 165 "brlapi__writeDots", 166 "brlapi__readKey", 167 ] 168 } 169 } 170 171 pkg_config("gio_config") { 172 packages = [ "gio-2.0" ] 173 # glib >=2.40 deprecate g_settings_list_schemas in favor of 174 # g_settings_schema_source_list_schemas. This function is not available on 175 # earlier versions that we still need to support (specifically, 2.32), so 176 # disable the warning with the GLIB_DISABLE_DEPRECATION_WARNINGS define. 177 # TODO(mgiuca): Remove this suppression when we drop support for Ubuntu 13.10 178 # (saucy) and earlier. Update the code to use 179 # g_settings_schema_source_list_schemas instead. 180 defines = [ "USE_GIO", "GLIB_DISABLE_DEPRECATION_WARNINGS" ] 181 182 # TODO(brettw) Theoretically I think ignore_libs should be set so that we 183 # don't link directly to GIO and use the loader generated below. But the gio 184 # target in GYP doesn't make any sense to me and appears to link directly to 185 # GIO in addition to making a loader. This this uncommented, the link in 186 # component build fails, so I think this is closer to the GYP build. 187 #ignore_libs = true # Loader generated below. 188 } 189 190 # This generates a target named "gio". 191 generate_library_loader("gio") { 192 name = "LibGioLoader" 193 output_h = "libgio.h" 194 output_cc = "libgio_loader.cc" 195 header = "<gio/gio.h>" 196 config = ":gio_config" 197 198 functions = [ 199 "g_settings_new", 200 "g_settings_get_child", 201 "g_settings_get_string", 202 "g_settings_get_boolean", 203 "g_settings_get_int", 204 "g_settings_get_strv", 205 "g_settings_list_schemas", 206 ] 207 } 208 209 # This generates a target named "libpci". 210 generate_library_loader("libpci") { 211 name = "LibPciLoader" 212 output_h = "libpci.h" 213 output_cc = "libpci_loader.cc" 214 header = "<pci/pci.h>" 215 216 functions = [ 217 "pci_alloc", 218 "pci_init", 219 "pci_cleanup", 220 "pci_scan_bus", 221 "pci_fill_info", 222 "pci_lookup_name", 223 ] 224 } 225 226 # Looking for libspeechd? Use //third_party/speech-dispatcher 227