projects/aports·blob master · refs

933 lines · 27.0 KiB

1diff --git a/engine/src/build/linux/unbundle/freetype2.gn b/engine/src/build/linux/unbundle/freetype2.gn
2new file mode 100644
3index 0000000..3b8cafb
4--- /dev/null
5+++ b/engine/src/build/linux/unbundle/freetype2.gn
6@@ -0,0 +1,35 @@
7+# Copyright 2013 The Flutter Authors. All rights reserved.
8+# Use of this source code is governed by a BSD-style license that can be
9+# found in the LICENSE file.
10+
11+import("//build/config/linux/pkg_config.gni")
12+import("//build/shim_headers.gni")
13+
14+config("freetype_config") {
15+ include_dirs = [ "include/freetype-flutter-config" ]
16+
17+ cflags = []
18+
19+ if (is_clang) {
20+ cflags += [
21+ "-Wno-unused-function",
22+ "-Wno-unused-variable",
23+ ]
24+ }
25+}
26+
27+pkg_config("system_freetype2") {
28+ packages = [ "freetype2" ]
29+}
30+
31+source_set("freetype2") {
32+ output_name = "freetype2"
33+ deps = [
34+ "//third_party/libpng",
35+ "//third_party/zlib",
36+ ]
37+ public_configs = [
38+ ":freetype_config",
39+ ":system_freetype2",
40+ ]
41+}
42diff --git a/engine/src/build/linux/unbundle/harfbuzz.gn b/engine/src/build/linux/unbundle/harfbuzz.gn
43new file mode 100644
44index 0000000..72d3e06
45--- /dev/null
46+++ b/engine/src/build/linux/unbundle/harfbuzz.gn
47@@ -0,0 +1,31 @@
48+# Copyright 2013 The Flutter Authors. All rights reserved.
49+# Use of this source code is governed by a BSD-style license that can be
50+# found in the LICENSE file.
51+
52+import("//build/config/linux/pkg_config.gni")
53+
54+pkg_config("system_harfbuzz") {
55+ packages = [ "harfbuzz" ]
56+}
57+
58+pkg_config("system_harfbuzz_subset") {
59+ packages = [ "harfbuzz-subset" ]
60+}
61+
62+source_set("harfbuzz") {
63+ output_name = "harfbuzz"
64+ deps = [
65+ "//third_party/freetype2",
66+ "//third_party/icu:icuuc",
67+ ]
68+ public_configs = [ ":system_harfbuzz" ]
69+}
70+
71+source_set("harfbuzz_subset") {
72+ output_name = "harfbuzz_subset"
73+ deps = [
74+ "//third_party/freetype2",
75+ "//third_party/icu:icuuc",
76+ ]
77+ public_configs = [ ":system_harfbuzz_subset" ]
78+}
79diff --git a/engine/src/build/linux/unbundle/icu.gn b/engine/src/build/linux/unbundle/icu.gn
80new file mode 100644
81index 0000000..9e54d4e
82--- /dev/null
83+++ b/engine/src/build/linux/unbundle/icu.gn
84@@ -0,0 +1,264 @@
85+# Copyright 2016 The Chromium Authors
86+# Use of this source code is governed by a BSD-style license that can be
87+# found in the LICENSE file.
88+
89+import("//build/config/linux/pkg_config.gni")
90+import("//build/shim_headers.gni")
91+
92+group("icu") {
93+ public_deps = [
94+ ":icui18n",
95+ ":icuuc",
96+ ]
97+}
98+
99+config("icu_config") {
100+ defines = [
101+ "USING_SYSTEM_ICU=1",
102+ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC",
103+
104+ # U_EXPORT (defined in unicode/platform.h) is used to set public visibility
105+ # on classes through the U_COMMON_API and U_I18N_API macros (among others).
106+ # When linking against the system ICU library, we want its symbols to have
107+ # public LTO visibility. This disables CFI checks for the ICU classes and
108+ # allows whole-program optimization to be applied to the rest of Chromium.
109+ #
110+ # Both U_COMMON_API and U_I18N_API macros would be defined to U_EXPORT only
111+ # when U_COMBINED_IMPLEMENTATION is defined (see unicode/utypes.h). Because
112+ # we override the default system UCHAR_TYPE (char16_t), it is not possible
113+ # to use U_COMBINED_IMPLEMENTATION at this moment, meaning the U_COMMON_API
114+ # and U_I18N_API macros are set to U_IMPORT which is an empty definition.
115+ #
116+ # Until building with UCHAR_TYPE=char16_t is supported, one way to apply
117+ # public visibility (and thus public LTO visibility) to all ICU classes is
118+ # to define U_IMPORT to have the same value as U_EXPORT. For more details,
119+ # please see: https://crbug.com/822820
120+ "U_IMPORT=U_EXPORT",
121+ ]
122+}
123+
124+pkg_config("system_icui18n") {
125+ packages = [ "icu-i18n" ]
126+}
127+
128+pkg_config("system_icuuc") {
129+ packages = [ "icu-uc" ]
130+}
131+
132+source_set("icui18n") {
133+ public_deps = [ ":icui18n_shim" ]
134+ public_configs = [
135+ ":icu_config",
136+ ":system_icui18n",
137+ ]
138+}
139+
140+source_set("icuuc") {
141+ public_deps = [ ":icuuc_shim" ]
142+ public_configs = [
143+ ":icu_config",
144+ ":system_icuuc",
145+ ]
146+}
147+
148+group("icui18n_hidden_visibility") {
149+ public_deps = [ ":icui18n" ]
150+}
151+
152+group("icuuc_hidden_visibility") {
153+ public_deps = [ ":icuuc" ]
154+}
155+
156+shim_headers("icui18n_shim") {
157+ root_path = "source/i18n"
158+ headers = [
159+ # This list can easily be updated using the commands below:
160+ # cd third_party/icu/source/i18n
161+ # find unicode -iname '*.h' -printf ' "%p",\n' | LC_ALL=C sort -u
162+ "unicode/alphaindex.h",
163+ "unicode/basictz.h",
164+ "unicode/calendar.h",
165+ "unicode/choicfmt.h",
166+ "unicode/coleitr.h",
167+ "unicode/coll.h",
168+ "unicode/compactdecimalformat.h",
169+ "unicode/curramt.h",
170+ "unicode/currpinf.h",
171+ "unicode/currunit.h",
172+ "unicode/datefmt.h",
173+ "unicode/dcfmtsym.h",
174+ "unicode/decimfmt.h",
175+ "unicode/dtfmtsym.h",
176+ "unicode/dtitvfmt.h",
177+ "unicode/dtitvinf.h",
178+ "unicode/dtptngen.h",
179+ "unicode/dtrule.h",
180+ "unicode/fieldpos.h",
181+ "unicode/fmtable.h",
182+ "unicode/format.h",
183+ "unicode/fpositer.h",
184+ "unicode/gender.h",
185+ "unicode/gregocal.h",
186+ "unicode/listformatter.h",
187+ "unicode/measfmt.h",
188+ "unicode/measunit.h",
189+ "unicode/measure.h",
190+ "unicode/msgfmt.h",
191+ "unicode/numfmt.h",
192+ "unicode/numsys.h",
193+ "unicode/plurfmt.h",
194+ "unicode/plurrule.h",
195+ "unicode/rbnf.h",
196+ "unicode/rbtz.h",
197+ "unicode/regex.h",
198+ "unicode/region.h",
199+ "unicode/reldatefmt.h",
200+ "unicode/scientificnumberformatter.h",
201+ "unicode/search.h",
202+ "unicode/selfmt.h",
203+ "unicode/simpletz.h",
204+ "unicode/smpdtfmt.h",
205+ "unicode/sortkey.h",
206+ "unicode/stsearch.h",
207+ "unicode/tblcoll.h",
208+ "unicode/timezone.h",
209+ "unicode/tmunit.h",
210+ "unicode/tmutamt.h",
211+ "unicode/tmutfmt.h",
212+ "unicode/translit.h",
213+ "unicode/tzfmt.h",
214+ "unicode/tznames.h",
215+ "unicode/tzrule.h",
216+ "unicode/tztrans.h",
217+ "unicode/ucal.h",
218+ "unicode/ucol.h",
219+ "unicode/ucoleitr.h",
220+ "unicode/ucsdet.h",
221+ "unicode/udat.h",
222+ "unicode/udateintervalformat.h",
223+ "unicode/udatpg.h",
224+ "unicode/ufieldpositer.h",
225+ "unicode/uformattable.h",
226+ "unicode/ugender.h",
227+ "unicode/ulocdata.h",
228+ "unicode/umsg.h",
229+ "unicode/unirepl.h",
230+ "unicode/unum.h",
231+ "unicode/unumsys.h",
232+ "unicode/upluralrules.h",
233+ "unicode/uregex.h",
234+ "unicode/uregion.h",
235+ "unicode/ureldatefmt.h",
236+ "unicode/usearch.h",
237+ "unicode/uspoof.h",
238+ "unicode/utmscale.h",
239+ "unicode/utrans.h",
240+ "unicode/vtzone.h",
241+ ]
242+ additional_includes = [ "flutter" ]
243+}
244+
245+shim_headers("icuuc_shim") {
246+ root_path = "source/common"
247+ headers = [
248+ # This list can easily be updated using the commands below:
249+ # cd third_party/icu/source/common
250+ # find unicode -iname '*.h' -printf ' "%p",\n' | LC_ALL=C sort -u
251+ "unicode/appendable.h",
252+ "unicode/brkiter.h",
253+ "unicode/bytestream.h",
254+ "unicode/bytestrie.h",
255+ "unicode/bytestriebuilder.h",
256+ "unicode/caniter.h",
257+ "unicode/casemap.h",
258+ "unicode/char16ptr.h",
259+ "unicode/chariter.h",
260+ "unicode/dbbi.h",
261+ "unicode/docmain.h",
262+ "unicode/dtintrv.h",
263+ "unicode/edits.h",
264+ "unicode/enumset.h",
265+ "unicode/errorcode.h",
266+ "unicode/filteredbrk.h",
267+ "unicode/icudataver.h",
268+ "unicode/icuplug.h",
269+ "unicode/idna.h",
270+ "unicode/localematcher.h",
271+ "unicode/localpointer.h",
272+ "unicode/locdspnm.h",
273+ "unicode/locid.h",
274+ "unicode/messagepattern.h",
275+ "unicode/normalizer2.h",
276+ "unicode/normlzr.h",
277+ "unicode/parseerr.h",
278+ "unicode/parsepos.h",
279+ "unicode/platform.h",
280+ "unicode/ptypes.h",
281+ "unicode/putil.h",
282+ "unicode/rbbi.h",
283+ "unicode/rep.h",
284+ "unicode/resbund.h",
285+ "unicode/schriter.h",
286+ "unicode/simpleformatter.h",
287+ "unicode/std_string.h",
288+ "unicode/strenum.h",
289+ "unicode/stringpiece.h",
290+ "unicode/stringtriebuilder.h",
291+ "unicode/symtable.h",
292+ "unicode/ubidi.h",
293+ "unicode/ubiditransform.h",
294+ "unicode/ubrk.h",
295+ "unicode/ucasemap.h",
296+ "unicode/ucat.h",
297+ "unicode/uchar.h",
298+ "unicode/ucharstrie.h",
299+ "unicode/ucharstriebuilder.h",
300+ "unicode/uchriter.h",
301+ "unicode/uclean.h",
302+ "unicode/ucnv.h",
303+ "unicode/ucnv_cb.h",
304+ "unicode/ucnv_err.h",
305+ "unicode/ucnvsel.h",
306+ "unicode/uconfig.h",
307+ "unicode/ucurr.h",
308+ "unicode/udata.h",
309+ "unicode/udisplaycontext.h",
310+ "unicode/uenum.h",
311+ "unicode/uidna.h",
312+ "unicode/uiter.h",
313+ "unicode/uldnames.h",
314+ "unicode/ulistformatter.h",
315+ "unicode/uloc.h",
316+ "unicode/umachine.h",
317+ "unicode/umisc.h",
318+ "unicode/unifilt.h",
319+ "unicode/unifunct.h",
320+ "unicode/unimatch.h",
321+ "unicode/uniset.h",
322+ "unicode/unistr.h",
323+ "unicode/unorm.h",
324+ "unicode/unorm2.h",
325+ "unicode/uobject.h",
326+ "unicode/urename.h",
327+ "unicode/urep.h",
328+ "unicode/ures.h",
329+ "unicode/uscript.h",
330+ "unicode/uset.h",
331+ "unicode/usetiter.h",
332+ "unicode/ushape.h",
333+ "unicode/usprep.h",
334+ "unicode/ustring.h",
335+ "unicode/ustringtrie.h",
336+ "unicode/utext.h",
337+ "unicode/utf.h",
338+ "unicode/utf16.h",
339+ "unicode/utf32.h",
340+ "unicode/utf8.h",
341+ "unicode/utf_old.h",
342+ "unicode/utrace.h",
343+ "unicode/utypes.h",
344+ "unicode/uvernum.h",
345+ "unicode/uversion.h",
346+ ]
347+ additional_includes = [ "flutter" ]
348+}
349diff --git a/engine/src/build/linux/unbundle/libjpeg-turbo.gn b/engine/src/build/linux/unbundle/libjpeg-turbo.gn
350new file mode 100644
351index 0000000..be0c674
352--- /dev/null
353+++ b/engine/src/build/linux/unbundle/libjpeg-turbo.gn
354@@ -0,0 +1,11 @@
355+# Copyright 2013 The Flutter Authors. All rights reserved.
356+# Use of this source code is governed by a BSD-style license that can be
357+# found in the LICENSE file.
358+
359+config("libjpeg_config") {
360+ libs = [ "jpeg" ]
361+}
362+
363+group("libjpeg") {
364+ public_configs = [ ":libjpeg_config" ]
365+}
366diff --git a/engine/src/build/linux/unbundle/libpng.gn b/engine/src/build/linux/unbundle/libpng.gn
367new file mode 100644
368index 0000000..91e0ee4
369--- /dev/null
370+++ b/engine/src/build/linux/unbundle/libpng.gn
371@@ -0,0 +1,23 @@
372+# Copyright 2016 The Chromium Authors
373+# Use of this source code is governed by a BSD-style license that can be
374+# found in the LICENSE file.
375+
376+import("//build/config/linux/pkg_config.gni")
377+import("//build/shim_headers.gni")
378+
379+pkg_config("libpng_config") {
380+ packages = [ "libpng" ]
381+}
382+
383+shim_headers("libpng_shim") {
384+ root_path = "."
385+ headers = [
386+ "png.h",
387+ "pngconf.h",
388+ ]
389+}
390+
391+source_set("libpng") {
392+ deps = [ ":libpng_shim" ]
393+ public_configs = [ ":libpng_config" ]
394+}
395diff --git a/engine/src/build/linux/unbundle/libwebp.gn b/engine/src/build/linux/unbundle/libwebp.gn
396new file mode 100644
397index 0000000..708cc9c
398--- /dev/null
399+++ b/engine/src/build/linux/unbundle/libwebp.gn
400@@ -0,0 +1,35 @@
401+# Copyright 2016 The Chromium Authors
402+# Use of this source code is governed by a BSD-style license that can be
403+# found in the LICENSE file.
404+
405+import("//build/config/linux/pkg_config.gni")
406+import("//build/shim_headers.gni")
407+
408+pkg_config("system_libwebp") {
409+ packages = [
410+ "libwebp",
411+ "libwebpdemux",
412+ "libwebpmux",
413+ ]
414+}
415+
416+shim_headers("libwebp_shim") {
417+ root_path = "src/src"
418+ headers = [
419+ "webp/decode.h",
420+ "webp/demux.h",
421+ "webp/encode.h",
422+ "webp/mux.h",
423+ "webp/mux_types.h",
424+ "webp/types.h",
425+ ]
426+}
427+
428+source_set("libwebp_webp") {
429+ deps = [ ":libwebp_shim" ]
430+ public_configs = [ ":system_libwebp" ]
431+}
432+
433+group("libwebp") {
434+ deps = [ ":libwebp_webp" ]
435+}
436diff --git a/engine/src/build/linux/unbundle/libxml.gn b/engine/src/build/linux/unbundle/libxml.gn
437new file mode 100644
438index 0000000..b42d044
439--- /dev/null
440+++ b/engine/src/build/linux/unbundle/libxml.gn
441@@ -0,0 +1,13 @@
442+# Copyright 2016 The Chromium Authors
443+# Use of this source code is governed by a BSD-style license that can be
444+# found in the LICENSE file.
445+
446+import("//build/config/linux/pkg_config.gni")
447+
448+pkg_config("system_libxml") {
449+ packages = [ "libxml-2.0" ]
450+}
451+
452+source_set("libxml") {
453+ public_configs = [ ":system_libxml" ]
454+}
455diff --git a/engine/src/build/linux/unbundle/replace_gn_files.py b/engine/src/build/linux/unbundle/replace_gn_files.py
456new file mode 100755
457index 0000000..b8b24c6
458--- /dev/null
459+++ b/engine/src/build/linux/unbundle/replace_gn_files.py
460@@ -0,0 +1,101 @@
461+#!/usr/bin/env python3
462+# Copyright 2016 The Chromium Authors
463+# Use of this source code is governed by a BSD-style license that can be
464+# found in the LICENSE file.
465+
466+"""
467+Replaces GN files in tree with files from here that
468+make the build use system libraries.
469+"""
470+
471+import argparse
472+import os
473+import shutil
474+import sys
475+
476+
477+REPLACEMENTS = {
478+ # Use system libabsl_2xxx. These 18 shims MUST be used together.
479+ 'absl_algorithm': 'flutter/third_party/abseil-cpp/absl/algorithm/BUILD.gn',
480+ 'absl_base': 'flutter/third_party/abseil-cpp/absl/base/BUILD.gn',
481+ 'absl_cleanup': 'flutter/third_party/abseil-cpp/absl/cleanup/BUILD.gn',
482+ 'absl_container': 'flutter/third_party/abseil-cpp/absl/container/BUILD.gn',
483+ 'absl_debugging': 'flutter/third_party/abseil-cpp/absl/debugging/BUILD.gn',
484+ 'absl_flags': 'flutter/third_party/abseil-cpp/absl/flags/BUILD.gn',
485+ 'absl_functional': 'flutter/third_party/abseil-cpp/absl/functional/BUILD.gn',
486+ 'absl_hash': 'flutter/third_party/abseil-cpp/absl/hash/BUILD.gn',
487+ 'absl_memory': 'flutter/third_party/abseil-cpp/absl/memory/BUILD.gn',
488+ 'absl_meta': 'flutter/third_party/abseil-cpp/absl/meta/BUILD.gn',
489+ 'absl_numeric': 'flutter/third_party/abseil-cpp/absl/numeric/BUILD.gn',
490+ 'absl_random': 'flutter/third_party/abseil-cpp/absl/random/BUILD.gn',
491+ 'absl_status': 'flutter/third_party/abseil-cpp/absl/status/BUILD.gn',
492+ 'absl_strings': 'flutter/third_party/abseil-cpp/absl/strings/BUILD.gn',
493+ 'absl_synchronization': 'flutter/third_party/abseil-cpp/absl/synchronization/BUILD.gn',
494+ 'absl_time': 'flutter/third_party/abseil-cpp/absl/time/BUILD.gn',
495+ 'absl_types': 'flutter/third_party/abseil-cpp/absl/types/BUILD.gn',
496+ 'absl_utility': 'flutter/third_party/abseil-cpp/absl/utility/BUILD.gn',
497+ #
498+ 'fontconfig': 'third_party/fontconfig/BUILD.gn',
499+ 'freetype2': 'flutter/third_party/freetype2/BUILD.gn',
500+ 'harfbuzz': 'flutter/build/secondary/flutter/third_party/harfbuzz/BUILD.gn',
501+ 'icu': 'flutter/third_party/icu/BUILD.gn',
502+ 'libjpeg-turbo': 'flutter/third_party/libjpeg-turbo/BUILD.gn',
503+ 'libpng': 'flutter/third_party/libpng/BUILD.gn',
504+ 'libwebp': 'flutter/build/secondary/flutter/third_party/libwebp/BUILD.gn',
505+ 'libxml': 'third_party/libxml/BUILD.gn',
506+ 'libXNVCtrl': 'flutter/third_party/angle/src/third_party/libXNVCtrl/BUILD.gn',
507+ 'sqlite': 'flutter/third_party/sqlite/BUILD.gn',
508+ # Use system libSPIRV-Tools in Swiftshader. These two shims MUST be used together.
509+ 'swiftshader-SPIRV-Headers': 'flutter/third_party/swiftshader/third_party/SPIRV-Headers/BUILD.gn',
510+ 'swiftshader-SPIRV-Tools': 'flutter/third_party/swiftshader/third_party/SPIRV-Tools/BUILD.gn',
511+ # Use system libSPIRV-Tools inside ANGLE. These two shims MUST be used together
512+ # and can only be used if WebGPU is not compiled (use_dawn=false)
513+ 'vulkan-SPIRV-Headers': 'flutter/third_party/vulkan-deps/spirv-headers/src/BUILD.gn',
514+ 'vulkan-SPIRV-Tools': 'flutter/third_party/vulkan-deps/spirv-tools/src/BUILD.gn',
515+ #
516+ 'zlib': 'flutter/third_party/zlib/BUILD.gn',
517+}
518+
519+
520+def DoMain(argv):
521+ my_dirname = os.path.dirname(__file__)
522+ source_tree_root = os.path.abspath(
523+ os.path.join(my_dirname, '..', '..', '..'))
524+
525+ parser = argparse.ArgumentParser()
526+ parser.add_argument('--system-libraries', nargs='*', default=[])
527+ parser.add_argument('--undo', action='store_true')
528+
529+ args = parser.parse_args(argv)
530+
531+ handled_libraries = set()
532+ for lib, path in REPLACEMENTS.items():
533+ if lib not in args.system_libraries:
534+ continue
535+ handled_libraries.add(lib)
536+
537+ if args.undo:
538+ # Restore original file, and also remove the backup.
539+ # This is meant to restore the source tree to its original state.
540+ os.rename(os.path.join(source_tree_root, path + '.orig'),
541+ os.path.join(source_tree_root, path))
542+ else:
543+ # Create a backup copy for --undo.
544+ shutil.copyfile(os.path.join(source_tree_root, path),
545+ os.path.join(source_tree_root, path + '.orig'))
546+
547+ # Copy the GN file from directory of this script to target path.
548+ shutil.copyfile(os.path.join(my_dirname, '%s.gn' % lib),
549+ os.path.join(source_tree_root, path))
550+
551+ unhandled_libraries = set(args.system_libraries) - handled_libraries
552+ if unhandled_libraries:
553+ print('Unrecognized system libraries requested: %s' % ', '.join(
554+ sorted(unhandled_libraries)), file=sys.stderr)
555+ return 1
556+
557+ return 0
558+
559+
560+if __name__ == '__main__':
561+ sys.exit(DoMain(sys.argv[1:]))
562diff --git a/engine/src/build/linux/unbundle/sqlite.gn b/engine/src/build/linux/unbundle/sqlite.gn
563new file mode 100644
564index 0000000..e6c653d
565--- /dev/null
566+++ b/engine/src/build/linux/unbundle/sqlite.gn
567@@ -0,0 +1,20 @@
568+# Copyright 2013 The Flutter Authors. All rights reserved.
569+# Use of this source code is governed by a BSD-style license that can be
570+# found in the LICENSE file.
571+
572+import("//build/config/linux/pkg_config.gni")
573+import("//build/shim_headers.gni")
574+
575+pkg_config("system_sqlite") {
576+ packages = [ "sqlite3" ]
577+}
578+
579+shim_headers("sqlite_shim") {
580+ root_path = "//third_party/sqlite"
581+ headers = [ "sqlite3.h" ]
582+}
583+
584+source_set("sqlite") {
585+ public_deps = [ ":sqlite_shim" ]
586+ public_configs = [ ":system_sqlite" ]
587+}
588diff --git a/engine/src/build/linux/unbundle/zlib.gn b/engine/src/build/linux/unbundle/zlib.gn
589new file mode 100644
590index 0000000..6daf3c6
591--- /dev/null
592+++ b/engine/src/build/linux/unbundle/zlib.gn
593@@ -0,0 +1,72 @@
594+# Copyright 2016 The Chromium Authors
595+# Use of this source code is governed by a BSD-style license that can be
596+# found in the LICENSE file.
597+
598+import("//build/shim_headers.gni")
599+
600+declare_args() {
601+ use_zlib_ng = false
602+}
603+
604+if (use_zlib_ng) {
605+ _suffix = "-ng"
606+} else {
607+ _suffix = ""
608+}
609+
610+shim_headers("zlib_shim") {
611+ root_path = "."
612+ headers = [ "zlib.h%zlib$_suffix.h" ]
613+ additional_includes = [ "flutter", "flutter/third_party" ]
614+}
615+
616+config("system_zlib") {
617+ defines = [ "USE_SYSTEM_ZLIB=1" ]
618+}
619+
620+config("zlib_config") {
621+ configs = [ ":system_zlib" ]
622+}
623+
624+source_set("zlib") {
625+ public_deps = [ ":zlib_shim" ]
626+ libs = [ "z$_suffix" ]
627+ public_configs = [ ":system_zlib" ]
628+}
629+
630+shim_headers("minizip_shim") {
631+ root_path = "contrib"
632+ headers = [
633+ "minizip/crypt.h",
634+ "minizip/ioapi.h",
635+ "minizip/iowin32.h",
636+ "minizip/mztools.h",
637+ "minizip/unzip.h",
638+ "minizip/zip.h",
639+ ]
640+}
641+
642+source_set("minizip") {
643+ deps = [ ":minizip_shim" ]
644+ libs = [ "minizip" ]
645+}
646+
647+static_library("zip") {
648+ sources = [
649+ "google/zip.cc",
650+ "google/zip.h",
651+ "google/zip_internal.cc",
652+ "google/zip_internal.h",
653+ "google/zip_reader.cc",
654+ "google/zip_reader.h",
655+ ]
656+ deps = [ ":minizip" ]
657+}
658+
659+static_library("compression_utils") {
660+ sources = [
661+ "google/compression_utils.cc",
662+ "google/compression_utils.h",
663+ ]
664+ deps = [ ":zlib" ]
665+}
666diff --git a/engine/src/build/shim_headers.gni b/engine/src/build/shim_headers.gni
667new file mode 100644
668index 0000000..1d24e0a
669--- /dev/null
670+++ b/engine/src/build/shim_headers.gni
671@@ -0,0 +1,42 @@
672+# Copyright 2016 The Chromium Authors
673+# Use of this source code is governed by a BSD-style license that can be
674+# found in the LICENSE file.
675+template("shim_headers") {
676+ action_name = "gen_${target_name}"
677+ config_name = "${target_name}_config"
678+ shim_headers_path = "${root_gen_dir}/shim_headers/${target_name}"
679+ config(config_name) {
680+ include_dirs = [ shim_headers_path ]
681+ if (defined(invoker.additional_includes)) {
682+ foreach(i, invoker.additional_includes) {
683+ include_dirs += [ shim_headers_path + "/" + i ]
684+ }
685+ }
686+ }
687+ action(action_name) {
688+ script = "//tools/generate_shim_headers.py"
689+ args = [
690+ "--generate",
691+ "--headers-root",
692+ rebase_path(invoker.root_path),
693+ "--output-directory",
694+ rebase_path(shim_headers_path),
695+ ]
696+ if (defined(invoker.prefix)) {
697+ args += [
698+ "--prefix",
699+ invoker.prefix,
700+ ]
701+ }
702+ args += invoker.headers
703+ outputs = []
704+ foreach(h, invoker.headers) {
705+ outputs += [ shim_headers_path + "/" +
706+ rebase_path(invoker.root_path, "//") + "/" + h ]
707+ }
708+ }
709+ group(target_name) {
710+ public_deps = [ ":${action_name}" ]
711+ all_dependent_configs = [ ":${config_name}" ]
712+ }
713+}
714diff --git a/engine/src/tools/generate_shim_headers.py b/engine/src/tools/generate_shim_headers.py
715new file mode 100644
716index 0000000..aaa16f8
717--- /dev/null
718+++ b/engine/src/tools/generate_shim_headers.py
719@@ -0,0 +1,116 @@
720+#!/usr/bin/env python
721+# Copyright 2012 The Chromium Authors
722+# Use of this source code is governed by a BSD-style license that can be
723+# found in the LICENSE file.
724+
725+"""
726+Generates shim headers that mirror the directory structure of bundled headers,
727+but just forward to the system ones.
728+
729+This allows seamless compilation against system headers with no changes
730+to our source code.
731+"""
732+
733+
734+import optparse
735+import os.path
736+import sys
737+
738+
739+SHIM_TEMPLATE = """
740+#if defined(OFFICIAL_BUILD)
741+#error shim headers must not be used in official builds!
742+#endif
743+"""
744+
745+
746+def GeneratorMain(argv):
747+ parser = optparse.OptionParser()
748+ parser.add_option('--headers-root', action='append')
749+ parser.add_option('--define', action='append')
750+ parser.add_option('--output-directory')
751+ parser.add_option('--prefix', default='')
752+ parser.add_option('--use-include-next', action='store_true')
753+ parser.add_option('--outputs', action='store_true')
754+ parser.add_option('--generate', action='store_true')
755+
756+ options, args = parser.parse_args(argv)
757+
758+ if not options.headers_root:
759+ parser.error('Missing --headers-root parameter.')
760+ if not options.output_directory:
761+ parser.error('Missing --output-directory parameter.')
762+ if not args:
763+ parser.error('Missing arguments - header file names.')
764+
765+ source_tree_root = os.path.abspath(
766+ os.path.join(os.path.dirname(__file__), '..'))
767+
768+ for root in options.headers_root:
769+ target_directory = os.path.join(
770+ options.output_directory,
771+ os.path.relpath(root, source_tree_root))
772+ if options.generate and not os.path.exists(target_directory):
773+ os.makedirs(target_directory)
774+
775+ for header_spec in args:
776+ if ';' in header_spec:
777+ (header_filename,
778+ include_before,
779+ include_after) = header_spec.split(';', 2)
780+ else:
781+ header_filename = header_spec
782+ include_before = ''
783+ include_after = ''
784+ if '%' in header_filename:
785+ (header_filename,
786+ upstream_header_filename) = header_filename.split('%', 1)
787+ else:
788+ upstream_header_filename = header_filename
789+ if options.outputs:
790+ yield os.path.join(target_directory, header_filename)
791+ if options.generate:
792+ header_path = os.path.join(target_directory, header_filename)
793+ header_dir = os.path.dirname(header_path)
794+ if not os.path.exists(header_dir):
795+ os.makedirs(header_dir)
796+ with open(header_path, 'w') as f:
797+ f.write(SHIM_TEMPLATE)
798+
799+ if options.define:
800+ for define in options.define:
801+ key, value = define.split('=', 1)
802+ # This non-standard push_macro extension is supported
803+ # by compilers we support (GCC, clang).
804+ f.write('#pragma push_macro("%s")\n' % key)
805+ f.write('#undef %s\n' % key)
806+ f.write('#define %s %s\n' % (key, value))
807+
808+ if include_before:
809+ for header in include_before.split(':'):
810+ f.write('#include %s\n' % header)
811+
812+ include_target = options.prefix + upstream_header_filename
813+ if options.use_include_next:
814+ f.write('#include_next <%s>\n' % include_target)
815+ else:
816+ f.write('#include <%s>\n' % include_target)
817+
818+ if include_after:
819+ for header in include_after.split(':'):
820+ f.write('#include %s\n' % header)
821+
822+ if options.define:
823+ for define in options.define:
824+ key, value = define.split('=', 1)
825+ # This non-standard pop_macro extension is supported
826+ # by compilers we support (GCC, clang).
827+ f.write('#pragma pop_macro("%s")\n' % key)
828+
829+
830+def DoMain(argv):
831+ return '\n'.join(GeneratorMain(argv))
832+
833+
834+if __name__ == '__main__':
835+ DoMain(sys.argv[1:])
836--- /dev/null
837+++ ./engine/src/build/linux/unbundle/vulkan-SPIRV-Headers.gn
838@@ -0,0 +1,19 @@
839+# This shim can only be used if you build Chromium without DAWN
840+
841+import("//build/shim_headers.gni")
842+
843+shim_headers("vulkan-SPIRV-Headers_shim") {
844+ root_path = "include"
845+ headers = [
846+ "spirv/unified1/GLSL.std.450.h",
847+ "spirv/unified1/NonSemanticClspvReflection.h",
848+ "spirv/unified1/NonSemanticDebugPrintf.h",
849+ "spirv/unified1/OpenCL.std.h",
850+ "spirv/unified1/spirv.h",
851+ "spirv/unified1/spirv.hpp",
852+ ]
853+}
854+
855+source_set("spv_headers") {
856+ deps = [ ":vulkan-SPIRV-Headers_shim" ]
857+}
858--- /dev/null
859+++ ./engine/src/build/linux/unbundle/vulkan-SPIRV-Tools.gn
860@@ -0,0 +1,73 @@
861+# This shim can only be used if you build Chromium without DAWN
862+
863+import("//build/config/linux/pkg_config.gni")
864+import("//build/shim_headers.gni")
865+
866+pkg_config("spvtools_internal_config") {
867+ packages = [ "SPIRV-Tools" ]
868+}
869+
870+shim_headers("vulkan-SPIRV-Tools_shim") {
871+ root_path = "include"
872+ headers = [
873+ "spirv-tools/instrument.hpp",
874+ "spirv-tools/libspirv.h",
875+ "spirv-tools/libspirv.hpp",
876+ "spirv-tools/linker.hpp",
877+ "spirv-tools/optimizer.hpp",
878+ ]
879+}
880+
881+source_set("SPIRV-Tools") {
882+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
883+ public_configs = [ ":spvtools_internal_config" ]
884+}
885+
886+source_set("spvtools") {
887+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
888+ public_configs = [ ":spvtools_internal_config" ]
889+}
890+
891+source_set("spvtools_core_enums_unified1") {
892+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
893+ public_configs = [ ":spvtools_internal_config" ]
894+}
895+
896+source_set("spvtools_core_tables_unified1") {
897+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
898+ public_configs = [ ":spvtools_internal_config" ]
899+}
900+
901+source_set("spvtools_headers") {
902+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
903+ public_configs = [ ":spvtools_internal_config" ]
904+}
905+
906+source_set("spvtools_language_header_cldebuginfo100") {
907+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
908+ public_configs = [ ":spvtools_internal_config" ]
909+}
910+
911+source_set("spvtools_language_header_debuginfo") {
912+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
913+ public_configs = [ ":spvtools_internal_config" ]
914+}
915+
916+source_set("spvtools_language_header_vkdebuginfo100") {
917+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
918+ public_configs = [ ":spvtools_internal_config" ]
919+}
920+
921+source_set("spvtools_opt") {
922+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
923+ public_configs = [ ":spvtools_internal_config" ]
924+}
925+
926+config("spvtools_public_config") {
927+ configs = [ ":spvtools_internal_config" ]
928+}
929+
930+source_set("spvtools_val") {
931+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
932+ public_configs = [ ":spvtools_internal_config" ]
933+}