summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoazin Khatti <moazinkhatri@gmail.com>2019-07-21 20:20:10 +0500
committerMoazin Khatti <moazinkhatri@gmail.com>2019-08-26 01:17:14 +0500
commitf86fe242d42f46de4bb0cb842b475c01ba5fdd62 (patch)
tree7315fc3e3a613fec5513c737389a4d13d39388c4
parent4025f1213eee11b55aef18713901ed62acf131c0 (diff)
downloadfreetype2-f86fe242d42f46de4bb0cb842b475c01ba5fdd62.tar.gz
Improve `--with-svg' in the build system.
Added a `no-default' option that compiles SVG support but keeps no default rendering port. Thus, the client application must inject its own hooks. * builds/unix/configure.raw: Changes in the build system to support `no-default'. * builds/unix/unix-cc.in: Add `COMPILE_SVG_PORT' var to ultimately let the `rules.mk' in `svg' folder know whether to build the port files or not. * include/freetype/config/ftoption.h: Change the flag `FT_CONFIG_OPTION_SVG_DEFAULT' to `*_DEFAULT_SVG' as `sed' and `ftoption_set' has a problem with the older version. * src/svg/ftsvg.c: Ditto. * src/svg/rules.mk: Compile the port only if `COMPILE_SVG_PORT' is set.
-rw-r--r--builds/unix/configure.raw33
-rw-r--r--builds/unix/unix-cc.in2
-rw-r--r--include/freetype/config/ftoption.h5
-rw-r--r--src/svg/ftsvg.c4
-rw-r--r--src/svg/rules.mk4
5 files changed, 37 insertions, 11 deletions
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index 90bec4233..fc4337fe5 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -545,12 +545,15 @@ fi
# OT-SVG checks
# Librsvg is the default for now!
AC_ARG_WITH([svg],
- [AS_HELP_STRING([--with-svg=@<:@yes|no|auto@:>@],
+ [AS_HELP_STRING([--with-svg=@<:@yes|no|auto|no-default@:>@],
[support OpenType SVG fonts @<:@default=auto@:>@])],
[], [with_svg=auto])
have_librsvg=no
-if test x"$with_svg" = xyes -o x"$with_svg"=xauto; then
+have_librsvg_simple=no
+with_svg_simple=no
+if test x"$with_svg" = xyes -o x"$with_svg" = xauto; then
+ with_svg_simple=yes
librsvg_pkg="librsvg-2.0 >= 2.40.0"
have_librsvg_pkg=no
@@ -558,7 +561,7 @@ if test x"$with_svg" = xyes -o x"$with_svg"=xauto; then
PKG_CHECK_EXISTS([$librsvg_pkg], [have_librsvg_pkg=yes])
fi
PKG_CHECK_MODULES([LIBRSVG], [$librsvg_pkg],
- [have_librsvg="yes (pkg-config)"], [:])
+ [have_librsvg="yes (pkg-config)";have_librsvg_simple="yes"], [:])
if test $have_librsvg_pkg = yes; then
# we have librsvg pkg-config file
@@ -573,10 +576,16 @@ if test x"$with_svg" = xyes -o x"$with_svg"=xauto; then
librsvg_libspriv="$LIBRSVG_LIBS"
librsvg_libsstaticconf="$LIBRSVG_LIBS"
have_librsvg="yes (LIBRSVG_CFLAGS and LIBRSVG_LIBS)"
+ have_librsvg_simple="yes"
fi
fi
+elif test x"$with_svg" = x"no-default"; then
+ have_librsvg="no-default"
+ have_librsvg_simple="no"
+ with_svg_simple="no-default"
+else
+ with_svg_simple="no"
fi
-
# check for librt
#
# We need `clock_gettime' for the `ftbench' demo program.
@@ -1122,15 +1131,24 @@ else
ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ
fi
-if test "$have_librsvg" != no; then
+COMPILE_SVG_PORT=no
+if test "$have_librsvg_simple" = yes -a "$with_svg_simple" = yes; then
LIBRSVG_CFLAGS=$(echo $LIBRSVG_CFLAGS | sed -e 's/-I\(.*\?\)freetype2//g')
CFLAGS="$CFLAGS $LIBRSVG_CFLAGS"
LDFLAGS="$LDFLAGS $LIBRSVG_LIBS"
- ftoption_set FT_CONFIG_OPTION_SVG_DEFAULT
+ COMPILE_SVG_PORT=yes
+ ftoption_set FT_CONFIG_OPTION_SVG
+ ftoption_set FT_CONFIG_OPTION_DEFAULT_SVG
+elif test "$with_svg_simple" = "no"; then
+ ftoption_unset FT_CONFIG_OPTION_SVG
+ ftoption_unset FT_CONFIG_OPTION_DEFAULT_SVG
else
- ftoption_unset FT_CONFIG_OPTION_SVG_DEFAULT
+ COMPILE_SVG_PORT=no
+ ftoption_set FT_CONFIG_OPTION_SVG
+ ftoption_unset FT_CONFIG_OPTION_DEFAULT_SVG
fi
+AC_SUBST([COMPILE_SVG_PORT])
AC_SUBST([CFLAGS])
AC_SUBST([LDFLAGS])
@@ -1176,6 +1194,7 @@ Library configuration:
bzip2: $have_bzip2
libpng: $have_libpng
harfbuzz: $have_harfbuzz
+ svg support: $have_librsvg
])
# Warn if docwriter is not installed
diff --git a/builds/unix/unix-cc.in b/builds/unix/unix-cc.in
index ed51fde34..6331845ea 100644
--- a/builds/unix/unix-cc.in
+++ b/builds/unix/unix-cc.in
@@ -81,6 +81,8 @@ T := -o$(space)
CPPFLAGS := @CPPFLAGS@
CFLAGS := -c @XX_CFLAGS@ @CFLAGS@ -DFT_CONFIG_CONFIG_H="<ftconfig.h>"
+COMPILE_SVG_PORT := @COMPILE_SVG_PORT@
+
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS := @XX_ANSIFLAGS@
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 6d5739159..fb8d2363b 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -493,6 +493,8 @@ FT_BEGIN_HEADER
#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
+
+
/**************************************************************************
*
* OpenType SVG Glyph Support
@@ -501,8 +503,7 @@ FT_BEGIN_HEADER
*/
#define FT_CONFIG_OPTION_SVG
-/* #define FT_CONFIG_OPTION_SVG_DEFAULT */
-
+/* #define FT_CONFIG_OPTION_DEFAULT_SVG */
/**************************************************************************
*
diff --git a/src/svg/ftsvg.c b/src/svg/ftsvg.c
index df0a702c6..cca8d45bb 100644
--- a/src/svg/ftsvg.c
+++ b/src/svg/ftsvg.c
@@ -21,7 +21,7 @@
#include FT_SVG_RENDER_H
#include FT_BBOX_H
-#ifdef FT_CONFIG_OPTION_SVG_DEFAULT
+#ifdef FT_CONFIG_OPTION_DEFAULT_SVG
#include <rsvg_port.h>
#endif
#include <stdio.h>
@@ -34,7 +34,7 @@
{
FT_Error error = FT_Err_Ok;
svg_module->loaded = FALSE;
-#ifdef FT_CONFIG_OPTION_SVG_DEFAULT
+#ifdef FT_CONFIG_OPTION_DEFAULT_SVG
svg_module->hooks.init_svg = (SVG_Lib_Init_Func)rsvg_port_init;
svg_module->hooks.free_svg = (SVG_Lib_Free_Func)rsvg_port_free;
svg_module->hooks.render_svg = (SVG_Lib_Render_Func)rsvg_port_render;
diff --git a/src/svg/rules.mk b/src/svg/rules.mk
index c5e5ed95a..33703d594 100644
--- a/src/svg/rules.mk
+++ b/src/svg/rules.mk
@@ -60,8 +60,10 @@ SVG_DRV_SRC_S := $(SVG_DIR)/svg.c
SVG_PORT_SRC_S := $(SVG_DIR)/rsvg_port.c
SVG_PORT_OBJ_S := $(OBJ_DIR)/rsvg_port.$O
+ifeq ($(COMPILE_SVG_PORT), yes)
$(SVG_PORT_OBJ_S): $(SVG_PORT_SRC_S) $(FREETYPE_H)
$(SVG_PORT_COMPILE) $T$(subst /,$(COMPILER_SEP), $@ $(SVG_PORT_SRC_S))
+endif
$(SVG_DRV_OBJ_S): $(SVG_DRV_SRC_S) $(SVG_DRV_SRC) \
$(FREETYPE_H) $(SVG_DRV_H)
@@ -79,6 +81,8 @@ $(OBJ_DIR)/%.$O: $(SVG_DIR)/%.c $(FREETYPE_H) $(SVG_DRV_H)
DRV_OBJS_S += $(SVG_DRV_OBJ_S)
DRV_OBJS_M += $(SVG_DRV_OBJ_M)
+ifeq ($(COMPILE_SVG_PORT), yes)
DRV_OBJS_S += $(SVG_PORT_OBJ_S)
+endif
# EOF