Roll src/third_party/WebKit 0e611fa:08c8269 (svn 190191:190194)
[chromium-blink-merge.git] / chrome_elf / BUILD.gn
blobb58c82918a0ecdff4a4a4fc5beae1d25562adcb3
1 # Copyright 2015 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("//chrome/version.gni")
6 import("//testing/test.gni")
8 process_version("chrome_elf_resources") {
9   source = "//chrome/app/chrome_version.rc.version"
10   output = "$target_gen_dir/chrome_elf_version.rc"
11   extra_args = [
12     "-f",
13     rebase_path("chrome_elf.ver"),
14   ]
17 shared_library("chrome_elf") {
18   sources = [
19     "chrome_elf_main.cc",
20     "chrome_elf_main.h",
21     "$target_gen_dir/chrome_elf_version.rc",
22   ]
23   deps = [
24     ":blacklist",
25     ":breakpad",
26     ":lib",
27     ":chrome_elf_resources",
28   ]
29   configs += [ "//build/config/win:windowed" ]
30   configs -= [ "//build/config/win:console" ]
31   ldflags = [
32     "/NODEFAULTLIB:user32.lib",
33     "/DEF:" + rebase_path("chrome_elf.def"),
34   ]
35   if (cpu_arch == "x86") {
36     # Don"t set an x64 base address (to avoid breaking HE-ASLR).
37     ldflags += [ "/BASE:0x01c20000" ]
38   }
41 source_set("lib") {
42   sources = [
43     "create_file/chrome_create_file.cc",
44     "create_file/chrome_create_file.h",
45     "ntdll_cache.cc",
46     "ntdll_cache.h",
47   ]
48   deps = [
49     ":common",
50     "//base:base_static",
51     "//sandbox",
52   ]
55 source_set("constants") {
56   sources = [
57     "chrome_elf_constants.cc",
58     "chrome_elf_constants.h",
59   ]
62 source_set("common") {
63   deps = [
64     ":constants",
65   ]
66   sources = [
67     "chrome_elf_types.h",
68     "chrome_elf_util.cc",
69     "chrome_elf_util.h",
70     "thunk_getter.cc",
71     "thunk_getter.h",
72   ]
75 source_set("breakpad") {
76   include_dirs = [ "$target_gen_dir" ]
77   sources = [
78     "breakpad.cc",
79     "breakpad.h",
80   ]
81   deps = [
82     ":common",
83     "//breakpad:breakpad_handler",
84     "//chrome:version_header",
85   ]
88 if (is_component_build) {
89   shared_library("chrome_redirects") {
90     sources = [
91       "chrome_redirects_main.cc",
92     ]
93     deps = [
94       ":lib",
95     ]
96     configs += [ "//build/config/win:windowed" ]
97     ldflags = [ "/DEF:" + rebase_path("chrome_redirects.def") ]
99     if (cpu_arch == "x86") {
100       # Don't set an x64 base address (to avoid breaking HE-ASLR).
101       ldflags += [ "/BASE:0x01c20000" ]
102     }
103   }
106 source_set("dll_hash") {
107   deps = [
108     "//base",
109   ]
110   sources = [
111     "dll_hash/dll_hash.cc",
112     "dll_hash/dll_hash.h",
113   ]
116 executable("dll_hash_main") {
117   deps = [
118     ":dll_hash",
119   ]
120   sources = [
121     "dll_hash/dll_hash_main.cc",
122   ]
125 static_library("blacklist") {
126   sources = [
127     "blacklist/blacklist.cc",
128     "blacklist/blacklist.h",
129     "blacklist/blacklist_interceptions.cc",
130     "blacklist/blacklist_interceptions.h",
131   ]
132   deps = [
133     # Depend on base_static, but do NOT take a dependency on base.gyp:base
134     # as that would risk pulling in base's link-time dependencies which
135     # chrome_elf cannot do.
136     ":breakpad",
137     ":constants",
138     "//base:base_static",
139     "//sandbox:sandbox",
140   ]
143 test("chrome_elf_unittests") {
144   output_name = "chrome_elf_unittests"
145   sources = [
146     "blacklist/test/blacklist_test.cc",
147     "chrome_elf_util_unittest.cc",
148     "create_file/chrome_create_file_unittest.cc",
149     "elf_imports_unittest.cc",
150     "ntdll_cache_unittest.cc",
151   ]
152   include_dirs = [ "$target_gen_dir" ]
153   deps = [
154     ":blacklist",
155     ":blacklist_test_main_dll",
156     ":lib",
157     "//base",
158     "//base/test:run_all_unittests",
159     "//base/test:test_support",
160     "//sandbox",
161     "//testing/gtest",
162   ]
163   data_deps = [
164     ":blacklist_test_dll_1",
165     ":blacklist_test_dll_2",
166     ":blacklist_test_dll_3",
167     ":chrome_elf",
168     "//chrome",
169   ]
172 shared_library("blacklist_test_main_dll") {
173   sources = [
174     "blacklist/test/blacklist_test_main_dll.cc",
175   ]
176   deps = [
177     "//base",
178     ":blacklist",
179   ]
180   ldflags =
181       [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_main_dll.def",
182                               root_build_dir) ]
185 shared_library("blacklist_test_dll_1") {
186   sources = [
187     "blacklist/test/blacklist_test_dll_1.cc",
188   ]
189   ldflags = [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_dll_1.def",
190                                     root_build_dir) ]
193 shared_library("blacklist_test_dll_2") {
194   sources = [
195     "blacklist/test/blacklist_test_dll_2.cc",
196   ]
197   ldflags = [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_dll_2.def",
198                                     root_build_dir) ]
201 shared_library("blacklist_test_dll_3") {
202   sources = [
203     "blacklist/test/blacklist_test_dll_3.cc",
204   ]