freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] GSoC-2019-moazin 01f94b3 40/47: Improve `--with-svg' in the


From: Moazin Khatti
Subject: [freetype2] GSoC-2019-moazin 01f94b3 40/47: Improve `--with-svg' in the build system.
Date: Fri, 26 Jul 2019 10:02:10 -0400 (EDT)

branch: GSoC-2019-moazin
commit 01f94b398f0abc898134851c72488976231a8c97
Author: Moazin Khatti <address@hidden>
Commit: Moazin Khatti <address@hidden>

    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.
---
 builds/unix/configure.raw          | 33 ++++++++++++++++++++++++++-------
 builds/unix/unix-cc.in             |  2 ++
 include/freetype/config/ftoption.h |  5 +++--
 src/svg/ftsvg.c                    |  4 ++--
 src/svg/rules.mk                   |  4 ++++
 5 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index 90bec42..fc4337f 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 ed51fde..6331845 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 6d57391..fb8d236 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 df0a702..cca8d45 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 c5e5ed9..33703d5 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]