Plug in a default library. `librsvg' for now.

This commit is contained in:
Moazin Khatti 2019-07-21 11:39:10 +05:00
parent d86de4e9d4
commit 246ac684e4
4 changed files with 74 additions and 4 deletions

View File

@ -542,6 +542,40 @@ if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no; then
AC_MSG_ERROR([harfbuzz support requested but library not found])
fi
# OT-SVG checks
# Librsvg is the default for now!
AC_ARG_WITH([svg],
[AS_HELP_STRING([--with-svg=@<:@yes|no|auto@:>@],
[support OpenType SVG fonts @<:@default=auto@:>@])],
[], [with_svg=auto])
have_librsvg=no
if test x"$with_svg" = xyes -o x"$with_svg"=xauto; then
librsvg_pkg="librsvg-2.0 >= 2.40.0"
have_librsvg_pkg=no
if test x"$LIBRSVG_CFLAGS" = x -a x"$LIBRSVG_LIBS" = x; then
PKG_CHECK_EXISTS([$librsvg_pkg], [have_librsvg_pkg=yes])
fi
PKG_CHECK_MODULES([LIBRSVG], [$librsvg_pkg],
[have_librsvg="yes (pkg-config)"], [:])
if test $have_librsvg_pkg = yes; then
# we have librsvg pkg-config file
librsvg_reqpriv="$librsvg_pkg"
librsvg_libspriv=
librsvg_libsstaticconf=`$PKG_CONFIG --static --libs "$librsvg_pkg"`
else
librsvg_reqpriv=
if test "$have_librsvg" != no; then
# LIBRSVG_CFLAGS and LIBRSVG_LIBS are set by the user
librsvg_libspriv="$LIBRSVG_LIBS"
librsvg_libsstaticconf="$LIBRSVG_LIBS"
have_librsvg="yes (LIBRSVG_CFLAGS and LIBRSVG_LIBS)"
fi
fi
fi
# check for librt
#
@ -992,7 +1026,8 @@ fi
REQUIRES_PRIVATE="$zlib_reqpriv, \
$bzip2_reqpriv, \
$libpng_reqpriv, \
$harfbuzz_reqpriv"
$harfbuzz_reqpriv, \
$librsvg_reqpriv"
# beautify
REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \
| sed -e 's/^ *//' \
@ -1007,7 +1042,8 @@ LIBS_PRIVATE="$zlib_libspriv \
$bzip2_libspriv \
$libpng_libspriv \
$harfbuzz_libspriv \
$ft2_extra_libs"
$ft2_extra_libs \
$librsvg_libspriv"
# beautify
LIBS_PRIVATE=`echo "$LIBS_PRIVATE" \
| sed -e 's/^ *//' \
@ -1019,7 +1055,9 @@ LIBSSTATIC_CONFIG="-lfreetype \
$bzip2_libsstaticconf \
$libpng_libsstaticconf \
$harfbuzz_libsstaticconf \
$ft2_extra_libs"
$ft2_extra_libs \
$librsvg_libsstaticconf"
# remove -L/usr/lib and -L/usr/lib64 since `freetype-config' adds them later
# on if necessary; also beautify
LIBSSTATIC_CONFIG=`echo "$LIBSSTATIC_CONFIG" \
@ -1084,6 +1122,15 @@ else
ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ
fi
if test "$have_librsvg" != no; 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
else
ftoption_unset FT_CONFIG_OPTION_SVG_DEFAULT
fi
AC_SUBST([CFLAGS])
AC_SUBST([LDFLAGS])

View File

@ -501,6 +501,8 @@ FT_BEGIN_HEADER
*/
#define FT_CONFIG_OPTION_SVG
/* #define FT_CONFIG_OPTION_SVG_DEFAULT */
/**************************************************************************
*

View File

@ -21,6 +21,9 @@
#include FT_SVG_RENDER_H
#include FT_BBOX_H
#ifdef FT_CONFIG_OPTION_SVG_DEFAULT
#include <rsvg_port.h>
#endif
#include <stdio.h>
#include "ftsvg.h"
@ -31,6 +34,12 @@
{
FT_Error error = FT_Err_Ok;
svg_module->loaded = FALSE;
#ifdef FT_CONFIG_OPTION_SVG_DEFAULT
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;
svg_module->hooks.get_buffer_size = (SVG_Lib_Get_Buffer_Size_Func)rsvg_port_get_buffer_size;
#endif
return error;
}

View File

@ -21,9 +21,13 @@ SVG_DIR := $(SRC_DIR)/svg
#
SVG_COMPILE := $(CC) $(ANSIFLAGS) \
$I$(subst /,$(COMPILER_SEP),$(SVG_DIR)) \
$(INCLUDE_FLAGS) \
$(INCLUDE_FLAGS) \
$(FT_CFLAGS)
SVG_PORT_COMPILE := $(CC) \
$I$(subst /,$(COMPILER_SEP),$(SVG_DIR)) \
$(INCLUDE_FLAGS) \
$(FT_CFLAGS)
# raster driver sources (i.e., C files)
#
@ -52,6 +56,13 @@ SVG_DRV_SRC_S := $(SVG_DIR)/svg.c
# raster driver - single object
#
SVG_PORT_SRC_S := $(SVG_DIR)/rsvg_port.c
SVG_PORT_OBJ_S := $(OBJ_DIR)/rsvg_port.$O
$(SVG_PORT_OBJ_S): $(SVG_PORT_SRC_S) $(FREETYPE_H)
$(SVG_PORT_COMPILE) $T$(subst /,$(COMPILER_SEP), $@ $(SVG_PORT_SRC_S))
$(SVG_DRV_OBJ_S): $(SVG_DRV_SRC_S) $(SVG_DRV_SRC) \
$(FREETYPE_H) $(SVG_DRV_H)
$(SVG_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(SVG_DRV_SRC_S))
@ -68,5 +79,6 @@ $(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)
DRV_OBJS_S += $(SVG_PORT_OBJ_S)
# EOF