[inkscape] switch to librevenge-based import libs
David Tardon
dtardon at fedoraproject.org
Wed May 28 11:00:41 UTC 2014
commit 2aa77aa6cbbde044d027f206e57f0a26a0aba1b8
Author: David Tardon <dtardon at redhat.com>
Date: Tue May 27 17:11:27 2014 +0200
switch to librevenge-based import libs
0001-update-to-new-libwpg.patch | 112 +++++++++++++++++++++++++++++++++++++++
inkscape.spec | 7 ++-
2 files changed, 118 insertions(+), 1 deletions(-)
---
diff --git a/0001-update-to-new-libwpg.patch b/0001-update-to-new-libwpg.patch
new file mode 100644
index 0000000..c745143
--- /dev/null
+++ b/0001-update-to-new-libwpg.patch
@@ -0,0 +1,112 @@
+From 127777fe3298bcdfe45d74b36f77b8238ebb6937 Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Tue, 27 May 2014 16:47:39 +0200
+Subject: [PATCH] switch to librevenge-based import libs
+
+---
+ configure.ac | 19 ++---------------
+ src/extension/internal/wpg-input.cpp | 41 ++++++++++++------------------------
+ 2 files changed, 15 insertions(+), 45 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index fcff879..4bce58c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -676,23 +676,8 @@ dnl ******************************
+
+ with_libwpg=no
+
+-PKG_CHECK_MODULES(LIBWPG01, libwpg-0.1 libwpg-stream-0.1, with_libwpg01=yes, with_libwpg01=no)
+-if test "x$with_libwpg01" = "xyes"; then
+- AC_DEFINE(WITH_LIBWPG01,1,[Build in libwpg 0.1.x])
+- with_libwpg=yes
+- AC_SUBST(LIBWPG_LIBS, $LIBWPG01_LIBS)
+- AC_SUBST(LIBWPG_CFLAGS, $LIBWPG01_CFLAGS)
+-fi
+-AM_CONDITIONAL(WITH_LIBWPG01, test "x$with_libwpg01" = "xyes")
+-
+-PKG_CHECK_MODULES(LIBWPG02, libwpg-0.2 libwpd-0.9 libwpd-stream-0.9, with_libwpg02=yes, with_libwpg02=no)
+-if test "x$with_libwpg02" = "xyes"; then
+- AC_DEFINE(WITH_LIBWPG02,1,[Build in libwpg 0.2.x])
+- with_libwpg=yes
+- AC_SUBST(LIBWPG_LIBS, $LIBWPG02_LIBS)
+- AC_SUBST(LIBWPG_CFLAGS, $LIBWPG02_CFLAGS)
+-fi
+-AM_CONDITIONAL(WITH_LIBWPG02, test "x$with_libwpg02" = "xyes")
++PKG_CHECK_MODULES(LIBWPG, libwpg-0.3 librevenge-0.0 librevenge-stream-0.0, with_libwpg=yes, with_libwpg=no)
++AM_CONDITIONAL(WITH_LIBWPG01, test "x$with_libwpg" = "xyes")
+
+ if test "x$with_libwpg" = "xyes"; then
+ AC_DEFINE(WITH_LIBWPG,1,[Build in libwpg])
+diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp
+index 5c5cb65..71c7b44 100644
+--- a/src/extension/internal/wpg-input.cpp
++++ b/src/extension/internal/wpg-input.cpp
+@@ -48,17 +48,8 @@
+ #include "extension/input.h"
+ #include "document.h"
+
+-// Take a guess and fallback to 0.1.x if no configure has run
+-#if !defined(WITH_LIBWPG01) && !defined(WITH_LIBWPG02)
+-#define WITH_LIBWPG01 1
+-#endif
+-
+ #include "libwpg/libwpg.h"
+-#if WITH_LIBWPG01
+-#include "libwpg/WPGStreamImplementation.h"
+-#elif WITH_LIBWPG02
+-#include "libwpd-stream/libwpd-stream.h"
+-#endif
++#include "librevenge-stream/librevenge-stream.h"
+
+ using namespace libwpg;
+
+@@ -69,17 +60,9 @@ namespace Internal {
+
+ SPDocument *
+ WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) {
+-#if WITH_LIBWPG01
+- WPXInputStream* input = new libwpg::WPGFileStream(uri);
+-#elif WITH_LIBWPG02
+- WPXInputStream* input = new WPXFileStream(uri);
+-#endif
+- if (input->isOLEStream()) {
+-#if WITH_LIBWPG01
+- WPXInputStream* olestream = input->getDocumentOLEStream();
+-#elif WITH_LIBWPG02
+- WPXInputStream* olestream = input->getDocumentOLEStream("PerfectOffice_MAIN");
+-#endif
++ librevenge::RVNGInputStream* input = new librevenge::RVNGFileStream(uri);
++ if (input->isStructured()) {
++ librevenge::RVNGInputStream* olestream = input->getSubStreamByName("PerfectOffice_MAIN");
+ if (olestream) {
+ delete input;
+ input = olestream;
+@@ -94,15 +77,17 @@ WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) {
+ return NULL;
+ }
+
+-#if WITH_LIBWPG01
+- libwpg::WPGString output;
+-#elif WITH_LIBWPG02
+- WPXString output;
+-#endif
+- if (!libwpg::WPGraphics::generateSVG(input, output)) {
++ librevenge::RVNGStringVector vec;
++ librevenge::RVNGSVGDrawingGenerator generator(vec, "");
++
++ if (!libwpg::WPGraphics::parse(input, &generator) || vec.empty() || vec[0].empty())
++ {
+ delete input;
+ return NULL;
+- }
++ }
++
++ librevenge::RVNGString output("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
++ output.append(vec[0]);
+
+ //printf("I've got a doc: \n%s", painter.document.c_str());
+
+--
+1.9.3
+
diff --git a/inkscape.spec b/inkscape.spec
index cf18d2f..dacb5e9 100644
--- a/inkscape.spec
+++ b/inkscape.spec
@@ -1,6 +1,6 @@
Name: inkscape
Version: 0.48.4
-Release: 15%{?dist}
+Release: 16%{?dist}
Summary: Vector-based drawing program using SVG
Group: Applications/Productivity
@@ -19,6 +19,7 @@ Patch11: inkscape-0.48.4-freetype.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1097945
Patch12: inkscape-0.48.4-poppler-0.26.patch
Patch13: inkscape-0.48.4-gc-7.4.patch
+Patch14: 0001-update-to-new-libwpg.patch
%if 0%{?fedora} && 0%{?fedora} < 18
%define desktop_vendor fedora
@@ -139,6 +140,7 @@ graphics in W3C standard Scalable Vector Graphics (SVG) file format.
%patch11 -p0 -b .freetype
%patch12 -p1 -b .poppler
%patch13 -p1 -b .gc
+%patch14 -p1 -b .libwpg
# https://bugs.launchpad.net/inkscape/+bug/314381
# A couple of files have executable bits set,
@@ -242,6 +244,9 @@ fi
%changelog
+* Tue May 27 2014 David Tardon <dtardon at redhat.com> - 0.48.4-16
+- switch to librevenge-based import libs
+
* Fri May 23 2014 Petr Machata <pmachata at redhat.com> - 0.48.4-15
- Rebuild for boost 1.55.0
More information about the scm-commits
mailing list