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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
diff --git a/ChangeLog b/ChangeLog
index 4b64ce0..434bb0b 100644
--- 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>
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index a1a6dbe..a242353 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -543,6 +543,50 @@ if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no; then
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 @@ fi
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 @@ LIBS_PRIVATE="$zlib_libspriv \
$bzip2_libspriv \
$libpng_libspriv \
$harfbuzz_libspriv \
+ $brotli_libspriv \
$ft2_extra_libs"
# beautify
LIBS_PRIVATE=`echo "$LIBS_PRIVATE" \
@@ -1019,6 +1065,7 @@ LIBSSTATIC_CONFIG="-lfreetype \
$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 @@ if test "$have_harfbuzz" != no; then
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 @@ Library configuration:
bzip2: $have_bzip2
libpng: $have_libpng
harfbuzz: $have_harfbuzz
+ brotli: $have_brotli
])
# Warn if docwriter is not installed
diff --git a/devel/ftoption.h b/devel/ftoption.h
index 16cf4e1..ef8d5e5 100644
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -294,6 +294,22 @@ FT_BEGIN_HEADER
/**************************************************************************
*
+ * 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
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 12f47a8..c3fd181 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -294,6 +294,22 @@ FT_BEGIN_HEADER
/**************************************************************************
*
+ * 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