[libmwaw] initial import

David Tardon dtardon at fedoraproject.org
Sun Apr 28 05:36:46 UTC 2013


commit b22e27449b3fb8781bcdcf2ebaff39c6585edd42
Author: David Tardon <dtardon at redhat.com>
Date:   Sun Apr 28 07:35:50 2013 +0200

    initial import

 .gitignore                                         |    1 +
 0001-Trying-to-fix-some-windows-build-issues.patch |   86 +++++++++++++++
 0001-add-missing-include-for-atoi.patch            |   33 ++++++
 ...se-cast-for-conv.-from-shared_ptr-to-bool.patch |   45 ++++++++
 libmwaw.spec                                       |  115 ++++++++++++++++++++
 sources                                            |    1 +
 6 files changed, 281 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..60fd72f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/libmwaw-0.1.7.tar.bz2
diff --git a/0001-Trying-to-fix-some-windows-build-issues.patch b/0001-Trying-to-fix-some-windows-build-issues.patch
new file mode 100644
index 0000000..9770798
--- /dev/null
+++ b/0001-Trying-to-fix-some-windows-build-issues.patch
@@ -0,0 +1,86 @@
+From 28f9b6f3610734b541eee7b8deb7a3ddbdef2d5c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba at bluewin.ch>
+Date: Wed, 13 Mar 2013 14:58:39 +0100
+Subject: [PATCH] Trying to fix some windows build issues
+
+---
+ src/lib/CWGraph.cxx          | 2 ++
+ src/lib/EDParser.cxx         | 2 +-
+ src/lib/HMWKGraph.cxx        | 2 ++
+ src/lib/MSWStruct.cxx        | 2 +-
+ src/lib/libmwaw_internal.hxx | 5 +++++
+ 5 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/src/lib/CWGraph.cxx b/src/lib/CWGraph.cxx
+index 3c141b3..1cfed0f 100644
+--- a/src/lib/CWGraph.cxx
++++ b/src/lib/CWGraph.cxx
+@@ -55,6 +55,8 @@
+ 
+ #include "CWGraph.hxx"
+ 
++#include "libmwaw_internal.hxx"
++
+ /** Internal: the structures of a CWGraph */
+ namespace CWGraphInternal
+ {
+diff --git a/src/lib/EDParser.cxx b/src/lib/EDParser.cxx
+index de0c64f..dd926ed 100644
+--- a/src/lib/EDParser.cxx
++++ b/src/lib/EDParser.cxx
+@@ -756,7 +756,7 @@ private:
+ 
+ bool DeflateStruct::sendDuplicated(int num, int depl)
+ {
+-  ssize_t readPos=ssize_t(m_circQueuePos)+ssize_t(depl);
++  int64_t readPos=m_circQueuePos+depl;
+   while (readPos < 0) readPos+=0x2000;
+   while (readPos >= 0x2000) readPos-=0x2000;
+ 
+diff --git a/src/lib/HMWKGraph.cxx b/src/lib/HMWKGraph.cxx
+index 7e1b093..0e61ca9 100644
+--- a/src/lib/HMWKGraph.cxx
++++ b/src/lib/HMWKGraph.cxx
+@@ -53,6 +53,8 @@
+ 
+ #include "HMWKGraph.hxx"
+ 
++#include "libmwaw_internal.hxx"
++
+ /** Internal: the structures of a HMWKGraph */
+ namespace HMWKGraphInternal
+ {
+diff --git a/src/lib/MSWStruct.cxx b/src/lib/MSWStruct.cxx
+index 9f250df..099e75b 100644
+--- a/src/lib/MSWStruct.cxx
++++ b/src/lib/MSWStruct.cxx
+@@ -1027,7 +1027,7 @@ void Paragraph::insert(Paragraph const &para, bool insertModif)
+       for (size_t j = 0; j < m_tabs->size(); j++) {
+         if (m_tabs.get()[j].m_position < val-1e-4 || m_tabs.get()[j].m_position > val+1e-4)
+           continue;
+-        m_tabs->erase (m_tabs->begin()+ssize_t(j));
++        m_tabs->erase (m_tabs->begin()+j);
+         done = true;
+         break;
+       }
+diff --git a/src/lib/libmwaw_internal.hxx b/src/lib/libmwaw_internal.hxx
+index 8d5db57..437f90f 100644
+--- a/src/lib/libmwaw_internal.hxx
++++ b/src/lib/libmwaw_internal.hxx
+@@ -41,8 +41,13 @@
+ #include <map>
+ #include <ostream>
+ #include <string>
++#include <math.h>
+ #include <vector>
+ 
++#ifndef M_PI
++#define M_PI 3.14159265358979323846
++#endif
++
+ #include <libwpd-stream/libwpd-stream.h>
+ #include <libwpd/libwpd.h>
+ 
+-- 
+1.8.1.4
+
diff --git a/0001-add-missing-include-for-atoi.patch b/0001-add-missing-include-for-atoi.patch
new file mode 100644
index 0000000..f3aa94b
--- /dev/null
+++ b/0001-add-missing-include-for-atoi.patch
@@ -0,0 +1,33 @@
+From 38be8fd6157e84285683ca4722d67a33e605e9b2 Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Tue, 19 Mar 2013 08:35:41 +0100
+Subject: [PATCH] add missing include for atoi
+
+---
+ src/lib/MWAWOLEParser.cxx | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/lib/MWAWOLEParser.cxx b/src/lib/MWAWOLEParser.cxx
+index bb0bdb0..06c38bd 100644
+--- a/src/lib/MWAWOLEParser.cxx
++++ b/src/lib/MWAWOLEParser.cxx
+@@ -74,6 +74,7 @@
+  * ------------------------------------------------------------
+  */
+ 
++#include <cstdlib>
+ #include <cstring>
+ #include <iostream>
+ #include <map>
+@@ -328,7 +329,7 @@ bool MWAWOLEParser::parse(MWAWInputStreamPtr file)
+         std::string::size_type idP = pos-1;
+         while (idP >=1 && dir[idP-1] >= '0' && dir[idP-1] <= '9')
+           idP--;
+-        int val = atoi(dir.substr(idP, idP-pos).c_str());
++        int val = std::atoi(dir.substr(idP, idP-pos).c_str());
+         if (id[0] == -1) id[0] = val;
+         else {
+           id[1] = val;
+-- 
+1.8.1.4
+
diff --git a/0001-use-cast-for-conv.-from-shared_ptr-to-bool.patch b/0001-use-cast-for-conv.-from-shared_ptr-to-bool.patch
new file mode 100644
index 0000000..f0ead85
--- /dev/null
+++ b/0001-use-cast-for-conv.-from-shared_ptr-to-bool.patch
@@ -0,0 +1,45 @@
+From 33be1b4f0f60e91a0ad3d945e13a056a6dc8b9ab Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Sat, 27 Apr 2013 16:12:47 +0200
+Subject: [PATCH] use cast for conv. from shared_ptr to bool
+
+... because std::shared_ptr<>::operator bool is explicit in C++11.
+---
+ src/lib/MWAWInputStream.cxx | 2 +-
+ src/lib/MWAWInputStream.hxx | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/lib/MWAWInputStream.cxx b/src/lib/MWAWInputStream.cxx
+index 0220f02..5c0bfff 100644
+--- a/src/lib/MWAWInputStream.cxx
++++ b/src/lib/MWAWInputStream.cxx
+@@ -583,7 +583,7 @@ bool MWAWInputStream::createStorageOLE()
+   m_storageOLE.reset(new libmwaw::Storage(m_stream.get()));
+   seek(actPos, WPX_SEEK_SET);
+ 
+-  return m_storageOLE;
++  return bool(m_storageOLE);
+ }
+ 
+ ////////////////////////////////////////////////////////////
+diff --git a/src/lib/MWAWInputStream.hxx b/src/lib/MWAWInputStream.hxx
+index ecdc66c..25a5396 100644
+--- a/src/lib/MWAWInputStream.hxx
++++ b/src/lib/MWAWInputStream.hxx
+@@ -170,11 +170,11 @@ public:
+ 
+   /** returns true if the data fork block exists */
+   bool hasDataFork() const {
+-    return m_stream;
++    return bool(m_stream);
+   }
+   /** returns true if the resource fork block exists */
+   bool hasResourceFork() const {
+-    return m_resourceFork;
++    return bool(m_resourceFork);
+   }
+   /** returns the resource fork if find */
+   shared_ptr<MWAWInputStream> getResourceForkStream() {
+-- 
+1.8.1.4
+
diff --git a/libmwaw.spec b/libmwaw.spec
new file mode 100644
index 0000000..cc1999a
--- /dev/null
+++ b/libmwaw.spec
@@ -0,0 +1,115 @@
+%global apiversion 0.1
+
+Name: libmwaw
+Version: 0.1.7
+Release: 2%{?dist}
+Summary: Import library for some old mac text documents
+
+Group: System Environment/Libraries
+# The entire source code is LGPLv2+/MPLv2.0 except
+# src/lib/MWAWOLEStream.[ch]xx which are BSD. There is also
+# src/tools/zip/zip.cpp which is GPLv2+, but we do not build the binary
+# it is used for.
+License: (LGPLv2+ or MPLv2.0) and BSD
+URL: http://sourceforge.net/projects/libmwaw/
+Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
+
+BuildRequires: doxygen
+BuildRequires: libwpd-devel
+
+Patch0: 0001-Trying-to-fix-some-windows-build-issues.patch
+Patch1: 0001-add-missing-include-for-atoi.patch
+Patch2: 0001-use-cast-for-conv.-from-shared_ptr-to-bool.patch
+
+%description
+libmwaw contains some import filters for old mac text documents
+(MacWrite, ClarisWorks, ... ) based on top of the libwpd (which is
+already used in three word processors). 
+
+%package devel
+Summary: Development files for %{name}
+Group: Development/Libraries
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description devel
+The %{name}-devel package contains libraries and header files for
+developing applications that use %{name}.
+
+%package doc
+Summary: Documentation of %{name} API
+Group: Documentation
+BuildArch: noarch
+
+%description doc
+The %{name}-doc package contains documentation files for %{name}.
+
+%package tools
+Summary: Tools to transform the supported formats into other formats
+Group: Applications/Publishing
+License: LGPLv2+
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description tools
+Tools to transform the supported document formats into other formats.
+Supported output formats are XHTML, text and raw.
+
+
+%prep
+%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+
+
+%build
+%configure --disable-static --disable-werror --disable-zip --enable-docs \
+    --with-sharedptr=c++11 CXXFLAGS="$CXXFLAGS -std=c++11"
+sed -i \
+    -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
+    -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
+    libtool
+make %{?_smp_mflags} V=1
+
+
+%install
+make install DESTDIR=%{buildroot}
+rm -f %{buildroot}/%{_libdir}/*.la
+# it seems this tool is only useful on MacOS
+rm -f %{buildroot}/%{_bindir}/mwawFile
+
+
+%post -p /sbin/ldconfig
+
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%doc CHANGES COPYING.* README
+%{_libdir}/%{name}-%{apiversion}.so.*
+
+
+%files devel
+%{_includedir}/%{name}-%{apiversion}
+%{_libdir}/%{name}-%{apiversion}.so
+%{_libdir}/pkgconfig/%{name}-%{apiversion}.pc
+
+
+%files doc
+%doc COPYING.*
+%dir %{_docdir}/%{name}
+%{_docdir}/%{name}/html
+
+
+%files tools
+%{_bindir}/mwaw2html
+%{_bindir}/mwaw2raw
+%{_bindir}/mwaw2text
+
+
+%changelog
+* Sat Apr 27 2013 David Tardon <dtardon at redhat.com> - 0.1.7-2
+- minor fixes
+
+* Tue Mar 19 2013 David Tardon <dtardon at redhat.com> 0.1.7-1
+- initial import
diff --git a/sources b/sources
index e69de29..40ac8b6 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+7c08542921466eee797e0be23e9535b3  libmwaw-0.1.7.tar.bz2


More information about the scm-commits mailing list