[canvaskit] Add Freetype/Fonts to Bazel Build

This re-works src/ports/BUILD.bazel to work like our other
BUILD files, i.e. one rule "srcs" that brings in the necessary
private filegroups.

To work around an abort with LLVM [1], we have to go back to an
earlier version of emscripten (temporarily?).

Future work should look at using transitions [2] to allow various
executables (e.g. CanvasKit, DM) to set their own set of Bazel
flags, w/o the build invokers having to specify them.

These transitions might be able to handle more complex cases
that we currently use if statements in GN to deal with.

The Freetype build rule was created by taking the BUILD.gn
rule, adding in all the sources listed there and then playing
compile-whack-a-mole to add in all the headers and included
.c files.

Suggested Review Order:
 - third_party/BUILD.bazel to see freetype build rules
 - bazel/common_config_settings/ to see treatment of fontmgr
   like codecs (many possible) and fontmgr_factory (only one).
 - src/ports/BUILD.bazel
 - BUILD.bazel
 - modules/canvaskit/BUILD.bazel. Take note of the gen_rule that
   calls tools/embed_resources.py to produce the .cpp file
   containing the embedded font data.
 - Everything else.

[1] https://github.com/emscripten-core/emscripten/issues/15528
[2] https://github.com/bazelbuild/examples/tree/main/rules/starlark_configurations/cc_binary_selectable_copts
Bug: skia:12541
Change-Id: I08dab82a901d80507007b354ca20cbfad2c2388f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471636
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
This commit is contained in:
Kevin Lubick 2021-11-16 14:09:44 -05:00
parent fa2edac74a
commit 888d4efa77
13 changed files with 719 additions and 93 deletions

View File

@ -7,7 +7,13 @@ build:clang --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
# =============================================================================
# Alias to build configurations below. This makes configuring things from
# the command line easier.
build --flag_alias=fontmgr=//bazel/common_config_settings:fontmgr
build --flag_alias=include_fontmgr=//bazel/common_config_settings:include_fontmgr
build --flag_alias=fontmgr_factory=//bazel/common_config_settings:fontmgr_factory
build --flag_alias=gpu_backend=//bazel/common_config_settings:gpu_backend
build --flag_alias=include_codec=//bazel/common_config_settings:include_codec
build --flag_alias=with_gl_standard=//bazel/common_config_settings:with_gl_standard
# CanvasKit flags
build --flag_alias=ck_enable_fonts=//modules/canvaskit:enable_fonts
build --flag_alias=ck_disable_fonts=no//modules/canvaskit:enable_fonts

View File

@ -30,6 +30,7 @@ CORE_SRCS = [
"//src/effects:srcs",
"//src/opts:srcs",
"//src/pathops:srcs",
"//src/ports:srcs",
"//src/sfnt:srcs",
"//src/shaders:srcs",
"//src/utils:srcs",
@ -114,6 +115,19 @@ CORE_DEFINES = ["SK_HAS_ANDROID_CODEC"] + select({
"//bazel/common_config_settings:webp_codec": ["SK_CODEC_DECODES_WEBP"],
},
default = [],
) + select({
# working around https://github.com/emscripten-core/emscripten/issues/10072
"//bazel/common_config_settings:cpu_wasm": ["SK_FORCE_8_BYTE_ALIGNMENT"],
"//conditions:default": [],
})
selects.config_setting_group(
name = "any_freetype_fontmgr",
match_any = [
"//bazel/common_config_settings:custom_directory_fontmgr",
"//bazel/common_config_settings:custom_embedded_fontmgr",
"//bazel/common_config_settings:custom_empty_fontmgr",
],
)
CORE_DEPS = [] + select_multi(
@ -132,6 +146,11 @@ CORE_DEPS = [] + select_multi(
# Bazel gets sad.
("//bazel/common_config_settings:jpeg_codec", "//bazel/common_config_settings:raw_codec"): ["//third_party:libjpeg-turbo"],
"//conditions:default": [],
}) + select({
":any_freetype_fontmgr": [
"//third_party:freetype2",
],
"//conditions:default": [],
})
CORE_COPTS = []

View File

@ -17,7 +17,8 @@ emsdk_deps()
load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps")
emsdk_emscripten_deps(emscripten_version = "2.0.32")
# Use older version to work around https://github.com/emscripten-core/emscripten/issues/15528
emsdk_emscripten_deps(emscripten_version = "2.0.13")
build_cpp_toolchain(
# Meant to run on amd64 linux and compile for amd64 linux using musl as the c library.
@ -43,3 +44,9 @@ http_archive(
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
http_archive(
name = "rules_python",
sha256 = "cd6730ed53a002c56ce4e2f396ba3b3be262fd7cb68339f0377a45e8227fe332",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.5.0/rules_python-0.5.0.tar.gz",
)

View File

@ -98,7 +98,17 @@ string_flag_with_values(
flag_name = "fontmgr_factory",
values = [
"empty_fontmgr_factory",
"custom_directory_fontmgr_factory",
"custom_embedded_fontmgr_factory",
],
)
string_flag_with_values(
flag_name = "include_fontmgr",
multiple = True,
values = [
"custom_directory_fontmgr",
"custom_embedded_fontmgr",
"custom_empty_fontmgr",
],
)

View File

@ -1,8 +1,16 @@
"""
This file contains helpers for defining build flags and options that are used to
configure the Skia build.
"""
# https://github.com/bazelbuild/bazel-skylib/blob/main/rules/common_settings.bzl
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag", skylib_bool_flag = "bool_flag")
# Forked from https://github.com/bazelbuild/bazel-skylib/blob/main/rules/common_settings.bzl
BuildSettingInfo = provider(fields = ["values"])
BuildSettingInfo = provider(
doc = "A singleton provider that contains the raw value of a multi-string build setting",
fields = ["values"],
)
def _multi_string_impl(ctx):
allowed_values = ctx.attr.values
@ -23,13 +31,24 @@ multi_string_flag = rule(
doc = "A string-typed build setting that can be set multiple times on the command line",
)
# string_flag_with_values is a Bazel Macro that defines a flag with the given name and a set
# of valid values for that flag. For each value, a config_setting is defined with the name
# of the value, associated with the created flag.
# This is defined to make the BUILD.bazel file easier to read w/o the boilerplate of defining
# a string_flag rule and n config_settings
# https://docs.bazel.build/versions/main/skylark/macros.html
def string_flag_with_values(flag_name, values, default = "", multiple = False):
def string_flag_with_values(flag_name, values, default = "", multiple = False, name = ""):
"""Create a string flag and corresponding config_settings.
string_flag_with_values is a Bazel Macro that defines a flag with the given name and a set
of valid values for that flag. For each value, a config_setting is defined with the name
of the value, associated with the created flag.
This is defined to make the BUILD.bazel file easier to read w/o the boilerplate of defining
a string_flag rule and n config_settings
https://docs.bazel.build/versions/main/skylark/macros.html
Args:
flag_name: string, the name of the flag to create and use for the config_settings
values: list of strings, the valid values for this flag to be set to.
default: string, whatever the default value should be if the flag is not set. Can be
empty string for both a string_flag and a multi_string flag.
multiple: boolean, True if the flag should be able to be set multiple times on the CLI.
name: string unused, https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#unnamed-macro
"""
if multiple:
multi_string_flag(
name = flag_name,
@ -67,3 +86,35 @@ def string_flag_with_values(flag_name, values, default = "", multiple = False):
":" + flag_name: v,
},
)
def bool_flag(flag_name, default = True, name = ""):
"""Create a boolean flag and corresponding config_settings.
bool_flag is a Bazel Macro that defines a boolean flag with the given name two config_settings,
one for True, one for False. Reminder that Bazel has special syntax for unsetting boolean flags,
but this does not work well with aliases.
https://docs.bazel.build/versions/main/skylark/config.html#using-build-settings-on-the-command-line
Thus it is best to define both an "enabled" alias and a "disabled" alias.
Args:
flag_name: string, the name of the flag to create and use for the config_settings
default: boolean, if the flag should default to on or off.
name: string unused, https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#unnamed-macro
"""
skylib_bool_flag(name = flag_name, build_setting_default = default)
native.config_setting(
name = flag_name + "_true",
flag_values = {
# The value must be a string, but it will be parsed to a boolean
# https://docs.bazel.build/versions/main/skylark/config.html#build-settings-and-select
":" + flag_name: "True",
},
)
native.config_setting(
name = flag_name + "_false",
flag_values = {
":" + flag_name: "False",
},
)

View File

@ -1,29 +1,45 @@
# select_multi works around a restriction in native select() that prevents multiple
# keys from being matched unless one is a strict subset of another. For some features,
# we allow multiple of that component to be active. For example, with codecs, we let
# the clients mix and match anywhere from 0 built in codecs to all of them.
#
# select_multi takes a given map and turns it into several distinct select statements
# that have the effect of using any values associated with any active keys.
# For example, if the following parameters are passed in:
# values_map = {
# ":alpha": ["apple", "apricot"],
# ":beta": ["banana"],
# ":gamma": ["grapefruit"],
# },
# default = []
# it will be unrolled into the following select statements
# [] + select({
# ":apple": ["apple", "apricot"],
# "//conditions:default": [],
# }) + select({
# ":beta": ["banana"],
# "//conditions:default": [],
# }) + select({
# ":gamma": ["grapefruit"],
# "//conditions:default": [],
# })
def select_multi(values_map, default):
"""
This file contains general helper macros that make our BUILD.bazel files easier to read.
"""
def select_multi(values_map, default, name = ""):
"""select() but allowing multiple matches of the keys.
select_multi works around a restriction in native select() that prevents multiple
keys from being matched unless one is a strict subset of another. For some features,
we allow multiple of that component to be active. For example, with codecs, we let
the clients mix and match anywhere from 0 built in codecs to all of them.
select_multi takes a given map and turns it into several distinct select statements
that have the effect of using any values associated with any active keys.
For example, if the following parameters are passed in:
values_map = {
":alpha": ["apple", "apricot"],
":beta": ["banana"],
":gamma": ["grapefruit"],
},
default = []
it will be unrolled into the following select statements
[] + select({
":apple": ["apple", "apricot"],
"//conditions:default": [],
}) + select({
":beta": ["banana"],
"//conditions:default": [],
}) + select({
":gamma": ["grapefruit"],
"//conditions:default": [],
})
Args:
values_map: dictionary of labels to a list of labels, just like select()
default: list of labels, the value that should be used if any of the options do not match.
This is typically an empty list
name: string unused, https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#unnamed-macro
Returns:
A list of values that is filled in by the generated select statements.
"""
if len(values_map) == 0:
return default
rv = []

View File

@ -1,5 +1,5 @@
load("@rules_cc//cc:defs.bzl", "cc_binary")
load("@emsdk//emscripten_toolchain:wasm_rules.bzl", "wasm_cc_binary")
load("//bazel/common_config_settings:defs.bzl", "bool_flag")
package(default_visibility = ["//:__subpackages__"])
@ -51,11 +51,6 @@ cc_binary(
"gm_bindings.cpp",
":hdrs",
"//gm:gms", # Required for the registry to work
"//src/ports:default_global_init",
"//src/ports:fontmgr",
"//src/ports:malloc",
"//src/ports:skdebug",
"//src/ports:skia_image_generator",
],
additional_linker_inputs = ["gm.js"],
linkopts = select({
@ -83,9 +78,24 @@ wasm_cc_binary(
cc_target = ":gm-bindings",
)
# See https://stackoverflow.com/a/57499321 for reference.
genrule(
name = "create_notomono_cpp",
srcs = ["fonts/NotoMono-Regular.ttf"],
outs = ["fonts/NotoMono-Regular.ttf.bazel.cpp"], # Distinct name from compile.sh's version
cmd = "$(location //tools:embed_resources) --name=SK_EMBEDDED_FONTS " +
"--input=modules/canvaskit/fonts/NotoMono-Regular.ttf " +
# The $@ means substitute in the one and only output location, which will be located
# in //bazel-out, not in the fonts subdirectory (although it will be available to clients
# in the fonts/ subdirectory as if it had been there all along.
"--output=$@ " +
"--align=4",
tools = ["//tools:embed_resources"],
)
CK_DEFINES = [
"SK_NO_FONTS", #TODO(kjlubick)
"SK_DISABLE_LEGACY_SHADERCONTEXT",
"SK_FORCE_8_BYTE_ALIGNMENT", # working around https://github.com/emscripten-core/emscripten/issues/10072
] + select({
"//bazel/common_config_settings:gl_backend": [
"SK_GL",
@ -94,10 +104,14 @@ CK_DEFINES = [
"//conditions:default": [
"SK_SUPPORT_GPU=0",
],
}) + select({
":enable_fonts_true": [],
":enable_fonts_false": ["SK_NO_FONTS"],
})
CK_OPTS = BASE_LINKOPTS + [
"-sEXPORT_NAME=CanvasKitInit",
"-sINITIAL_MEMORY=128MB",
# The order of these --pre-js flags matters! The preamble is a partially open scope and the
# postamble closes it.
"--pre-js",
@ -110,9 +124,6 @@ CK_OPTS = BASE_LINKOPTS + [
"modules/canvaskit/util.js",
"--pre-js",
"modules/canvaskit/interface.js",
"--pre-js",
"modules/canvaskit/postamble.js",
"-sINITIAL_MEMORY=128MB",
] + select({
"//bazel/common_config_settings:gl_backend": [
"--pre-js",
@ -125,27 +136,47 @@ CK_OPTS = BASE_LINKOPTS + [
"modules/canvaskit/cpu.js",
],
}) + select({
"//bazel/common_config_settings:debug_build": DEBUG_OPTS,
"//conditions:default": RELEASE_OPTS,
":enable_fonts_true": [
"--pre-js",
"modules/canvaskit/font.js",
],
":enable_fonts_false": [],
}) + [
"--pre-js",
"modules/canvaskit/postamble.js",
] + select({
"//bazel/common_config_settings:debug_build": DEBUG_OPTS + [
"--pre-js",
"modules/canvaskit/debug.js",
],
"//conditions:default": RELEASE_OPTS + [
"--pre-js",
"modules/canvaskit/release.js",
],
})
CK_SRCS = [
"canvaskit_bindings.cpp",
":hdrs",
] + select({
":include_embedded_font_true": ["fonts/NotoMono-Regular.ttf.bazel.cpp"],
":include_embedded_font_false": [],
})
cc_binary(
name = "canvaskit",
srcs = [
"canvaskit_bindings.cpp",
":hdrs",
"//src/ports:default_global_init",
"//src/ports:fontmgr",
"//src/ports:malloc",
"//src/ports:skdebug",
"//src/ports:skia_image_generator",
],
srcs = CK_SRCS,
additional_linker_inputs = [
"color.js",
"cpu.js",
"debug.js",
"font.js",
"gpu.js",
"interface.js",
"memory.js",
"postamble.js",
"preamble.js",
"release.js",
"util.js",
],
linkopts = CK_OPTS,
@ -162,3 +193,13 @@ wasm_cc_binary(
name = "canvaskit-wasm",
cc_target = ":canvaskit",
)
bool_flag(
default = True,
flag_name = "enable_fonts",
)
bool_flag(
default = True,
flag_name = "include_embedded_font",
)

View File

@ -151,10 +151,13 @@ bazel_gms_debug:
bazel_canvaskit_debug:
# See above note about spawn_strategy
# TODO(kjlubick): Can we use transitions to have defaults set?
# https://github.com/bazelbuild/examples/tree/main/rules/starlark_configurations/cc_binary_selectable_copts
bazelisk build :canvaskit-wasm --compilation_mode dbg --spawn_strategy=local \
--gpu_backend=gl_backend --with_gl_standard=webgl_standard \
--include_codec=jpeg_codec --include_codec=png_codec --include_codec=webp_codec \
--include_codec=gif_codec
--include_codec=gif_codec --include_fontmgr=custom_embedded_fontmgr \
--fontmgr_factory=custom_embedded_fontmgr_factory
- rm -rf build/
mkdir build
cp ../../bazel-bin/modules/canvaskit/canvaskit-wasm/canvaskit.js build/canvaskit.js

View File

@ -76,8 +76,10 @@
#include "include/core/SkFontMetrics.h"
#include "include/core/SkFontMgr.h"
#include "include/core/SkFontTypes.h"
#ifdef SK_INCLUDE_PARAGRAPH
#include "modules/skparagraph/include/Paragraph.h"
#endif
#endif // SK_INCLUDE_PARAGRAPH
#endif // SK_NO_FONTS
#ifdef SK_INCLUDE_PATHOPS
#include "include/pathops/SkPathOps.h"
@ -2149,7 +2151,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
constant("ShadowGeometricOnly", (int)SkShadowFlags::kGeometricOnly_ShadowFlag);
constant("ShadowDirectionalLight", (int)SkShadowFlags::kDirectionalLight_ShadowFlag);
#ifndef SK_NO_FONTS
#ifdef SK_INCLUDE_PARAGRAPH
constant("_GlyphRunFlags_isWhiteSpace", (int)skia::textlayout::Paragraph::kWhiteSpace_VisitorFlag);
#endif
}

View File

@ -75,14 +75,18 @@
TextOnPathAPI1(CanvasKit);
DrawGlyphsAPI1(CanvasKit);
SurfaceAPI1(CanvasKit);
CanvasAPI1(CanvasKit);
CanvasAPI2(CanvasKit);
CanvasAPI3(CanvasKit);
CanvasAPI4(CanvasKit);
CanvasAPI5(CanvasKit);
CanvasAPI6(CanvasKit);
CanvasAPI7(CanvasKit);
CanvasAPI8(CanvasKit);
if (CanvasKit.MakeCanvas){
CanvasAPI1(CanvasKit);
CanvasAPI2(CanvasKit);
CanvasAPI3(CanvasKit);
CanvasAPI4(CanvasKit);
CanvasAPI5(CanvasKit);
CanvasAPI6(CanvasKit);
CanvasAPI7(CanvasKit);
CanvasAPI8(CanvasKit);
} else {
console.log("Skipping CanvasAPI1 because it's not compiled in");
}
InteractivePatch(CanvasKit);
});

View File

@ -1,22 +1,86 @@
package(default_visibility = ["//:__subpackages__"])
# https://github.com/bazelbuild/bazel-skylib
load("@bazel_skylib//lib:selects.bzl", "selects")
load("//bazel:macros.bzl", "select_multi")
package(default_visibility = ["//visibility:private"])
filegroup(
name = "fontmgr",
srcs = select({
"//bazel/common_config_settings:empty_fontmgr_factory": [
name = "typeface_freetype",
srcs = [
"SkFontHost_FreeType.cpp",
"SkFontHost_FreeType_common.cpp",
"SkFontHost_FreeType_common.h",
],
)
filegroup(
name = "fontmgr_factory",
srcs = selects.with_or({
"//bazel/common_config_settings:custom_embedded_fontmgr_factory": [
"SkFontMgr_custom_embedded_factory.cpp",
],
("//bazel/common_config_settings:empty_fontmgr_factory", "//conditions:default"): [
"SkFontMgr_empty_factory.cpp",
],
"//bazel/common_config_settings:custom_directory_fontmgr_factory": [
"SkFontMgr_directory.h",
"SkFontMgr_custom_directory.cpp",
],
}),
)
filegroup(
name = "custom_directory_fontmgr_srcs",
srcs = [
"SkFontMgr_custom.cpp",
"SkFontMgr_custom.h",
"SkFontMgr_custom_directory.cpp",
":typeface_freetype",
],
)
filegroup(
name = "custom_embedded_fontmgr_srcs",
srcs = [
"SkFontMgr_custom.cpp",
"SkFontMgr_custom.h",
"SkFontMgr_custom_embedded.cpp",
":typeface_freetype",
],
)
filegroup(
name = "custom_empty_fontmgr_srcs",
srcs = [
"SkFontMgr_custom.cpp",
"SkFontMgr_custom.h",
"SkFontMgr_custom_empty.cpp",
":typeface_freetype",
],
)
filegroup(
name = "global_init",
srcs = [
"SkGlobalInitialization_default.cpp", # TODO(kjlubick) use select
],
)
filegroup(
name = "image_generator",
srcs = [
"SkImageGenerator_skia.cpp", # TODO(kjlubick) use select
],
)
filegroup(
name = "osfile",
srcs = ["SkOSFile_stdio.cpp"] + select({
"@platforms//os:windows": ["SkOSFile_win.cpp"],
"//conditions:default": ["SkOSFile_posix.cpp"],
}),
)
filegroup(
name = "malloc",
srcs = [
"SkMemory_malloc.cpp",
"SkMemory_malloc.cpp", # TODO(kjlubick) use select
],
)
@ -27,18 +91,32 @@ filegroup(
"@platforms//os:android": ["SkDebug_android.cpp"],
"//conditions:default": ["SkDebug_stdio.cpp"],
}),
visibility = ["//:__subpackages__"],
)
any_fontmgr = (
"//bazel/common_config_settings:custom_directory_fontmgr",
"//bazel/common_config_settings:custom_embedded_fontmgr",
"//bazel/common_config_settings:custom_empty_fontmgr",
)
filegroup(
name = "default_global_init",
name = "srcs",
srcs = [
"SkGlobalInitialization_default.cpp",
],
)
filegroup(
name = "skia_image_generator",
srcs = [
"SkImageGenerator_skia.cpp",
],
":fontmgr",
":fontmgr_factory",
":global_init",
":image_generator",
":malloc",
":osfile",
":skdebug",
] + select_multi(
{
"//bazel/common_config_settings:custom_directory_fontmgr": [":custom_directory_fontmgr_srcs"],
"//bazel/common_config_settings:custom_embedded_fontmgr": [":custom_embedded_fontmgr_srcs"],
"//bazel/common_config_settings:custom_empty_fontmgr": [":custom_empty_fontmgr_srcs"],
},
default = [],
),
visibility = ["//:__subpackages__"],
)

View File

@ -67,8 +67,8 @@ cc_library(
"externals/libpng/png.h",
],
copts = [
"-Ithird_party/libpng/",
"-Wno-unused-but-set-variable",
"-isystem third_party/libpng/",
#"-Wno-unused-but-set-variable",
],
includes = [
# This adds -isystem "third_party/externals/libpng" to any dependent
@ -777,7 +777,389 @@ cc_library(
],
strip_include_prefix = "externals/dng_sdk/source/",
deps = [
"libjpeg-turbo",
"zlib",
":libjpeg-turbo",
":zlib",
],
)
FREETYPE_DEFINES = ["FT2_BUILD_LIBRARY"] + select(
{
"//bazel/common_config_settings:cpu_wasm": [
# Use a trimmed down set of options to reduce code size.
"FT_CONFIG_MODULES_H=<include/freetype-no-type1/ftmodule.h>",
"FT_CONFIG_OPTIONS_H=<include/freetype-no-type1/ftoption.h>",
],
"//conditions:default": [
"FT_CONFIG_MODULES_H=<include/freetype-android/ftmodule.h>",
"FT_CONFIG_OPTIONS_H=<include/freetype-android/ftoption.h>",
],
},
)
cc_library(
name = "freetype2",
srcs = [
"externals/freetype/include/freetype/internal/autohint.h",
"externals/freetype/include/freetype/internal/cffotypes.h",
"externals/freetype/include/freetype/internal/cfftypes.h",
"externals/freetype/include/freetype/internal/compiler-macros.h",
"externals/freetype/include/freetype/internal/ftcalc.h",
"externals/freetype/include/freetype/internal/ftdebug.h",
"externals/freetype/include/freetype/internal/ftdrv.h",
"externals/freetype/include/freetype/internal/ftgloadr.h",
"externals/freetype/include/freetype/internal/fthash.h",
"externals/freetype/include/freetype/internal/ftmemory.h",
"externals/freetype/include/freetype/internal/ftobjs.h",
"externals/freetype/include/freetype/internal/ftpsprop.h",
"externals/freetype/include/freetype/internal/ftrfork.h",
"externals/freetype/include/freetype/internal/ftserv.h",
"externals/freetype/include/freetype/internal/ftstream.h",
"externals/freetype/include/freetype/internal/fttrace.h",
"externals/freetype/include/freetype/internal/ftvalid.h",
"externals/freetype/include/freetype/internal/psaux.h",
"externals/freetype/include/freetype/internal/pshints.h",
"externals/freetype/include/freetype/internal/services/svbdf.h",
"externals/freetype/include/freetype/internal/services/svcfftl.h",
"externals/freetype/include/freetype/internal/services/svcid.h",
"externals/freetype/include/freetype/internal/services/svfntfmt.h",
"externals/freetype/include/freetype/internal/services/svgldict.h",
"externals/freetype/include/freetype/internal/services/svgxval.h",
"externals/freetype/include/freetype/internal/services/svkern.h",
"externals/freetype/include/freetype/internal/services/svmetric.h",
"externals/freetype/include/freetype/internal/services/svmm.h",
"externals/freetype/include/freetype/internal/services/svotval.h",
"externals/freetype/include/freetype/internal/services/svpfr.h",
"externals/freetype/include/freetype/internal/services/svpostnm.h",
"externals/freetype/include/freetype/internal/services/svprop.h",
"externals/freetype/include/freetype/internal/services/svpscmap.h",
"externals/freetype/include/freetype/internal/services/svpsinfo.h",
"externals/freetype/include/freetype/internal/services/svsfnt.h",
"externals/freetype/include/freetype/internal/services/svttcmap.h",
"externals/freetype/include/freetype/internal/services/svtteng.h",
"externals/freetype/include/freetype/internal/services/svttglyf.h",
"externals/freetype/include/freetype/internal/services/svwinfnt.h",
"externals/freetype/include/freetype/internal/sfnt.h",
"externals/freetype/include/freetype/internal/t1types.h",
"externals/freetype/include/freetype/internal/tttypes.h",
"externals/freetype/include/freetype/internal/wofftypes.h",
"externals/freetype/include/freetype/t1tables.h",
"externals/freetype/include/freetype/ttnameid.h",
"externals/freetype/include/freetype/tttables.h",
"externals/freetype/include/freetype/tttags.h",
"externals/freetype/src/autofit/afblue.h",
"externals/freetype/src/autofit/afcjk.h",
"externals/freetype/src/autofit/afcover.h",
"externals/freetype/src/autofit/afdummy.h",
"externals/freetype/src/autofit/aferrors.h",
"externals/freetype/src/autofit/afglobal.h",
"externals/freetype/src/autofit/afhints.h",
"externals/freetype/src/autofit/afindic.h",
"externals/freetype/src/autofit/aflatin.h",
"externals/freetype/src/autofit/afloader.h",
"externals/freetype/src/autofit/afmodule.h",
"externals/freetype/src/autofit/afranges.h",
"externals/freetype/src/autofit/afscript.h",
"externals/freetype/src/autofit/afshaper.h",
"externals/freetype/src/autofit/afstyles.h",
"externals/freetype/src/autofit/aftypes.h",
"externals/freetype/src/autofit/afws-decl.h",
"externals/freetype/src/autofit/afws-iter.h",
"externals/freetype/src/autofit/autofit.c",
"externals/freetype/src/base/ftbase.c",
"externals/freetype/src/base/ftbase.h",
"externals/freetype/src/base/ftbbox.c",
"externals/freetype/src/base/ftbitmap.c",
"externals/freetype/src/base/ftdebug.c",
"externals/freetype/src/base/ftfstype.c",
"externals/freetype/src/base/ftgasp.c",
"externals/freetype/src/base/ftglyph.c",
"externals/freetype/src/base/ftinit.c",
"externals/freetype/src/base/ftmm.c",
"externals/freetype/src/base/ftpatent.c",
"externals/freetype/src/base/ftstroke.c",
"externals/freetype/src/base/ftsynth.c",
"externals/freetype/src/base/ftsystem.c",
"externals/freetype/src/base/fttype1.c",
"externals/freetype/src/base/ftwinfnt.c",
"externals/freetype/src/base/md5.h",
"externals/freetype/src/cff/cff.c",
"externals/freetype/src/cff/cffcmap.h",
"externals/freetype/src/cff/cffdrivr.h",
"externals/freetype/src/cff/cfferrs.h",
"externals/freetype/src/cff/cffgload.h",
"externals/freetype/src/cff/cffload.h",
"externals/freetype/src/cff/cffobjs.h",
"externals/freetype/src/cff/cffparse.h",
"externals/freetype/src/cff/cfftoken.h",
"externals/freetype/src/cid/ciderrs.h",
"externals/freetype/src/cid/cidgload.h",
"externals/freetype/src/cid/cidload.h",
"externals/freetype/src/cid/cidobjs.h",
"externals/freetype/src/cid/cidparse.h",
"externals/freetype/src/cid/cidriver.h",
"externals/freetype/src/cid/cidtoken.h",
"externals/freetype/src/cid/type1cid.c",
"externals/freetype/src/gzip/ftgzip.c",
"externals/freetype/src/gzip/ftzconf.h",
"externals/freetype/src/gzip/infblock.h",
"externals/freetype/src/gzip/infcodes.h",
"externals/freetype/src/gzip/inffixed.h",
"externals/freetype/src/gzip/inftrees.h",
"externals/freetype/src/gzip/infutil.h",
"externals/freetype/src/gzip/zlib.h",
"externals/freetype/src/gzip/zutil.h",
"externals/freetype/src/psaux/afmparse.h",
"externals/freetype/src/psaux/cffdecode.h",
"externals/freetype/src/psaux/psarrst.h",
"externals/freetype/src/psaux/psaux.c",
"externals/freetype/src/psaux/psauxerr.h",
"externals/freetype/src/psaux/psauxmod.h",
"externals/freetype/src/psaux/psblues.h",
"externals/freetype/src/psaux/psconv.h",
"externals/freetype/src/psaux/pserror.h",
"externals/freetype/src/psaux/psfixed.h",
"externals/freetype/src/psaux/psfont.h",
"externals/freetype/src/psaux/psft.h",
"externals/freetype/src/psaux/psglue.h",
"externals/freetype/src/psaux/pshints.h",
"externals/freetype/src/psaux/psintrp.h",
"externals/freetype/src/psaux/psobjs.h",
"externals/freetype/src/psaux/psread.h",
"externals/freetype/src/psaux/psstack.h",
"externals/freetype/src/psaux/pstypes.h",
"externals/freetype/src/psaux/t1cmap.h",
"externals/freetype/src/psaux/t1decode.h",
"externals/freetype/src/pshinter/pshalgo.h",
"externals/freetype/src/pshinter/pshglob.h",
"externals/freetype/src/pshinter/pshinter.c",
"externals/freetype/src/pshinter/pshmod.h",
"externals/freetype/src/pshinter/pshnterr.h",
"externals/freetype/src/pshinter/pshrec.h",
"externals/freetype/src/psnames/psmodule.h",
"externals/freetype/src/psnames/psnamerr.h",
"externals/freetype/src/psnames/psnames.c",
"externals/freetype/src/psnames/pstables.h",
"externals/freetype/src/raster/ftmisc.h",
"externals/freetype/src/raster/ftraster.h",
"externals/freetype/src/raster/ftrend1.h",
"externals/freetype/src/raster/raster.c",
"externals/freetype/src/raster/rasterrs.h",
"externals/freetype/src/sfnt/pngshim.h",
"externals/freetype/src/sfnt/sfdriver.h",
"externals/freetype/src/sfnt/sferrors.h",
"externals/freetype/src/sfnt/sfnt.c",
"externals/freetype/src/sfnt/sfobjs.h",
"externals/freetype/src/sfnt/sfwoff.h",
"externals/freetype/src/sfnt/sfwoff2.h",
"externals/freetype/src/sfnt/ttbdf.h",
"externals/freetype/src/sfnt/ttcmap.h",
"externals/freetype/src/sfnt/ttcmapc.h",
"externals/freetype/src/sfnt/ttcolr.h",
"externals/freetype/src/sfnt/ttcpal.h",
"externals/freetype/src/sfnt/ttkern.h",
"externals/freetype/src/sfnt/ttload.h",
"externals/freetype/src/sfnt/ttmtx.h",
"externals/freetype/src/sfnt/ttpost.h",
"externals/freetype/src/sfnt/ttsbit.h",
"externals/freetype/src/sfnt/woff2tags.h",
"externals/freetype/src/smooth/ftgrays.h",
"externals/freetype/src/smooth/ftsmerrs.h",
"externals/freetype/src/smooth/ftsmooth.h",
"externals/freetype/src/smooth/smooth.c",
"externals/freetype/src/truetype/truetype.c",
"externals/freetype/src/truetype/ttdriver.h",
"externals/freetype/src/truetype/tterrors.h",
"externals/freetype/src/truetype/ttgload.h",
"externals/freetype/src/truetype/ttgxvar.h",
"externals/freetype/src/truetype/ttinterp.h",
"externals/freetype/src/truetype/ttobjs.h",
"externals/freetype/src/truetype/ttpload.h",
"externals/freetype/src/truetype/ttsubpix.h",
"externals/freetype/src/type1/t1afm.h",
"externals/freetype/src/type1/t1driver.h",
"externals/freetype/src/type1/t1errors.h",
"externals/freetype/src/type1/t1gload.h",
"externals/freetype/src/type1/t1load.h",
"externals/freetype/src/type1/t1objs.h",
"externals/freetype/src/type1/t1parse.h",
"externals/freetype/src/type1/t1tokens.h",
"externals/freetype/src/type1/type1.c",
"freetype2/include/freetype-android/ftmodule.h",
"freetype2/include/freetype-android/ftoption.h",
"freetype2/include/freetype-no-type1/ftmodule.h",
"freetype2/include/freetype-no-type1/ftoption.h",
],
hdrs = [
"externals/freetype/include/freetype/config/ftconfig.h",
"externals/freetype/include/freetype/config/ftheader.h",
"externals/freetype/include/freetype/config/ftmodule.h",
"externals/freetype/include/freetype/config/ftoption.h",
"externals/freetype/include/freetype/config/ftstdlib.h",
"externals/freetype/include/freetype/config/integer-types.h",
"externals/freetype/include/freetype/config/mac-support.h",
"externals/freetype/include/freetype/config/public-macros.h",
"externals/freetype/include/freetype/freetype.h",
"externals/freetype/include/freetype/ftadvanc.h",
"externals/freetype/include/freetype/ftbbox.h",
"externals/freetype/include/freetype/ftbdf.h",
"externals/freetype/include/freetype/ftbitmap.h",
"externals/freetype/include/freetype/ftbzip2.h",
"externals/freetype/include/freetype/ftcache.h",
"externals/freetype/include/freetype/ftchapters.h",
"externals/freetype/include/freetype/ftcid.h",
"externals/freetype/include/freetype/ftcolor.h",
"externals/freetype/include/freetype/ftdriver.h",
"externals/freetype/include/freetype/fterrdef.h",
"externals/freetype/include/freetype/fterrors.h",
"externals/freetype/include/freetype/ftfntfmt.h",
"externals/freetype/include/freetype/ftgasp.h",
"externals/freetype/include/freetype/ftglyph.h",
"externals/freetype/include/freetype/ftgxval.h",
"externals/freetype/include/freetype/ftgzip.h",
"externals/freetype/include/freetype/ftimage.h",
"externals/freetype/include/freetype/ftincrem.h",
"externals/freetype/include/freetype/ftlcdfil.h",
"externals/freetype/include/freetype/ftlist.h",
"externals/freetype/include/freetype/ftlogging.h",
"externals/freetype/include/freetype/ftlzw.h",
"externals/freetype/include/freetype/ftmac.h",
"externals/freetype/include/freetype/ftmm.h",
"externals/freetype/include/freetype/ftmodapi.h",
"externals/freetype/include/freetype/ftmoderr.h",
"externals/freetype/include/freetype/ftotval.h",
"externals/freetype/include/freetype/ftoutln.h",
"externals/freetype/include/freetype/ftparams.h",
"externals/freetype/include/freetype/ftpfr.h",
"externals/freetype/include/freetype/ftrender.h",
"externals/freetype/include/freetype/ftsizes.h",
"externals/freetype/include/freetype/ftsnames.h",
"externals/freetype/include/freetype/ftstroke.h",
"externals/freetype/include/freetype/ftsynth.h",
"externals/freetype/include/freetype/ftsystem.h",
"externals/freetype/include/freetype/fttrigon.h",
"externals/freetype/include/freetype/fttypes.h",
"externals/freetype/include/freetype/ftwinfnt.h",
"externals/freetype/include/freetype/t1tables.h",
"externals/freetype/include/freetype/ttnameid.h",
"externals/freetype/include/freetype/tttables.h",
"externals/freetype/include/freetype/tttags.h",
"externals/freetype/include/ft2build.h",
],
copts = [
"-isystem third_party/externals/freetype/include",
"-isystem third_party/freetype2",
],
defines = [
# Make this define available to any client that has freetype2 as a dep.
"SK_FREETYPE_MINIMUM_RUNTIME_VERSION=(((FREETYPE_MAJOR)<<24)|((FREETYPE_MINOR)<<16)|((FREETYPE_PATCH)<<8))",
],
local_defines = FREETYPE_DEFINES,
strip_include_prefix = "externals/freetype/include/",
# Freetype includes a lot of .c files. We need to make those available for inclusion explicitly.
textual_hdrs = [
"externals/freetype/src/autofit/afblue.c",
"externals/freetype/src/autofit/afcjk.c",
"externals/freetype/src/autofit/afdummy.c",
"externals/freetype/src/autofit/afglobal.c",
"externals/freetype/src/autofit/afhints.c",
"externals/freetype/src/autofit/afindic.c",
"externals/freetype/src/autofit/aflatin.c",
"externals/freetype/src/autofit/afloader.c",
"externals/freetype/src/autofit/afmodule.c",
"externals/freetype/src/autofit/afranges.c",
"externals/freetype/src/autofit/afshaper.c",
"externals/freetype/src/base/ftadvanc.c",
"externals/freetype/src/base/ftbase.c",
"externals/freetype/src/base/ftcalc.c",
"externals/freetype/src/base/ftcolor.c",
"externals/freetype/src/base/ftdbgmem.c",
"externals/freetype/src/base/fterrors.c",
"externals/freetype/src/base/ftfntfmt.c",
"externals/freetype/src/base/ftgloadr.c",
"externals/freetype/src/base/fthash.c",
"externals/freetype/src/base/ftlcdfil.c",
"externals/freetype/src/base/ftmac.c",
"externals/freetype/src/base/ftobjs.c",
"externals/freetype/src/base/ftoutln.c",
"externals/freetype/src/base/ftpsprop.c",
"externals/freetype/src/base/ftrfork.c",
"externals/freetype/src/base/ftsnames.c",
"externals/freetype/src/base/ftstream.c",
"externals/freetype/src/base/fttrigon.c",
"externals/freetype/src/base/ftutil.c",
"externals/freetype/src/cff/cffcmap.c",
"externals/freetype/src/cff/cffdrivr.c",
"externals/freetype/src/cff/cffgload.c",
"externals/freetype/src/cff/cffload.c",
"externals/freetype/src/cff/cffobjs.c",
"externals/freetype/src/cff/cffparse.c",
"externals/freetype/src/cid/cidgload.c",
"externals/freetype/src/cid/cidload.c",
"externals/freetype/src/cid/cidobjs.c",
"externals/freetype/src/cid/cidparse.c",
"externals/freetype/src/cid/cidriver.c",
"externals/freetype/src/gzip/adler32.c",
"externals/freetype/src/gzip/infblock.c",
"externals/freetype/src/gzip/infcodes.c",
"externals/freetype/src/gzip/inflate.c",
"externals/freetype/src/gzip/inftrees.c",
"externals/freetype/src/gzip/infutil.c",
"externals/freetype/src/gzip/zutil.c",
"externals/freetype/src/psaux/afmparse.c",
"externals/freetype/src/psaux/cffdecode.c",
"externals/freetype/src/psaux/psarrst.c",
"externals/freetype/src/psaux/psauxmod.c",
"externals/freetype/src/psaux/psblues.c",
"externals/freetype/src/psaux/psconv.c",
"externals/freetype/src/psaux/pserror.c",
"externals/freetype/src/psaux/psfont.c",
"externals/freetype/src/psaux/psft.c",
"externals/freetype/src/psaux/pshints.c",
"externals/freetype/src/psaux/psintrp.c",
"externals/freetype/src/psaux/psobjs.c",
"externals/freetype/src/psaux/psread.c",
"externals/freetype/src/psaux/psstack.c",
"externals/freetype/src/psaux/t1cmap.c",
"externals/freetype/src/psaux/t1decode.c",
"externals/freetype/src/pshinter/pshalgo.c",
"externals/freetype/src/pshinter/pshglob.c",
"externals/freetype/src/pshinter/pshmod.c",
"externals/freetype/src/pshinter/pshrec.c",
"externals/freetype/src/psnames/psmodule.c",
"externals/freetype/src/raster/ftraster.c",
"externals/freetype/src/raster/ftrend1.c",
"externals/freetype/src/sfnt/pngshim.c",
"externals/freetype/src/sfnt/sfdriver.c",
"externals/freetype/src/sfnt/sfobjs.c",
"externals/freetype/src/sfnt/sfwoff.c",
"externals/freetype/src/sfnt/sfwoff2.c",
"externals/freetype/src/sfnt/ttbdf.c",
"externals/freetype/src/sfnt/ttcmap.c",
"externals/freetype/src/sfnt/ttcolr.c",
"externals/freetype/src/sfnt/ttcpal.c",
"externals/freetype/src/sfnt/ttkern.c",
"externals/freetype/src/sfnt/ttload.c",
"externals/freetype/src/sfnt/ttmtx.c",
"externals/freetype/src/sfnt/ttpost.c",
"externals/freetype/src/sfnt/ttsbit.c",
"externals/freetype/src/sfnt/woff2tags.c",
"externals/freetype/src/smooth/ftgrays.c",
"externals/freetype/src/smooth/ftsmooth.c",
"externals/freetype/src/truetype/ttdriver.c",
"externals/freetype/src/truetype/ttgload.c",
"externals/freetype/src/truetype/ttgxvar.c",
"externals/freetype/src/truetype/ttinterp.c",
"externals/freetype/src/truetype/ttobjs.c",
"externals/freetype/src/truetype/ttpload.c",
"externals/freetype/src/truetype/ttsubpix.c",
"externals/freetype/src/type1/t1afm.c",
"externals/freetype/src/type1/t1driver.c",
"externals/freetype/src/type1/t1gload.c",
"externals/freetype/src/type1/t1load.c",
"externals/freetype/src/type1/t1objs.c",
"externals/freetype/src/type1/t1parse.c",
],
deps = [
":libpng", # TODO(kjlubick) add brotli option
],
)

View File

@ -1,3 +1,5 @@
load("@rules_python//python:defs.bzl", "py_binary")
package(default_visibility = ["//:__subpackages__"])
filegroup(
@ -59,3 +61,8 @@ filegroup(
"HashAndEncode.h",
],
)
py_binary(
name = "embed_resources",
srcs = ["embed_resources.py"],
)