summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikhil Ramakrishnan <ramakrishnan.nikhil@gmail.com>2019-06-28 01:01:17 +0530
committerNikhil Ramakrishnan <ramakrishnan.nikhil@gmail.com>2019-06-28 01:01:17 +0530
commit8e05ab3e2ebf9d90b6015cb2aa7e789517b293e6 (patch)
treefb251e120dc0307a8a37a94e53b606fcefd72eb8
parent47f009d70388ade030ca4f8101ccbfc89ebb95f5 (diff)
downloadfreetype2-8e05ab3e2ebf9d90b6015cb2aa7e789517b293e6.tar.gz
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'. * devel/ftoption.h, include/freetype/config/ftoption.h (FT_CONFIG_OPTION_USE_BROTLI): New macro.
-rw-r--r--builds/unix/configure.raw57
-rw-r--r--devel/ftoption.h16
-rw-r--r--include/freetype/config/ftoption.h16
3 files changed, 88 insertions, 1 deletions
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index acefa119a..292e66031 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 16cf4e126..ef8d5e56f 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 12f47a82e..c3fd181ff 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