[M108 Migration][HBBTV] Implement ewk_context_register_jsplugin_mime_types API
[platform/framework/web/chromium-efl.git] / courgette / BUILD.gn
1 # Copyright 2014 The Chromium Authors
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/compiler/compiler.gni")
6 import("//testing/test.gni")
7
8 static_library("courgette_lib") {
9   sources = [
10     "adjustment_method.cc",
11     "adjustment_method.h",
12     "adjustment_method_2.cc",
13     "assembly_program.cc",
14     "assembly_program.h",
15     "consecutive_range_visitor.h",
16     "courgette.h",
17     "courgette_flow.cc",
18     "courgette_flow.h",
19     "difference_estimator.cc",
20     "difference_estimator.h",
21     "disassembler.cc",
22     "disassembler.h",
23     "disassembler_elf_32.cc",
24     "disassembler_elf_32.h",
25     "disassembler_elf_32_x86.cc",
26     "disassembler_elf_32_x86.h",
27     "disassembler_win32.cc",
28     "disassembler_win32.h",
29     "disassembler_win32_x64.cc",
30     "disassembler_win32_x64.h",
31     "disassembler_win32_x86.cc",
32     "disassembler_win32_x86.h",
33     "encoded_program.cc",
34     "encoded_program.h",
35     "ensemble.cc",
36     "ensemble.h",
37     "ensemble_apply.cc",
38     "ensemble_create.cc",
39     "image_utils.h",
40     "instruction_utils.h",
41     "label_manager.cc",
42     "label_manager.h",
43     "patch_generator_x86_32.h",
44     "patcher_x86_32.h",
45     "program_detector.cc",
46     "program_detector.h",
47     "rel32_finder.cc",
48     "rel32_finder.h",
49     "rel32_finder_x64.cc",
50     "rel32_finder_x64.h",
51     "rel32_finder_x86.cc",
52     "rel32_finder_x86.h",
53     "simple_delta.cc",
54     "simple_delta.h",
55     "types_elf.h",
56     "types_win_pe.h",
57   ]
58
59   deps = [
60     "//base",
61     "//third_party/lzma_sdk",
62   ]
63
64   public_deps = [
65     ":bsdiff",
66     ":courgette_common",
67   ]
68 }
69
70 source_set("courgette_common") {
71   sources = [
72     "crc.cc",
73     "crc.h",
74     "memory_allocator.cc",
75     "memory_allocator.h",
76     "region.h",
77     "streams.cc",
78     "streams.h",
79   ]
80   deps = [
81     "//base",
82     "//third_party/lzma_sdk",
83   ]
84 }
85
86 source_set("paged_array") {
87   sources = [ "third_party/bsdiff/paged_array.h" ]
88   deps = [ "//base" ]
89 }
90
91 source_set("bsdiff") {
92   sources = [
93     "third_party/bsdiff/bsdiff.h",
94     "third_party/bsdiff/bsdiff_apply.cc",
95     "third_party/bsdiff/bsdiff_create.cc",
96     "third_party/bsdiff/bsdiff_search.h",
97   ]
98   deps = [
99     ":courgette_common",
100     "//base",
101   ]
102   public_deps = [
103     ":divsufsort",
104     ":paged_array",
105   ]
106 }
107
108 source_set("divsufsort") {
109   sources = [
110     "third_party/divsufsort/divsufsort.cc",
111     "third_party/divsufsort/divsufsort.h",
112     "third_party/divsufsort/divsufsort_private.h",
113     "third_party/divsufsort/sssort.cc",
114     "third_party/divsufsort/trsort.cc",
115   ]
116   deps = [
117     ":courgette_common",
118     ":paged_array",
119     "//base",
120   ]
121 }
122
123 if (!is_ios) {
124   executable("courgette") {
125     if (is_win && current_cpu == "x64") {
126       # The build infrastructure needs courgette to be named courgette64.
127       output_name = "courgette64"
128     }
129
130     sources = [ "courgette_tool.cc" ]
131
132     if (is_win) {
133       ldflags = [ "/LARGEADDRESSAWARE" ]
134     }
135
136     deps = [
137       ":courgette_lib",
138       "//base",
139       "//build/win:default_exe_manifest",
140     ]
141   }
142
143   executable("courgette_minimal_tool") {
144     sources = [ "courgette_minimal_tool.cc" ]
145
146     deps = [
147       ":courgette_lib",
148       "//base",
149       "//build/win:default_exe_manifest",
150     ]
151   }
152
153   if (is_win) {
154     if (current_cpu == "x64") {
155       # TODO(sebmarchand): The official build scripts expect courgette.exe to be
156       # in the official build archives, remove this once they have been updated.
157       # https://crbug.com/629243
158       copy("copy_courgette_binaries") {
159         sources = [ "$root_out_dir/courgette64.exe" ]
160         outputs = [ "$root_out_dir/courgette.exe" ]
161         deps = [ ":courgette" ]
162       }
163     } else {
164       # Make sure that we have a copy of courgette64.exe(.pdb) in the root out
165       # directory.
166       if (is_clang) {
167         courgette64_toolchain = "//build/toolchain/win:win_clang_x64"
168       } else {
169         courgette64_toolchain = "//build/toolchain/win:x64"
170       }
171       courgette64_label = ":courgette($courgette64_toolchain)"
172
173       courgette64_out_dir = get_label_info(courgette64_label, "root_out_dir")
174
175       if (symbol_level > 0) {
176         copy("copy_courgette_pdb") {
177           visibility = [ ":copy_courgette_binaries" ]
178           sources = [ "$courgette64_out_dir/courgette64.exe.pdb" ]
179           outputs = [ "$root_out_dir/{{source_file_part}}" ]
180           deps = [ courgette64_label ]
181         }
182       }
183
184       copy("copy_courgette_binaries") {
185         sources = [ "$courgette64_out_dir/courgette64.exe" ]
186         outputs = [ "$root_out_dir/{{source_file_part}}" ]
187         deps = [ courgette64_label ]
188         if (symbol_level > 0) {
189           deps += [ ":copy_courgette_pdb" ]
190         }
191       }
192     }
193   }
194 }
195
196 test("courgette_unittests") {
197   sources = [
198     "adjustment_method_unittest.cc",
199     "base_test_unittest.cc",
200     "base_test_unittest.h",
201     "bsdiff_memory_unittest.cc",
202     "consecutive_range_visitor_unittest.cc",
203     "difference_estimator_unittest.cc",
204     "disassembler_elf_32_x86_unittest.cc",
205     "disassembler_win32_x64_unittest.cc",
206     "disassembler_win32_x86_unittest.cc",
207     "encode_decode_unittest.cc",
208     "encoded_program_unittest.cc",
209     "ensemble_unittest.cc",
210     "image_utils_unittest.cc",
211     "label_manager_unittest.cc",
212     "memory_allocator_unittest.cc",
213     "program_detector_unittest.cc",
214     "rel32_finder_unittest.cc",
215     "streams_unittest.cc",
216     "third_party/bsdiff/bsdiff_search_unittest.cc",
217     "third_party/bsdiff/paged_array_unittest.cc",
218     "third_party/divsufsort/divsufsort_unittest.cc",
219     "typedrva_unittest.cc",
220     "versioning_unittest.cc",
221   ]
222
223   deps = [
224     ":courgette_lib",
225     "//base",
226     "//base:i18n",
227     "//base/test:run_all_unittests",
228     "//base/test:test_support",
229     "//testing/gtest",
230   ]
231
232   data = [ "testdata/" ]
233 }
234
235 test("courgette_fuzz") {
236   sources = [
237     "base_test_unittest.cc",
238     "base_test_unittest.h",
239     "encoded_program_fuzz_unittest.cc",
240   ]
241   deps = [
242     ":courgette_lib",
243     "//base",
244     "//base:i18n",
245     "//base/test:test_support",
246     "//testing/gtest",
247   ]
248 }