ref: 9443a1bc3e6cfa315db976ff80f6c5e91b12b387
parent: 76c64f6ba1eb66cb983f38e03f39e179ceb74487
author: Nikhil Ramakrishnan <ramakrishnan.nikhil@gmail.com>
date: Thu Jun 27 21:01:17 EDT 2019
Add Brotli dependency and required checks. Brotli is required for decompressing WOFF2 font directory streams. The library is thus being added as an optional dependency for FreeType. * builds/unix/configure.raw: Add checks for `libbrotlidec'. (REQUIRES_PRIVATE, LIBS_PRIVATE, LIBSSTATIC_CONFIG): Updated. * devel/ftoption.h, include/freetype/config/ftoption.h (FT_CONFIG_OPTION_USE_BROTLI): New macro.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2019-08-27 Nikhil Ramakrishnan <ramakrishnan.nikhil@gmail.com>
+ Add Brotli dependency and required checks.
+
+ Brotli is required for decompressing WOFF2 font directory streams.
+ The library is thus being added as an optional dependency for
+ FreeType.
+
+ * builds/unix/configure.raw: Add checks for `libbrotlidec'.
+ (REQUIRES_PRIVATE, LIBS_PRIVATE, LIBSSTATIC_CONFIG): Updated.
+
+ * devel/ftoption.h, include/freetype/config/ftoption.h
+ (FT_CONFIG_OPTION_USE_BROTLI): New macro.
+
+2019-08-27 Nikhil Ramakrishnan <ramakrishnan.nikhil@gmail.com>
+
[woff2] Write SFNT Offset table.
* src/sfnt/sfwoff2.c (WRITE_USHORT, WRITE_ULONG): New macros.
@@ -234,7 +248,7 @@
* include/freetype/ftmodapi.h (FT_DebugHook_Func): Return error.
Fix a warning by adding a return value as in `TT_RunIns',
- which should not be a compatibility issue.
+ which should not be a compatibility issue.
2019-06-11 Alexei Podtelezhnikov <apodtele@gmail.com>
@@ -245,7 +259,7 @@
[gzip] Add support for `gzip' encoded header.
* src/gzip/ftgzip.c (FT_Gzip_Uncompress): Modify the the call to
- `inflateInit2' to enable support for `gzip' encoded headers.
+ `inflateInit2' to enable support for `gzip' encoded headers.
2019-06-10 Alexei Podtelezhnikov <apodtele@gmail.com>
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -543,6 +543,50 @@
fi
+# check for system libbrotlidec
+
+AC_ARG_WITH([libbrotlidec],
+ [AS_HELP_STRING([--with-brotli=@<:@yes|no|auto@:>@],
+ [Support decompression of WOFF2 streams @<:@default=auto@:>@])],
+ [], [with_brotli=auto])
+
+have_brotli=no
+if test x"$with_brotli" = xyes -o x"$with_brotli" = xauto; then
+ brotli_pkg="libbrotlidec"
+ have_brotli_pkg=no
+
+ if test x"$BROTLI_CFLAGS" = x -a x"$BROTLI_LIBS" = x; then
+ PKG_CHECK_EXISTS([$brotli_pkg], [have_brotli_pkg=yes])
+ fi
+ PKG_CHECK_MODULES([BROTLI], [$brotli_pkg],
+ [have_brotli="yes (pkg-config)"], [:])
+
+ if test $have_brotli_pkg = yes; then
+ # we have libbrotlidec.pc
+ brotli_reqpriv="$brotli_pkg"
+ brotli_libspriv=
+ brotli_libsstaticconf=`$PKG_CONFIG --static --libs "$brotli_pkg"`
+ else
+ brotli_reqpriv=
+
+ if test "$have_brotli" != no; then
+ # BROTLI_CFLAGS and BROTLI_LIBS are set by the user
+ brotli_libspriv="$BROTLI_LIBS"
+ brotli_libsstaticconf="$BROTLI_LIBS"
+ have_brotli="yes (BROTLI_CFLAGS and BROTLI_LIBS)"
+ else
+ # since Brotli is quite a new library we don't fall back to a
+ # different test;
+ :
+ fi
+ fi
+fi
+
+if test x"$with_brotli" = xyes -a "$have_brotli" = no; then
+ AC_MSG_ERROR([brotli support requested but library not found])
+fi
+
+
# check for librt
#
# We need `clock_gettime' for the `ftbench' demo program.
@@ -992,7 +1036,8 @@
REQUIRES_PRIVATE="$zlib_reqpriv, \
$bzip2_reqpriv, \
$libpng_reqpriv, \
- $harfbuzz_reqpriv"
+ $harfbuzz_reqpriv, \
+ $brotli_reqpriv"
# beautify
REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \
| sed -e 's/^ *//' \
@@ -1007,6 +1052,7 @@
$bzip2_libspriv \
$libpng_libspriv \
$harfbuzz_libspriv \
+ $brotli_libspriv \
$ft2_extra_libs"
# beautify
LIBS_PRIVATE=`echo "$LIBS_PRIVATE" \
@@ -1019,6 +1065,7 @@
$bzip2_libsstaticconf \
$libpng_libsstaticconf \
$harfbuzz_libsstaticconf \
+ $brotli_libsstaticconf \
$ft2_extra_libs"
# remove -L/usr/lib and -L/usr/lib64 since `freetype-config' adds them later
# on if necessary; also beautify
@@ -1083,6 +1130,13 @@
else
ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ
fi
+if test "$have_brotli" != no; then
+ CFLAGS="$CFLAGS $BROTLI_CFLAGS"
+ LDFLAGS="$LDFLAGS $BROTLI_LIBS"
+ ftoption_set FT_CONFIG_OPTION_USE_BROTLI
+else
+ ftoption_unset FT_CONFIG_OPTION_USE_BROTLI
+fi
AC_SUBST([CFLAGS])
AC_SUBST([LDFLAGS])
@@ -1129,6 +1183,7 @@
bzip2: $have_bzip2
libpng: $have_libpng
harfbuzz: $have_harfbuzz
+ brotli: $have_brotli
])
# Warn if docwriter is not installed
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -294,6 +294,22 @@
/**************************************************************************
*
+ * Brotli support.
+ *
+ * FreeType uses the Brotli library to provide support for decompressing
+ * WOFF2 streams.
+ *
+ * Define this macro if you want to enable this 'feature'.
+ *
+ * If you use a build system like cmake or the `configure` script,
+ * options set by those programs have precedence, overwriting the value
+ * here with the configured one.
+ */
+#define FT_CONFIG_OPTION_USE_BROTLI
+
+
+ /**************************************************************************
+ *
* Glyph Postscript Names handling
*
* By default, FreeType 2 is compiled with the 'psnames' module. This
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -294,6 +294,22 @@
/**************************************************************************
*
+ * Brotli support.
+ *
+ * FreeType uses the Brotli library to provide support for decompressing
+ * WOFF2 streams.
+ *
+ * Define this macro if you want to enable this 'feature'.
+ *
+ * If you use a build system like cmake or the `configure` script,
+ * options set by those programs have precedence, overwriting the value
+ * here with the configured one.
+ */
+#define FT_CONFIG_OPTION_USE_BROTLI
+
+
+ /**************************************************************************
+ *
* Glyph Postscript Names handling
*
* By default, FreeType 2 is compiled with the 'psnames' module. This