summaryrefslogtreecommitdiffstats
path: root/build/config/linux/BUILD.gn
blob: 7358ca5a245cacbbb7fa90e0be9ec3f42623a7ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/linux/pkg_config.gni")
import("//build/config/sysroot.gni")

config("sdk") {
  if (sysroot != "") {
    cflags = [ "--sysroot=" + sysroot ]
    ldflags = [ "--sysroot=" + sysroot ]

    # Need to get some linker flags out of the sysroot.
    ldflags += [ exec_script("sysroot_ld_path.py",
        [ rebase_path("//build/linux/sysroot_ld_path.sh", root_build_dir),
          sysroot ],
        "value") ]
  }
}

# Sets up the dynamic library search path to include our "lib" directory.
config("executable_ldconfig") {
  ldflags = [
    # Want to pass "\$". Need to escape both '\' and '$'. GN will re-escape as
    # required for ninja.
    "-Wl,-rpath=\\\$ORIGIN/lib/",

    "-Wl,-rpath-link=lib/",
  ]
}

pkg_config("dridrm") {
  packages = [ "libdrm" ]
}

config("fontconfig") {
  libs = [ "fontconfig" ]
}

pkg_config("freetype2") {
  packages = [ "freetype2" ]
}

pkg_config("glib") {
  packages = [ "glib-2.0", "gmodule-2.0", "gobject-2.0", "gthread-2.0" ]
}

pkg_config("gtk") {
  # Gtk requires gmodule, but it does not list it as a dependency in some
  # misconfigured systems.
  packages = [ "gmodule-2.0", "gtk+-2.0", "gthread-2.0" ]
}

pkg_config("pangocairo") {
  packages = [ "pangocairo" ]
}

pkg_config("udev") {
  packages = [ "libudev" ]
}

config("x11") {
  # Don't bother running pkg-config for these X related libraries since it just
  # returns the same libs, and forking pkg-config is slow.
  libs = [
    "X11",
    "Xcomposite",
    "Xcursor",
    "Xdamage",
    "Xext",
    "Xfixes",
    "Xi",
    "Xrender",
    "Xss",
    "Xtst",
  ]
}

config("libresolv") {
  libs = [ "libresolv" ]
}

pkg_config("gconf") {
  packages = [ "gconf-2.0" ]
  defines = [ "USE_GCONF" ]
}

pkg_config("gio_config") {
  packages = [ "gio-2.0" ]
  defines = [ "USE_GIO" ]
}

gio_output_h = "$root_gen_dir/library_loaders/libgio.h"
gio_output_cc = "$root_gen_dir/library_loaders/libgio_loader.cc"

action("make_gio_headers") {
  visibility = ":gio"

  script = "//tools/generate_library_loader/generate_library_loader.py"

  outputs = [ gio_output_h, gio_output_cc ]

  args = [
    "--name", "LibGioLoader",
    "--output-h", rebase_path(gio_output_h),
    "--output-cc", rebase_path(gio_output_cc),
    # TODO(brettw) convert ti "<gio/gio.h>" once GN doesn't mangle <>.
    "--header", "\"gio/gio.h\"",
    # Note GYP build exposes a variable linux_link_gsettings to control this,
    # which, if manually set to true, will disable dlopen() for this. Its not
    # clear this is needed, so here we just leave off.
    "--link-directly=0",
    "g_settings_new",
    "g_settings_get_child",
    "g_settings_get_string",
    "g_settings_get_boolean",
    "g_settings_get_int",
    "g_settings_get_strv",
    "g_settings_list_schemas",
  ]
}

source_set("gio") {
  direct_dependent_configs = [ ":gio_config" ]
  sources = [ gio_output_h, gio_output_cc ]
  deps = [ ":make_gio_headers" ]
}