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 # Sets up the dynamic library search path to include our "lib" directory. | 5 # Sets up the dynamic library search path to include our "lib" directory. |
6 config("executable_ldconfig") { | 6 config("executable_ldconfig") { |
7 ldflags = [ | 7 ldflags = [ |
8 # Want to pass "\$". Need to escape both '\' and '$'. GN will re-escape as | 8 # Want to pass "\$". Need to escape both '\' and '$'. GN will re-escape as |
9 # required for ninja. | 9 # required for ninja. |
10 "-Wl,-rpath=\\\$ORIGIN/lib/", | 10 "-Wl,-rpath=\\\$ORIGIN/lib/", |
11 | 11 |
12 "-Wl,-rpath-link=lib/", | 12 "-Wl,-rpath-link=lib/", |
13 ] | 13 ] |
14 } | 14 } |
15 | 15 |
| 16 # This script returns a list consisting of two nested lists: the first is the |
| 17 # list of cflags, the second are the linker flags. |
16 pkg_script = "pkg-config.py" | 18 pkg_script = "pkg-config.py" |
17 | 19 |
18 config("fontconfig") { | 20 config("fontconfig") { |
19 ldflags = [ "-lfontconfig" ] | 21 ldflags = [ "-lfontconfig" ] |
20 } | 22 } |
21 | 23 |
22 config("freetype2") { | 24 config("freetype2") { |
23 cflags = exec_script(pkg_script, [ "--cflags", "freetype2" ], "list lines") | 25 pkgresult = exec_script(pkg_script, [ "freetype2" ], "value") |
24 ldflags = exec_script(pkg_script, [ "--libs", "freetype2" ], "list lines") | 26 includes = pkgresult[0] |
| 27 cflags = pkgresult[1] |
| 28 ldflags = pkgresult[2] |
25 } | 29 } |
26 | 30 |
27 config("glib") { | 31 config("glib") { |
28 glib_packages = "glib-2.0 gmodule-2.0 gobject-2.0 gthread-2.0" | 32 pkgresult = exec_script(pkg_script, |
29 | 33 [ "glib-2.0", "gmodule-2.0", "gobject-2.0", "gthread-2.0" ], "value" ) |
30 cflags = exec_script(pkg_script, [ "--cflags", glib_packages ], "list lines") | 34 includes = pkgresult[0] |
31 ldflags = exec_script(pkg_script, [ "--libs", glib_packages ], "list lines") | 35 cflags = pkgresult[1] |
| 36 ldflags = pkgresult[2] |
32 } | 37 } |
33 | 38 |
34 config("gtk") { | 39 config("gtk") { |
35 # Gtk requires gmodule, but it does not list it as a dependency in some | 40 # Gtk requires gmodule, but it does not list it as a dependency in some |
36 # misconfigured systems. | 41 # misconfigured systems. |
37 gtk_packages = "gmodule-2.0 gtk+-2.0 gthread-2.0" | 42 pkgresult = exec_script(pkg_script, |
| 43 [ "gmodule-2.0", "gtk+-2.0", "gthread-2.0" ], "value" ) |
| 44 includes = pkgresult[0] |
| 45 cflags = pkgresult[1] |
| 46 ldflags = pkgresult[2] |
38 | 47 |
39 defines = [ "TOOLKIT_GTK" ] | 48 defines = [ "TOOLKIT_GTK" ] |
40 | |
41 cflags = exec_script(pkg_script, [ "--cflags", gtk_packages ], "list lines") | |
42 ldflags = exec_script(pkg_script, [ "--libs", gtk_packages ], "list lines") | |
43 } | 49 } |
44 | 50 |
45 config("pangocairo") { | 51 config("pangocairo") { |
46 cflags = exec_script(pkg_script, [ "--cflags", "pangocairo" ], "list lines") | 52 pkgresult = exec_script(pkg_script, [ "pangocairo" ], "value" ) |
47 ldflags = exec_script(pkg_script, [ "--libs", "pangocairo" ], "list lines") | 53 includes = pkgresult[0] |
| 54 cflags = pkgresult[1] |
| 55 ldflags = pkgresult[2] |
48 } | 56 } |
49 | 57 |
50 config("udev") { | 58 config("udev") { |
51 udev_packages = "libudev" | 59 pkgresult = exec_script(pkg_script, [ "libudev" ], "value" ) |
52 | 60 includes = pkgresult[0] |
53 cflags = exec_script(pkg_script, [ "--cflags", udev_packages ], "list lines") | 61 cflags = pkgresult[1] |
54 ldflags = exec_script(pkg_script, [ "--libs", udev_packages ], "list lines") | 62 ldflags = pkgresult[2] |
55 } | 63 } |
56 | 64 |
57 config("x11") { | 65 config("x11") { |
58 # Don't bother running pkg-config for these X related libraries since it just | 66 # Don't bother running pkg-config for these X related libraries since it just |
59 # returns the same libs, and forking pkg-config is slow. | 67 # returns the same libs, and forking pkg-config is slow. |
60 defines = [ "USE_X11" ] | 68 defines = [ "USE_X11" ] |
61 ldflags = [ | 69 ldflags = [ |
62 "-lX11", | 70 "-lX11", |
63 "-lXcomposite", | 71 "-lXcomposite", |
64 "-lXcursor", | 72 "-lXcursor", |
65 "-lXdamage", | 73 "-lXdamage", |
66 "-lXext", | 74 "-lXext", |
67 "-lXfixes", | 75 "-lXfixes", |
68 "-lXi", | 76 "-lXi", |
69 "-lXrender", | 77 "-lXrender", |
70 "-lXss", | 78 "-lXss", |
71 "-lXtst", | 79 "-lXtst", |
72 ] | 80 ] |
73 } | 81 } |
OLD | NEW |