[librsvg] Hard-depend on libcroco
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Hard-depend on libcroco
- Date: Mon, 7 Nov 2011 19:28:22 +0000 (UTC)
commit 3c950c14208a66757d451a3018d7e79b67a76f8d
Author: Christian Persch <chpe gnome org>
Date: Sat Oct 22 21:37:52 2011 +0200
Hard-depend on libcroco
Makefile.am | 8 ---
configure.in | 43 +----------------
doc/Makefile.am | 2 -
gdk-pixbuf-loader/Makefile.am | 4 +-
librsvg-features.h.in | 2 +-
librsvg-uninstalled.pc.in | 2 +-
librsvg.pc.in | 2 +-
rsvg-styles.c | 104 ++--------------------------------------
tools/Makefile.am | 2 -
9 files changed, 13 insertions(+), 156 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 6d6f112..a446307 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -88,14 +88,12 @@ librsvg_ RSVG_API_MAJOR_VERSION@_la_CPPFLAGS = \
librsvg_ RSVG_API_MAJOR_VERSION@_la_CFLAGS = \
$(LIBRSVG_CFLAGS) \
- $(LIBCROCO_CFLAGS) \
$(AM_CFLAGS)
librsvg_ RSVG_API_MAJOR_VERSION@_la_LDFLAGS = -version-info @RSVG_LT_VERSION_INFO@ -export-dynamic -no-undefined -export-symbols $(srcdir)/librsvg.def $(AM_LDFLAGS)
librsvg_ RSVG_API_MAJOR_VERSION@_la_LIBADD = \
$(LIBRSVG_LIBS) \
- $(LIBCROCO_LIBS) \
$(libm)
librsvgincdir = $(includedir)/librsvg-$(RSVG_API_VERSION)/librsvg
@@ -120,7 +118,6 @@ rsvg_convert_CPPFLAGS = \
rsvg_convert_CFLAGS =\
$(LIBRSVG_CFLAGS) \
- $(LIBCROCO_CFLAGS) \
$(AM_CFLAGS)
rsvg_convert_LDFLAGS = $(AM_LDFLAGS)
@@ -128,7 +125,6 @@ rsvg_convert_LDFLAGS = $(AM_LDFLAGS)
rsvg_convert_LDADD = \
$(top_builddir)/librsvg- RSVG_API_MAJOR_VERSION@.la \
$(LIBRSVG_LIBS) \
- $(LIBCROCO_LIBS) \
$(GTHREAD_LIBS) \
$(libm)
@@ -144,7 +140,6 @@ rsvg_view_CPPFLAGS = \
rsvg_view_CFLAGS =\
$(GTK2_CFLAGS) \
$(LIBRSVG_CFLAGS) \
- $(LIBCROCO_CFLAGS) \
$(AM_CFLAGS)
rsvg_view_LDFLAGS =
@@ -153,7 +148,6 @@ rsvg_view_LDADD = \
$(top_builddir)/librsvg- RSVG_API_MAJOR_VERSION@.la \
$(GTK2_LIBS) \
$(LIBRSVG_LIBS) \
- $(LIBCROCO_LIBS) \
$(GTHREAD_LIBS) \
$(libm)
@@ -169,7 +163,6 @@ rsvg_view_3_CPPFLAGS = \
rsvg_view_3_CFLAGS =\
$(GTK3_CFLAGS) \
$(LIBRSVG_CFLAGS) \
- $(LIBCROCO_CFLAGS) \
$(AM_CFLAGS)
rsvg_view_3_LDFLAGS =
@@ -178,7 +171,6 @@ rsvg_view_3_LDADD = \
$(top_builddir)/librsvg- RSVG_API_MAJOR_VERSION@.la \
$(GTK3_LIBS) \
$(LIBRSVG_LIBS) \
- $(LIBCROCO_LIBS) \
$(GTHREAD_LIBS) \
$(libm)
diff --git a/configure.in b/configure.in
index 2cf5e90..26fe5d1 100644
--- a/configure.in
+++ b/configure.in
@@ -38,6 +38,7 @@ PANGOCAIRO_REQUIRED=1.10.0
GDK_PIXBUF_REQUIRED=1.3.7
GTK2_REQUIRED=2.16.0
GTK3_REQUIRED=3.0.0
+CROCO_REQUIRED=0.6.1
# ===========================================================================
@@ -102,46 +103,13 @@ PKG_CHECK_MODULES(LIBRSVG, \
libxml-2.0 >= $LIBXML_REQUIRED \
pangocairo >= $PANGOCAIRO_REQUIRED \
cairo >= $CAIRO_REQUIRED \
- cairo-png >= $CAIRO_REQUIRED)
+ cairo-png >= $CAIRO_REQUIRED
+ libcroco-0.6 >= $CROCO_REQUIRED)
PKG_CHECK_MODULES([GTHREAD],[gthread-2.0 >= $GLIB_REQUIRED])
dnl ===========================================================================
-LIBCROCO_CFLAGS=""
-LIBCROCO_LIBS=""
-LIBCROCOPKG=""
-
-test_croco=true
-AC_ARG_WITH(croco,[ --with-croco Use libcroco for CSS parsing],[
- if test "x$withval" = "xno"; then
- test_croco=false
- fi
-])
-if test "x$test_croco" = "xtrue"; then
- PKG_CHECK_MODULES(LIBCROCO,[libcroco-0.6 >= 0.6.1], test_croco=true, test_croco=false)
-fi
-
-if test "x$test_croco" = "xtrue"; then
- croco_define=1
- LIBCROCO_CFLAGS="$LIBCROCO_CFLAGS -DHAVE_LIBCROCO=1"
- LIBCROCOPKG="libcroco-0.6"
-else
- croco_define=0
- AC_MSG_WARN([LibCroco support disabled, as requested (Use --with-croco to enable)])
- croco_warning="
-You are building without libcroco support. LibRSVG will not be able to handle embedded CSS, as is required per the SVG specification. If you are a library vendor or distributor, you are doing the world a disservice and should strongly consider shipping libcroco. Even KSVG needs libcroco now..."
-fi
-
-AC_SUBST(LIBCROCOPKG)
-AC_SUBST(LIBCROCO_CFLAGS)
-AC_SUBST(LIBCROCO_LIBS)
-
-AC_SUBST([CSS_SUPPORTED],[$test_croco])
-AC_SUBST([LIBRSVG_HAVE_CSS],[$croco_define])
-
-dnl ===========================================================================
-
AC_CHECK_FUNCS(strtok_r)
dnl ===========================================================================
@@ -349,9 +317,4 @@ librsvg-$VERSION
GTK 3.0: ${have_gtk_3}
Build GTK 2.0 theme engine: ${enable_gtk_theme}
Build miscellaenous tools: ${build_misc_tools}
- Use libcroco for css parsing: ${test_croco}
"
-
-if test "x$croco_warning" != "x"; then
- AC_MSG_RESULT([$croco_warning]);
-fi
diff --git a/doc/Makefile.am b/doc/Makefile.am
index dcccdce..5db7716 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -112,7 +112,6 @@ GTKDOC_CFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir) \
$(LIBRSVG_CFLAGS) \
- $(LIBCROCO_CFLAGS) \
$(GTK_CFLAGS) \
$(GDK_X11_CFLAGS) \
$(WARN_CFLAGS) \
@@ -123,7 +122,6 @@ GTKDOC_LIBS = \
$(top_builddir)/librsvg- RSVG_API_MAJOR_VERSION@.la \
$(LIBRSVG_LIBS) \
$(GTHREAD_LIBS) \
- $(LIBCROCO_LIBS) \
$(GTK_LIBS)
# This includes the standard gtk-doc make rules, copied by gtkdocize.
diff --git a/gdk-pixbuf-loader/Makefile.am b/gdk-pixbuf-loader/Makefile.am
index 18c5b80..a6611c2 100644
--- a/gdk-pixbuf-loader/Makefile.am
+++ b/gdk-pixbuf-loader/Makefile.am
@@ -17,7 +17,6 @@ libpixbufloader_svg_la_CPPFLAGS = \
libpixbufloader_svg_la_CFLAGS = \
$(GDK_PIXBUF_CFLAGS) \
$(LIBRSVG_CFLAGS) \
- $(LIBCROCO_CFLAGS) \
$(AM_CFLASG)
libpixbufloader_svg_la_LDFLAGS = -avoid-version -module $(AM_LDFLAGS)
@@ -25,8 +24,7 @@ libpixbufloader_svg_la_LDFLAGS = -avoid-version -module $(AM_LDFLAGS)
libpixbufloader_svg_la_LIBADD = \
$(top_builddir)/librsvg- RSVG_API_MAJOR_VERSION@.la \
$(GDK_PIXBUF_LIBS) \
- $(LIBRSVG_LIBS) \
- $(LIBCROCO_LIBS)
+ $(LIBRSVG_LIBS)
if PLATFORM_WIN32
libpixbufloader_svg_la_LDFLAGS += -no-undefined
diff --git a/librsvg-features.h.in b/librsvg-features.h.in
index 6787c5a..c0d3332 100644
--- a/librsvg-features.h.in
+++ b/librsvg-features.h.in
@@ -12,7 +12,7 @@
(LIBRSVG_MAJOR_VERSION == (major) && LIBRSVG_MINOR_VERSION == (minor) && LIBRSVG_MICRO_VERSION >= (micro)))
#define LIBRSVG_HAVE_SVGZ (TRUE)
-#define LIBRSVG_HAVE_CSS (@LIBRSVG_HAVE_CSS@)
+#define LIBRSVG_HAVE_CSS (TRUE)
#define LIBRSVG_CHECK_FEATURE(FEATURE) (defined(LIBRSVG_HAVE_##FEATURE) && LIBRSVG_HAVE_##FEATURE)
diff --git a/librsvg-uninstalled.pc.in b/librsvg-uninstalled.pc.in
index 2e6fca1..025fa03 100644
--- a/librsvg-uninstalled.pc.in
+++ b/librsvg-uninstalled.pc.in
@@ -4,7 +4,7 @@ libdir= libdir@
includedir= includedir@
svgz_supported=true
-css_supported= CSS_SUPPORTED@
+css_supported=true
Name: librsvg
Description: library that renders svg files
diff --git a/librsvg.pc.in b/librsvg.pc.in
index d2783a6..a451de0 100644
--- a/librsvg.pc.in
+++ b/librsvg.pc.in
@@ -4,7 +4,7 @@ libdir= libdir@
includedir= includedir@
svgz_supported=true
-css_supported= CSS_SUPPORTED@
+css_supported=true
Name: librsvg
Description: library that renders svg files
diff --git a/rsvg-styles.c b/rsvg-styles.c
index b49255b..41a1b78 100644
--- a/rsvg-styles.c
+++ b/rsvg-styles.c
@@ -37,6 +37,8 @@
#include "rsvg-mask.h"
#include "rsvg-marker.h"
+#include <libcroco/libcroco.h>
+
#define RSVG_DEFAULT_FONT "Times New Roman"
enum {
@@ -992,10 +994,6 @@ rsvg_css_define_style (RsvgHandle * ctx,
}
}
-#ifdef HAVE_LIBCROCO
-
-#include <libcroco/libcroco.h>
-
typedef struct _CSSUserData {
RsvgHandle *ctx;
CRSelector *selector;
@@ -1112,8 +1110,8 @@ init_sac_handler (CRDocHandler * a_handler)
a_handler->unrecoverable_error = ccss_unrecoverable_error;
}
-static void
-rsvg_real_parse_cssbuffer (RsvgHandle * ctx, const char *buff, size_t buflen)
+void
+rsvg_parse_cssbuffer (RsvgHandle * ctx, const char *buff, size_t buflen)
{
enum CRStatus status = CR_OK;
CRParser *parser = NULL;
@@ -1157,103 +1155,13 @@ ccss_import_style (CRDocHandler * a_this,
_rsvg_acquire_xlink_href_resource ((gchar *) cr_string_peek_raw_str (a_uri),
rsvg_handle_get_base_uri (user_data->ctx), NULL);
if (stylesheet_data) {
- rsvg_real_parse_cssbuffer (user_data->ctx, (const char *) stylesheet_data->data,
- (size_t) stylesheet_data->len);
+ rsvg_parse_cssbuffer (user_data->ctx, (const char *) stylesheet_data->data,
+ (size_t) stylesheet_data->len);
g_byte_array_free (stylesheet_data, TRUE);
}
}
}
-#else /* !HAVE_LIBCROCO */
-
-static void
-rsvg_real_parse_cssbuffer (RsvgHandle * ctx, const char *buff, size_t buflen)
-{
- /*
- * Extremely poor man's CSS parser. Not robust. Not compliant.
- * See also: http://www.w3.org/TR/REC-CSS2/syndata.html
- */
-
- size_t loc = 0;
-
- while (loc < buflen) {
- gchar **selectors;
- gchar **styles;
- guint i;
- GString *selector = g_string_new (NULL);
- GString *style_props = g_string_new (NULL);
-
- /* advance to the style's name */
- while (loc < buflen && g_ascii_isspace (buff[loc]))
- loc++;
-
- /* advance to the first { that defines the style's properties */
- while (loc < buflen && buff[loc] != '{')
- g_string_append_c (selector, buff[loc++]);
- loc++;
-
- while (loc < buflen && g_ascii_isspace (buff[loc]))
- loc++;
-
- while (loc < buflen && buff[loc] != '}') {
- /* suck in and append our property */
- while (loc < buflen && buff[loc] != ';' && buff[loc] != '}')
- g_string_append_c (style_props, buff[loc++]);
-
- if (loc == buflen || buff[loc] == '}')
- break;
- else {
- g_string_append_c (style_props, ';');
-
- /* advance to the next property */
- loc++;
- while (loc < buflen && g_ascii_isspace (buff[loc]))
- loc++;
- }
- }
-
- selectors = g_strsplit (selector->str, ",", -1);
- styles = g_strsplit (style_props->str, ";", -1);
- for (i = 0; i < g_strv_length (selectors); i++) {
- guint j;
- for (j = 0; j < g_strv_length (styles); j++) {
- gchar **values;
- values = g_strsplit (styles[j], ":", 2);
- if (g_strv_length (values) == 2) {
- gchar *style_value = NULL;
- gboolean important;
- parse_style_value (g_strstrip (values[1]), &style_value, &important);
- rsvg_css_define_style (ctx,
- g_strstrip (selectors[i]),
- g_strstrip (values[0]),
- g_strstrip (style_value),
- important);
- g_free (style_value);
- }
- g_strfreev (values);
- }
- }
- g_strfreev (selectors);
- g_strfreev (styles);
-
- g_string_free (selector, TRUE);
- g_string_free (style_props, TRUE);
-
- loc++;
- while (loc < buflen && g_ascii_isspace (buff[loc]))
- loc++;
- }
-}
-
-#endif /* HAVE_LIBCROCO */
-
-void
-rsvg_parse_cssbuffer (RsvgHandle * ctx, const char *buff, size_t buflen)
-{
- /* delegate off to the builtin or libcroco implementation */
- rsvg_real_parse_cssbuffer (ctx, buff, buflen);
-}
-
/* Parse an SVG transform string into an affine matrix. Reference: SVG
working draft dated 1999-07-06, section 8.5. Return TRUE on
success. */
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 95b0b55..72acfd2 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -11,7 +11,6 @@ endif
INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir) \
- $(LIBCROCO_CFLAGS) \
$(LIBRSVG_CFLAGS) \
$(GTK_CFLAGS) \
$(GDK_X11_CFLAGS) \
@@ -22,7 +21,6 @@ DEPS = $(top_builddir)/librsvg- RSVG_API_MAJOR_VERSION@.la \
librsvg_tools_main.la
LDADDS = \
$(GLIB_LIBS) \
- $(LIBCROCO_LIBS) \
$(LIBRSVG_LIBS) \
$(top_builddir)/librsvg- RSVG_API_MAJOR_VERSION@.la
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]