From 19a9720978700a24efed8dda7e0935ea2b7338c4 Mon Sep 17 00:00:00 2001 From: halcanary Date: Wed, 3 Aug 2016 15:08:04 -0700 Subject: [PATCH] GN: build sfntly, icu, harfbuzz BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2200833010 Review-Url: https://codereview.chromium.org/2200833010 --- BUILD.gn | 16 +++ gn/BUILD.gn | 5 +- gn/BUILDCONFIG.gn | 17 +-- third_party/harfbuzz/BUILD.gn | 64 +++++++++++ third_party/icu/BUILD.gn | 207 ++++++++++++++++++++++++++++++++++ third_party/sfntly/BUILD.gn | 74 ++++++++++++ third_party/third_party.gni | 4 + 7 files changed, 379 insertions(+), 8 deletions(-) create mode 100644 third_party/harfbuzz/BUILD.gn create mode 100644 third_party/icu/BUILD.gn create mode 100644 third_party/sfntly/BUILD.gn diff --git a/BUILD.gn b/BUILD.gn index 3fae15135d..0d15f3169c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -65,6 +65,9 @@ config("skia_private") { "SK_HAS_PNG_LIBRARY", "SK_HAS_WEBP_LIBRARY", + # TODO(halcanary): make this the default; this is the value Android uses. + "SK_SFNTLY_SUBSETTER=\"sample/chromium/font_subsetter.h\"", + "TURBO_HAS_565", "TURBO_HAS_CROP", "TURBO_HAS_SKIP", @@ -171,6 +174,7 @@ component("skia") { "//third_party/libjpeg_turbo", "//third_party/libpng", "//third_party/libwebp", + "//third_party/sfntly", "//third_party/zlib", ] @@ -544,4 +548,16 @@ if (!is_component_build) { # Our test tools use many non-SK_API APIs... ] testonly = true } + + executable("sktexttopdf") { + sources = [ + "tools/SkShaper_harfbuzz.cpp", + "tools/using_skia_and_harfbuzz.cpp", + ] + deps = [ + ":skia", + "//third_party/harfbuzz", + ] + testonly = true + } } diff --git a/gn/BUILD.gn b/gn/BUILD.gn index 5789aef48b..48bd90f639 100644 --- a/gn/BUILD.gn +++ b/gn/BUILD.gn @@ -9,6 +9,10 @@ declare_args() { cxx = "c++" } +config("no_rtti") { + cflags_cc = [ "-fno-rtti" ] +} + config("default") { cflags = [ "-g", @@ -30,7 +34,6 @@ config("default") { cflags_cc = [ "-std=c++11", "-fno-exceptions", - "-fno-rtti", "-fno-threadsafe-statics", "-fvisibility-inlines-hidden", diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn index 681b15b83b..e2719c196e 100644 --- a/gn/BUILDCONFIG.gn +++ b/gn/BUILDCONFIG.gn @@ -40,29 +40,32 @@ template("component") { } # Default configs -_default_configs = [ "//gn:default" ] +default_configs = [ + "//gn:default", + "//gn:no_rtti", +] if (!is_debug) { - _default_configs += [ "//gn:release" ] + default_configs += [ "//gn:release" ] } set_defaults("executable") { - configs = _default_configs + [ "//gn:executable" ] + configs = default_configs + [ "//gn:executable" ] } set_defaults("source_set") { - configs = _default_configs + configs = default_configs } set_defaults("static_library") { - configs = _default_configs + configs = default_configs } set_defaults("shared_library") { - configs = _default_configs + configs = default_configs } set_defaults("component") { - configs = _default_configs + configs = default_configs } # For now, we support GCC-like toolchains, including Clang. diff --git a/third_party/harfbuzz/BUILD.gn b/third_party/harfbuzz/BUILD.gn new file mode 100644 index 0000000000..65706539b3 --- /dev/null +++ b/third_party/harfbuzz/BUILD.gn @@ -0,0 +1,64 @@ +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +declare_args() { +} + +import("../third_party.gni") + +third_party("harfbuzz") { + public_include_dirs = [ + ".", + "../externals/harfbuzz/src", + ] + defines = [ + "HAVE_ICU", + "HAVE_ICU_BUILTIN", + "HAVE_OT", + "HB_NO_MT", + ] + deps = [ + "//third_party/icu", + ] + sources = [ + "../externals/harfbuzz/src/hb-blob.cc", + "../externals/harfbuzz/src/hb-buffer-serialize.cc", + "../externals/harfbuzz/src/hb-buffer.cc", + "../externals/harfbuzz/src/hb-common.cc", + "../externals/harfbuzz/src/hb-face.cc", + "../externals/harfbuzz/src/hb-fallback-shape.cc", + "../externals/harfbuzz/src/hb-font.cc", + "../externals/harfbuzz/src/hb-icu.cc", + "../externals/harfbuzz/src/hb-ot-font.cc", + "../externals/harfbuzz/src/hb-ot-layout.cc", + "../externals/harfbuzz/src/hb-ot-map.cc", + "../externals/harfbuzz/src/hb-ot-shape-complex-arabic.cc", + "../externals/harfbuzz/src/hb-ot-shape-complex-default.cc", + "../externals/harfbuzz/src/hb-ot-shape-complex-hangul.cc", + "../externals/harfbuzz/src/hb-ot-shape-complex-hebrew.cc", + "../externals/harfbuzz/src/hb-ot-shape-complex-indic-table.cc", + "../externals/harfbuzz/src/hb-ot-shape-complex-indic.cc", + "../externals/harfbuzz/src/hb-ot-shape-complex-myanmar.cc", + "../externals/harfbuzz/src/hb-ot-shape-complex-thai.cc", + "../externals/harfbuzz/src/hb-ot-shape-complex-tibetan.cc", + "../externals/harfbuzz/src/hb-ot-shape-complex-use-table.cc", + "../externals/harfbuzz/src/hb-ot-shape-complex-use.cc", + "../externals/harfbuzz/src/hb-ot-shape-fallback.cc", + "../externals/harfbuzz/src/hb-ot-shape-normalize.cc", + "../externals/harfbuzz/src/hb-ot-shape.cc", + "../externals/harfbuzz/src/hb-ot-tag.cc", + "../externals/harfbuzz/src/hb-set.cc", + "../externals/harfbuzz/src/hb-shape-plan.cc", + "../externals/harfbuzz/src/hb-shape.cc", + "../externals/harfbuzz/src/hb-shaper.cc", + "../externals/harfbuzz/src/hb-unicode.cc", + "../externals/harfbuzz/src/hb-warning.cc", + ] + if (is_mac) { + sources += [ "../externals/harfbuzz/src/hb-coretext.cc" ] + defines += [ "HAVE_CORETEXT" ] + } + testonly = true +} diff --git a/third_party/icu/BUILD.gn b/third_party/icu/BUILD.gn new file mode 100644 index 0000000000..e2137609d8 --- /dev/null +++ b/third_party/icu/BUILD.gn @@ -0,0 +1,207 @@ +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +declare_args() { +} + +import("../third_party.gni") + +third_party("icu") { + public_include_dirs = [ "../externals/icu/source/common" ] + configs -= [ "//gn:no_rtti" ] + libs = [ "dl" ] + defines = [ + # http://userguide.icu-project.org/howtouseicu + "U_COMMON_IMPLEMENTATION", + "U_STATIC_IMPLEMENTATION", + ] + sources = [ + "../externals/icu/source/common/appendable.cpp", + "../externals/icu/source/common/bmpset.cpp", + "../externals/icu/source/common/brkeng.cpp", + "../externals/icu/source/common/brkiter.cpp", + "../externals/icu/source/common/bytestream.cpp", + "../externals/icu/source/common/bytestrie.cpp", + "../externals/icu/source/common/bytestriebuilder.cpp", + "../externals/icu/source/common/bytestrieiterator.cpp", + "../externals/icu/source/common/caniter.cpp", + "../externals/icu/source/common/chariter.cpp", + "../externals/icu/source/common/charstr.cpp", + "../externals/icu/source/common/cmemory.c", + "../externals/icu/source/common/cstring.c", + "../externals/icu/source/common/cwchar.c", + "../externals/icu/source/common/dictbe.cpp", + "../externals/icu/source/common/dictionarydata.cpp", + "../externals/icu/source/common/dtintrv.cpp", + "../externals/icu/source/common/errorcode.cpp", + "../externals/icu/source/common/filteredbrk.cpp", + "../externals/icu/source/common/filterednormalizer2.cpp", + "../externals/icu/source/common/icudataver.c", + "../externals/icu/source/common/icuplug.cpp", + "../externals/icu/source/common/listformatter.cpp", + "../externals/icu/source/common/loadednormalizer2impl.cpp", + "../externals/icu/source/common/locavailable.cpp", + "../externals/icu/source/common/locbased.cpp", + "../externals/icu/source/common/locdispnames.cpp", + "../externals/icu/source/common/locid.cpp", + "../externals/icu/source/common/loclikely.cpp", + "../externals/icu/source/common/locmap.c", + "../externals/icu/source/common/locresdata.cpp", + "../externals/icu/source/common/locutil.cpp", + "../externals/icu/source/common/messagepattern.cpp", + "../externals/icu/source/common/normalizer2.cpp", + "../externals/icu/source/common/normalizer2impl.cpp", + "../externals/icu/source/common/normlzr.cpp", + "../externals/icu/source/common/parsepos.cpp", + "../externals/icu/source/common/patternprops.cpp", + "../externals/icu/source/common/pluralmap.cpp", + "../externals/icu/source/common/propname.cpp", + "../externals/icu/source/common/propsvec.c", + "../externals/icu/source/common/punycode.cpp", + "../externals/icu/source/common/putil.cpp", + "../externals/icu/source/common/rbbi.cpp", + "../externals/icu/source/common/rbbidata.cpp", + "../externals/icu/source/common/rbbinode.cpp", + "../externals/icu/source/common/rbbirb.cpp", + "../externals/icu/source/common/rbbiscan.cpp", + "../externals/icu/source/common/rbbisetb.cpp", + "../externals/icu/source/common/rbbistbl.cpp", + "../externals/icu/source/common/rbbitblb.cpp", + "../externals/icu/source/common/resbund.cpp", + "../externals/icu/source/common/resbund_cnv.cpp", + "../externals/icu/source/common/resource.cpp", + "../externals/icu/source/common/ruleiter.cpp", + "../externals/icu/source/common/schriter.cpp", + "../externals/icu/source/common/serv.cpp", + "../externals/icu/source/common/servlk.cpp", + "../externals/icu/source/common/servlkf.cpp", + "../externals/icu/source/common/servls.cpp", + "../externals/icu/source/common/servnotf.cpp", + "../externals/icu/source/common/servrbf.cpp", + "../externals/icu/source/common/servslkf.cpp", + "../externals/icu/source/common/sharedobject.cpp", + "../externals/icu/source/common/simplepatternformatter.cpp", + "../externals/icu/source/common/stringpiece.cpp", + "../externals/icu/source/common/stringtriebuilder.cpp", + "../externals/icu/source/common/uarrsort.c", + "../externals/icu/source/common/ubidi.c", + "../externals/icu/source/common/ubidi_props.c", + "../externals/icu/source/common/ubidiln.c", + "../externals/icu/source/common/ubidiwrt.c", + "../externals/icu/source/common/ubrk.cpp", + "../externals/icu/source/common/ucase.cpp", + "../externals/icu/source/common/ucasemap.cpp", + "../externals/icu/source/common/ucasemap_titlecase_brkiter.cpp", + "../externals/icu/source/common/ucat.c", + "../externals/icu/source/common/uchar.c", + "../externals/icu/source/common/ucharstrie.cpp", + "../externals/icu/source/common/ucharstriebuilder.cpp", + "../externals/icu/source/common/ucharstrieiterator.cpp", + "../externals/icu/source/common/uchriter.cpp", + "../externals/icu/source/common/ucln_cmn.cpp", + "../externals/icu/source/common/ucmndata.c", + "../externals/icu/source/common/ucnv.c", + "../externals/icu/source/common/ucnv2022.cpp", + "../externals/icu/source/common/ucnv_bld.cpp", + "../externals/icu/source/common/ucnv_cb.c", + "../externals/icu/source/common/ucnv_cnv.c", + "../externals/icu/source/common/ucnv_ct.c", + "../externals/icu/source/common/ucnv_err.c", + "../externals/icu/source/common/ucnv_ext.cpp", + "../externals/icu/source/common/ucnv_io.cpp", + "../externals/icu/source/common/ucnv_lmb.c", + "../externals/icu/source/common/ucnv_set.c", + "../externals/icu/source/common/ucnv_u16.c", + "../externals/icu/source/common/ucnv_u32.c", + "../externals/icu/source/common/ucnv_u7.c", + "../externals/icu/source/common/ucnv_u8.c", + "../externals/icu/source/common/ucnvbocu.cpp", + "../externals/icu/source/common/ucnvdisp.c", + "../externals/icu/source/common/ucnvhz.c", + "../externals/icu/source/common/ucnvisci.c", + "../externals/icu/source/common/ucnvlat1.c", + "../externals/icu/source/common/ucnvmbcs.cpp", + "../externals/icu/source/common/ucnvscsu.c", + "../externals/icu/source/common/ucnvsel.cpp", + "../externals/icu/source/common/ucol_swp.cpp", + "../externals/icu/source/common/udata.cpp", + "../externals/icu/source/common/udatamem.c", + "../externals/icu/source/common/udataswp.c", + "../externals/icu/source/common/uenum.c", + "../externals/icu/source/common/uhash.c", + "../externals/icu/source/common/uhash_us.cpp", + "../externals/icu/source/common/uidna.cpp", + "../externals/icu/source/common/uinit.cpp", + "../externals/icu/source/common/uinvchar.c", + "../externals/icu/source/common/uiter.cpp", + "../externals/icu/source/common/ulist.c", + "../externals/icu/source/common/ulistformatter.cpp", + "../externals/icu/source/common/uloc.cpp", + "../externals/icu/source/common/uloc_keytype.cpp", + "../externals/icu/source/common/uloc_tag.c", + "../externals/icu/source/common/umapfile.c", + "../externals/icu/source/common/umath.c", + "../externals/icu/source/common/umutex.cpp", + "../externals/icu/source/common/unames.cpp", + "../externals/icu/source/common/unifiedcache.cpp", + "../externals/icu/source/common/unifilt.cpp", + "../externals/icu/source/common/unifunct.cpp", + "../externals/icu/source/common/uniset.cpp", + "../externals/icu/source/common/uniset_closure.cpp", + "../externals/icu/source/common/uniset_props.cpp", + "../externals/icu/source/common/unisetspan.cpp", + "../externals/icu/source/common/unistr.cpp", + "../externals/icu/source/common/unistr_case.cpp", + "../externals/icu/source/common/unistr_case_locale.cpp", + "../externals/icu/source/common/unistr_cnv.cpp", + "../externals/icu/source/common/unistr_props.cpp", + "../externals/icu/source/common/unistr_titlecase_brkiter.cpp", + "../externals/icu/source/common/unorm.cpp", + "../externals/icu/source/common/unormcmp.cpp", + "../externals/icu/source/common/uobject.cpp", + "../externals/icu/source/common/uprops.cpp", + "../externals/icu/source/common/ures_cnv.c", + "../externals/icu/source/common/uresbund.cpp", + "../externals/icu/source/common/uresdata.cpp", + "../externals/icu/source/common/uresource.cpp", + "../externals/icu/source/common/usc_impl.c", + "../externals/icu/source/common/uscript.c", + "../externals/icu/source/common/uscript_props.cpp", + "../externals/icu/source/common/uset.cpp", + "../externals/icu/source/common/uset_props.cpp", + "../externals/icu/source/common/usetiter.cpp", + "../externals/icu/source/common/ushape.cpp", + "../externals/icu/source/common/usprep.cpp", + "../externals/icu/source/common/ustack.cpp", + "../externals/icu/source/common/ustr_cnv.cpp", + "../externals/icu/source/common/ustr_titlecase_brkiter.cpp", + "../externals/icu/source/common/ustr_wcs.cpp", + "../externals/icu/source/common/ustrcase.cpp", + "../externals/icu/source/common/ustrcase_locale.cpp", + "../externals/icu/source/common/ustrenum.cpp", + "../externals/icu/source/common/ustrfmt.c", + "../externals/icu/source/common/ustring.cpp", + "../externals/icu/source/common/ustrtrns.cpp", + "../externals/icu/source/common/utext.cpp", + "../externals/icu/source/common/utf_impl.c", + "../externals/icu/source/common/util.cpp", + "../externals/icu/source/common/util_props.cpp", + "../externals/icu/source/common/utrace.c", + "../externals/icu/source/common/utrie.cpp", + "../externals/icu/source/common/utrie2.cpp", + "../externals/icu/source/common/utrie2_builder.cpp", + "../externals/icu/source/common/uts46.cpp", + "../externals/icu/source/common/utypes.c", + "../externals/icu/source/common/uvector.cpp", + "../externals/icu/source/common/uvectr32.cpp", + "../externals/icu/source/common/uvectr64.cpp", + "../externals/icu/source/common/wintz.c", + ] + if (is_linux) { + sources += [ "../externals/icu/linux/icudtl_dat.S" ] + } else if (is_mac) { + sources += [ "../externals/icu/mac/icudtl_dat.S" ] + } +} diff --git a/third_party/sfntly/BUILD.gn b/third_party/sfntly/BUILD.gn new file mode 100644 index 0000000000..a9bf925fb2 --- /dev/null +++ b/third_party/sfntly/BUILD.gn @@ -0,0 +1,74 @@ +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +declare_args() { +} + +import("../third_party.gni") + +third_party("sfntly") { + public_include_dirs = [ "../externals/sfntly/cpp/src" ] + defines = [ "SFNTLY_NO_EXCEPTION" ] + deps = [ + "//third_party/icu", + ] + libs = [ "pthread" ] + sources = [ + "../externals/sfntly/cpp/src/sample/chromium/font_subsetter.cc", + "../externals/sfntly/cpp/src/sample/chromium/subsetter_impl.cc", + "../externals/sfntly/cpp/src/sfntly/data/byte_array.cc", + "../externals/sfntly/cpp/src/sfntly/data/font_data.cc", + "../externals/sfntly/cpp/src/sfntly/data/font_input_stream.cc", + "../externals/sfntly/cpp/src/sfntly/data/font_output_stream.cc", + "../externals/sfntly/cpp/src/sfntly/data/growable_memory_byte_array.cc", + "../externals/sfntly/cpp/src/sfntly/data/memory_byte_array.cc", + "../externals/sfntly/cpp/src/sfntly/data/readable_font_data.cc", + "../externals/sfntly/cpp/src/sfntly/data/writable_font_data.cc", + "../externals/sfntly/cpp/src/sfntly/font.cc", + "../externals/sfntly/cpp/src/sfntly/font_factory.cc", + "../externals/sfntly/cpp/src/sfntly/port/file_input_stream.cc", + "../externals/sfntly/cpp/src/sfntly/port/lock.cc", + "../externals/sfntly/cpp/src/sfntly/port/memory_input_stream.cc", + "../externals/sfntly/cpp/src/sfntly/port/memory_output_stream.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/big_glyph_metrics.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/bitmap_glyph.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/bitmap_glyph_info.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/bitmap_size_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/composite_bitmap_glyph.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/ebdt_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/eblc_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/ebsc_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/glyph_metrics.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/index_sub_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/index_sub_table_format1.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/index_sub_table_format2.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/index_sub_table_format3.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/index_sub_table_format4.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/index_sub_table_format5.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/simple_bitmap_glyph.cc", + "../externals/sfntly/cpp/src/sfntly/table/bitmap/small_glyph_metrics.cc", + "../externals/sfntly/cpp/src/sfntly/table/byte_array_table_builder.cc", + "../externals/sfntly/cpp/src/sfntly/table/core/cmap_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/core/font_header_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/core/horizontal_device_metrics_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/core/horizontal_header_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/core/horizontal_metrics_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/core/maximum_profile_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/core/name_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/core/os2_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/font_data_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/generic_table_builder.cc", + "../externals/sfntly/cpp/src/sfntly/table/header.cc", + "../externals/sfntly/cpp/src/sfntly/table/subtable.cc", + "../externals/sfntly/cpp/src/sfntly/table/table.cc", + "../externals/sfntly/cpp/src/sfntly/table/table_based_table_builder.cc", + "../externals/sfntly/cpp/src/sfntly/table/truetype/glyph_table.cc", + "../externals/sfntly/cpp/src/sfntly/table/truetype/loca_table.cc", + "../externals/sfntly/cpp/src/sfntly/tag.cc", + "../externals/sfntly/cpp/src/sfntly/tools/subsetter/glyph_table_subsetter.cc", + "../externals/sfntly/cpp/src/sfntly/tools/subsetter/subsetter.cc", + "../externals/sfntly/cpp/src/sfntly/tools/subsetter/table_subsetter_impl.cc", + ] +} diff --git a/third_party/third_party.gni b/third_party/third_party.gni index 9e552bf5a0..34751c0286 100644 --- a/third_party/third_party.gni +++ b/third_party/third_party.gni @@ -15,3 +15,7 @@ template("third_party") { cflags = [ "-w" ] } } + +set_defaults("third_party") { + configs = default_configs +}