blob: 8fcc46e4264e4f51cf434d45784dc7adab9f0c20 [file] [log] [blame]
# This file will be copied into //third_party/externals/freetype via the new_local_repository
# rule in WORKSPACE.bazel, so all files should be relative to that path.
# We define this here because the emscripten toolchain calls the cpu wasm, whereas the
# bazelbuild/platforms call it wasm32. https://github.com/emscripten-core/emsdk/issues/919
config_setting(
name = "cpu_wasm",
values = {
"cpu": "wasm",
},
)
FREETYPE_PUBLIC_DEFINES = [
"FT_CONFIG_OPTION_SVG",
# FT_CONFIG_OPTION_USE_BROTLI TODO(kjlubick)
"SK_FREETYPE_MINIMUM_RUNTIME_VERSION=(((FREETYPE_MAJOR)<<24)|((FREETYPE_MINOR)<<16)|((FREETYPE_PATCH)<<8))",
] + select(
{
":cpu_wasm": [
# Use a trimmed down set of options to reduce code size.
"FT_CONFIG_MODULES_H=<skia/no-type1/ftmodule.h>",
"FT_CONFIG_OPTIONS_H=<skia/no-type1/ftoption.h>",
],
"//conditions:default": [
"FT_CONFIG_MODULES_H=<skia/android/ftmodule.h>",
"FT_CONFIG_OPTIONS_H=<skia/android/ftoption.h>",
],
},
)
FREETYPE_LOCAL_DEFINES = ["FT2_BUILD_LIBRARY"]
# Copy our freetype include files from the config subfolder so they can be more
# easily accessed by how we set FT_CONFIG_MODULES_H. Because these files don't exist in
# the original Freetype checkout, we have to put them in a separate workspace (we cannot
# refer to them from the Skia workspace or that would be a circular dependency).
genrule(
name = "copy_android_freetype_config",
srcs = [
"@freetype_config//:android/ftmodule.h",
"@freetype_config//:android/ftoption.h",
],
outs = [
"builds/skia/android/ftmodule.h",
"builds/skia/android/ftoption.h",
],
# SRCS is a space seperated list of files.
# RULEDIR is the directory containing this BUILD.bazel file (the root of the freetype directory)
# but only in the "genfiles tree", which does not persist after compilation.
cmd = "cp $(SRCS) $(RULEDIR)/builds/skia/android/",
)
# It is easiest to have multiple copy rules, one per output directory.
genrule(
name = "copy_no_type1_freetype_config",
srcs = [
"@freetype_config//:no-type1/ftmodule.h",
"@freetype_config//:no-type1/ftoption.h",
],
outs = [
"builds/skia/no-type1/ftmodule.h",
"builds/skia/no-type1/ftoption.h",
],
# SRCS is a space seperated list of files.
# RULEDIR is the directory containing this BUILD.bazel file (the root of the freetype directory)
# but only in the "genfiles tree", which does not persist after compilation.
cmd = "cp $(SRCS) $(RULEDIR)/builds/skia/no-type1/",
)
cc_library(
name = "freetype",
srcs = [
"include/freetype/internal/autohint.h",
"include/freetype/internal/cffotypes.h",
"include/freetype/internal/cfftypes.h",
"include/freetype/internal/compiler-macros.h",
"include/freetype/internal/ftcalc.h",
"include/freetype/internal/ftdebug.h",
"include/freetype/internal/ftdrv.h",
"include/freetype/internal/ftgloadr.h",
"include/freetype/internal/fthash.h",
"include/freetype/internal/ftmemory.h",
"include/freetype/internal/ftmmtypes.h",
"include/freetype/internal/ftobjs.h",
"include/freetype/internal/ftpsprop.h",
"include/freetype/internal/ftrfork.h",
"include/freetype/internal/ftserv.h",
"include/freetype/internal/ftstream.h",
"include/freetype/internal/fttrace.h",
"include/freetype/internal/ftvalid.h",
"include/freetype/internal/psaux.h",
"include/freetype/internal/pshints.h",
"include/freetype/internal/services/svbdf.h",
"include/freetype/internal/services/svcfftl.h",
"include/freetype/internal/services/svcid.h",
"include/freetype/internal/services/svfntfmt.h",
"include/freetype/internal/services/svgldict.h",
"include/freetype/internal/services/svgxval.h",
"include/freetype/internal/services/svkern.h",
"include/freetype/internal/services/svmetric.h",
"include/freetype/internal/services/svmm.h",
"include/freetype/internal/services/svotval.h",
"include/freetype/internal/services/svpfr.h",
"include/freetype/internal/services/svpostnm.h",
"include/freetype/internal/services/svprop.h",
"include/freetype/internal/services/svpscmap.h",
"include/freetype/internal/services/svpsinfo.h",
"include/freetype/internal/services/svsfnt.h",
"include/freetype/internal/services/svttcmap.h",
"include/freetype/internal/services/svtteng.h",
"include/freetype/internal/services/svttglyf.h",
"include/freetype/internal/services/svwinfnt.h",
"include/freetype/internal/sfnt.h",
"include/freetype/internal/svginterface.h",
"include/freetype/internal/t1types.h",
"include/freetype/internal/tttypes.h",
"include/freetype/internal/wofftypes.h",
"include/freetype/otsvg.h",
"include/freetype/t1tables.h",
"include/freetype/ttnameid.h",
"include/freetype/tttables.h",
"include/freetype/tttags.h",
"src/autofit/afblue.h",
"src/autofit/afcjk.h",
"src/autofit/afcover.h",
"src/autofit/afdummy.h",
"src/autofit/aferrors.h",
"src/autofit/afglobal.h",
"src/autofit/afhints.h",
"src/autofit/afindic.h",
"src/autofit/aflatin.h",
"src/autofit/afloader.h",
"src/autofit/afmodule.h",
"src/autofit/afranges.h",
"src/autofit/afscript.h",
"src/autofit/afshaper.h",
"src/autofit/afstyles.h",
"src/autofit/aftypes.h",
"src/autofit/afws-decl.h",
"src/autofit/afws-iter.h",
"src/autofit/autofit.c",
"src/base/ftbase.c",
"src/base/ftbase.h",
"src/base/ftbbox.c",
"src/base/ftbitmap.c",
"src/base/ftdebug.c",
"src/base/ftfstype.c",
"src/base/ftgasp.c",
"src/base/ftglyph.c",
"src/base/ftinit.c",
"src/base/ftmm.c",
"src/base/ftpatent.c",
"src/base/ftstroke.c",
"src/base/ftsynth.c",
"src/base/ftsystem.c",
"src/base/fttype1.c",
"src/base/ftwinfnt.c",
"src/base/md5.h",
"src/cff/cff.c",
"src/cff/cffcmap.h",
"src/cff/cffdrivr.h",
"src/cff/cfferrs.h",
"src/cff/cffgload.h",
"src/cff/cffload.h",
"src/cff/cffobjs.h",
"src/cff/cffparse.h",
"src/cff/cfftoken.h",
"src/cid/ciderrs.h",
"src/cid/cidgload.h",
"src/cid/cidload.h",
"src/cid/cidobjs.h",
"src/cid/cidparse.h",
"src/cid/cidriver.h",
"src/cid/cidtoken.h",
"src/cid/type1cid.c",
"src/gzip/crc32.h",
"src/gzip/ftgzip.c",
"src/gzip/ftzconf.h",
"src/gzip/inffast.h",
"src/gzip/inffixed.h",
"src/gzip/inflate.h",
"src/gzip/inftrees.h",
"src/gzip/zlib.h",
"src/gzip/zutil.h",
"src/psaux/afmparse.h",
"src/psaux/cffdecode.h",
"src/psaux/psarrst.h",
"src/psaux/psaux.c",
"src/psaux/psauxerr.h",
"src/psaux/psauxmod.h",
"src/psaux/psblues.h",
"src/psaux/psconv.h",
"src/psaux/pserror.h",
"src/psaux/psfixed.h",
"src/psaux/psfont.h",
"src/psaux/psft.h",
"src/psaux/psglue.h",
"src/psaux/pshints.h",
"src/psaux/psintrp.h",
"src/psaux/psobjs.h",
"src/psaux/psread.h",
"src/psaux/psstack.h",
"src/psaux/pstypes.h",
"src/psaux/t1cmap.h",
"src/psaux/t1decode.h",
"src/pshinter/pshalgo.h",
"src/pshinter/pshglob.h",
"src/pshinter/pshinter.c",
"src/pshinter/pshmod.h",
"src/pshinter/pshnterr.h",
"src/pshinter/pshrec.h",
"src/psnames/psmodule.h",
"src/psnames/psnamerr.h",
"src/psnames/psnames.c",
"src/psnames/pstables.h",
"src/raster/ftmisc.h",
"src/raster/ftraster.h",
"src/raster/ftrend1.h",
"src/raster/raster.c",
"src/raster/rasterrs.h",
"src/sfnt/pngshim.h",
"src/sfnt/sfdriver.h",
"src/sfnt/sferrors.h",
"src/sfnt/sfnt.c",
"src/sfnt/sfobjs.h",
"src/sfnt/sfwoff.h",
"src/sfnt/sfwoff2.h",
"src/sfnt/ttbdf.h",
"src/sfnt/ttcmap.h",
"src/sfnt/ttcmapc.h",
"src/sfnt/ttcolr.h",
"src/sfnt/ttcpal.h",
"src/sfnt/ttkern.h",
"src/sfnt/ttload.h",
"src/sfnt/ttmtx.h",
"src/sfnt/ttpost.h",
"src/sfnt/ttsbit.h",
"src/sfnt/woff2tags.h",
"src/smooth/ftgrays.h",
"src/smooth/ftsmerrs.h",
"src/smooth/ftsmooth.h",
"src/smooth/smooth.c",
"src/svg/ftsvg.h",
"src/svg/svg.c",
"src/svg/svgtypes.h",
"src/truetype/truetype.c",
"src/truetype/ttdriver.h",
"src/truetype/tterrors.h",
"src/truetype/ttgload.h",
"src/truetype/ttgxvar.h",
"src/truetype/ttinterp.h",
"src/truetype/ttobjs.h",
"src/truetype/ttpload.h",
"src/truetype/ttsubpix.h",
"src/type1/t1afm.h",
"src/type1/t1driver.h",
"src/type1/t1errors.h",
"src/type1/t1gload.h",
"src/type1/t1load.h",
"src/type1/t1objs.h",
"src/type1/t1parse.h",
"src/type1/t1tokens.h",
"src/type1/type1.c",
],
hdrs = [
"include/freetype/config/ftconfig.h",
"include/freetype/config/ftheader.h",
"include/freetype/config/ftmodule.h",
"include/freetype/config/ftoption.h",
"include/freetype/config/ftstdlib.h",
"include/freetype/config/integer-types.h",
"include/freetype/config/mac-support.h",
"include/freetype/config/public-macros.h",
"include/freetype/freetype.h",
"include/freetype/ftadvanc.h",
"include/freetype/ftbbox.h",
"include/freetype/ftbdf.h",
"include/freetype/ftbitmap.h",
"include/freetype/ftbzip2.h",
"include/freetype/ftcache.h",
"include/freetype/ftchapters.h",
"include/freetype/ftcid.h",
"include/freetype/ftcolor.h",
"include/freetype/ftdriver.h",
"include/freetype/fterrdef.h",
"include/freetype/fterrors.h",
"include/freetype/ftfntfmt.h",
"include/freetype/ftgasp.h",
"include/freetype/ftglyph.h",
"include/freetype/ftgxval.h",
"include/freetype/ftgzip.h",
"include/freetype/ftimage.h",
"include/freetype/ftincrem.h",
"include/freetype/ftlcdfil.h",
"include/freetype/ftlist.h",
"include/freetype/ftlogging.h",
"include/freetype/ftlzw.h",
"include/freetype/ftmac.h",
"include/freetype/ftmm.h",
"include/freetype/ftmodapi.h",
"include/freetype/ftmoderr.h",
"include/freetype/ftotval.h",
"include/freetype/ftoutln.h",
"include/freetype/ftparams.h",
"include/freetype/ftpfr.h",
"include/freetype/ftrender.h",
"include/freetype/ftsizes.h",
"include/freetype/ftsnames.h",
"include/freetype/ftstroke.h",
"include/freetype/ftsynth.h",
"include/freetype/ftsystem.h",
"include/freetype/fttrigon.h",
"include/freetype/fttypes.h",
"include/freetype/ftwinfnt.h",
"include/freetype/otsvg.h",
"include/freetype/t1tables.h",
"include/freetype/ttnameid.h",
"include/freetype/tttables.h",
"include/freetype/tttags.h",
"include/ft2build.h",
# These are copied in by some genrules
"builds/skia/android/ftmodule.h",
"builds/skia/android/ftoption.h",
"builds/skia/no-type1/ftmodule.h",
"builds/skia/no-type1/ftoption.h",
],
copts = [
"-Wno-unused-function",
],
defines = FREETYPE_PUBLIC_DEFINES,
includes = [
"builds",
"include",
],
local_defines = FREETYPE_LOCAL_DEFINES,
# Freetype includes a lot of .c files. We need to make those available for inclusion explicitly.
textual_hdrs = [
"src/autofit/afblue.c",
"src/autofit/afcjk.c",
"src/autofit/afdummy.c",
"src/autofit/afglobal.c",
"src/autofit/afhints.c",
"src/autofit/afindic.c",
"src/autofit/aflatin.c",
"src/autofit/afloader.c",
"src/autofit/afmodule.c",
"src/autofit/afranges.c",
"src/autofit/afshaper.c",
"src/base/ftadvanc.c",
"src/base/ftbase.c",
"src/base/ftcalc.c",
"src/base/ftcolor.c",
"src/base/ftdbgmem.c",
"src/base/fterrors.c",
"src/base/ftfntfmt.c",
"src/base/ftgloadr.c",
"src/base/fthash.c",
"src/base/ftlcdfil.c",
"src/base/ftmac.c",
"src/base/ftobjs.c",
"src/base/ftoutln.c",
"src/base/ftpsprop.c",
"src/base/ftrfork.c",
"src/base/ftsnames.c",
"src/base/ftstream.c",
"src/base/fttrigon.c",
"src/base/ftutil.c",
"src/cff/cffcmap.c",
"src/cff/cffdrivr.c",
"src/cff/cffgload.c",
"src/cff/cffload.c",
"src/cff/cffobjs.c",
"src/cff/cffparse.c",
"src/cid/cidgload.c",
"src/cid/cidload.c",
"src/cid/cidobjs.c",
"src/cid/cidparse.c",
"src/cid/cidriver.c",
"src/gzip/adler32.c",
"src/gzip/crc32.c",
"src/gzip/inffast.c",
"src/gzip/inflate.c",
"src/gzip/inftrees.c",
"src/gzip/zutil.c",
"src/psaux/afmparse.c",
"src/psaux/cffdecode.c",
"src/psaux/psarrst.c",
"src/psaux/psauxmod.c",
"src/psaux/psblues.c",
"src/psaux/psconv.c",
"src/psaux/pserror.c",
"src/psaux/psfont.c",
"src/psaux/psft.c",
"src/psaux/pshints.c",
"src/psaux/psintrp.c",
"src/psaux/psobjs.c",
"src/psaux/psread.c",
"src/psaux/psstack.c",
"src/psaux/t1cmap.c",
"src/psaux/t1decode.c",
"src/pshinter/pshalgo.c",
"src/pshinter/pshglob.c",
"src/pshinter/pshmod.c",
"src/pshinter/pshrec.c",
"src/psnames/psmodule.c",
"src/raster/ftraster.c",
"src/raster/ftrend1.c",
"src/sfnt/pngshim.c",
"src/sfnt/sfdriver.c",
"src/sfnt/sfobjs.c",
"src/sfnt/sfwoff.c",
"src/sfnt/sfwoff2.c",
"src/sfnt/ttbdf.c",
"src/sfnt/ttcmap.c",
"src/sfnt/ttcolr.c",
"src/sfnt/ttcpal.c",
"src/sfnt/ttkern.c",
"src/sfnt/ttload.c",
"src/sfnt/ttmtx.c",
"src/sfnt/ttpost.c",
"src/sfnt/ttsbit.c",
"src/sfnt/ttsvg.c",
"src/sfnt/ttsvg.h",
"src/sfnt/woff2tags.c",
"src/smooth/ftgrays.c",
"src/smooth/ftsmooth.c",
"src/svg/ftsvg.c",
"src/truetype/ttdriver.c",
"src/truetype/ttgload.c",
"src/truetype/ttgxvar.c",
"src/truetype/ttinterp.c",
"src/truetype/ttobjs.c",
"src/truetype/ttpload.c",
"src/truetype/ttsubpix.c",
"src/type1/t1afm.c",
"src/type1/t1driver.c",
"src/type1/t1gload.c",
"src/type1/t1load.c",
"src/type1/t1objs.c",
"src/type1/t1parse.c",
],
visibility = ["//visibility:public"],
deps = [
"@libpng", # TODO(kjlubick) add brotli option
],
)