[mingw-polyclipping] import from review

sailer sailer at fedoraproject.org
Tue Jan 22 21:20:10 UTC 2013


commit 21e0088a73da836dc0f73c70f3002b12b00ad118
Author: Thomas Sailer <t.sailer at alumni.ethz.ch>
Date:   Tue Jan 22 22:19:53 2013 +0100

    import from review

 .gitignore              |    1 +
 mingw-polyclipping.spec |  133 +++++++++++++++++++++++++++++++++++++++++++++++
 polyclipping.patch      |  123 +++++++++++++++++++++++++++++++++++++++++++
 sources                 |    1 +
 4 files changed, 258 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..4098d89 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/clipper_ver5.0.3.zip
diff --git a/mingw-polyclipping.spec b/mingw-polyclipping.spec
new file mode 100644
index 0000000..8efee84
--- /dev/null
+++ b/mingw-polyclipping.spec
@@ -0,0 +1,133 @@
+# The Clipper C++ crystallographic library already uses the name "clipper".
+# The developer is fine with the choosen name.
+
+# API monitoring
+# http://upstream-tracker.org/versions/clipper.html
+
+%{?mingw_package_header}
+
+%global mingw_pkg_name polyclipping
+
+Name:           mingw-%{mingw_pkg_name}
+Version:        5.0.3
+Release:        3%{?dist}
+Summary:        MinGW Windows Polygon clipping library
+
+Group:          System Environment/Libraries
+License:        Boost
+URL:            http://sourceforge.net/projects/polyclipping
+Source0:        http://downloads.sourceforge.net/%{mingw_pkg_name}/clipper_ver%{version}.zip
+# Add __declspec annotations; make cmake install the import lib as well
+# http://sourceforge.net/p/polyclipping/bugs/62/
+Patch0:         polyclipping.patch
+
+BuildRequires:  mingw32-filesystem
+BuildRequires:  mingw64-filesystem
+BuildRequires:  mingw32-gcc-c++
+BuildRequires:  mingw64-gcc-c++
+BuildRequires:  cmake
+BuildRequires:  dos2unix
+BuildArch:      noarch
+
+%description
+This package contains the MinGW windows port of the clipper polygon
+clipping library.
+
+This library primarily performs the boolean clipping operations -
+intersection, union, difference & xor - on 2D polygons. It also performs
+polygon offsetting. The library handles complex (self-intersecting) polygons,
+polygons with holes and polygons with overlapping co-linear edges.
+Input polygons for clipping can use EvenOdd, NonZero, Positive and Negative
+filling modes. The clipping code is based on the Vatti clipping algorithm,
+and outperforms other clipping libraries.
+
+# Mingw32
+%package -n mingw32-%{mingw_pkg_name}
+Summary:                MinGW Windows Polygon clipping library for the win32 target
+
+%description -n mingw32-%{mingw_pkg_name}
+This package contains the MinGW win32 port of the clipper polygon
+clipping library.
+
+This library primarily performs the boolean clipping operations -
+intersection, union, difference & xor - on 2D polygons. It also performs
+polygon offsetting. The library handles complex (self-intersecting) polygons,
+polygons with holes and polygons with overlapping co-linear edges.
+Input polygons for clipping can use EvenOdd, NonZero, Positive and Negative
+filling modes. The clipping code is based on the Vatti clipping algorithm,
+and outperforms other clipping libraries.
+
+# Mingw64
+%package -n mingw64-%{mingw_pkg_name}
+Summary:                MinGW Windows Polygon clipping library for the win64 target
+
+%description -n mingw64-%{mingw_pkg_name}
+This package contains the MinGW win64 port of the clipper polygon
+clipping library.
+
+This library primarily performs the boolean clipping operations -
+intersection, union, difference & xor - on 2D polygons. It also performs
+polygon offsetting. The library handles complex (self-intersecting) polygons,
+polygons with holes and polygons with overlapping co-linear edges.
+Input polygons for clipping can use EvenOdd, NonZero, Positive and Negative
+filling modes. The clipping code is based on the Vatti clipping algorithm,
+and outperforms other clipping libraries.
+
+%{?mingw_debug_package}
+
+%prep
+%setup -qc
+
+# Delete binaries
+find . \( -name "*.exe" -o -name "*.dll" \) -delete
+
+# Correct line ends and encodings
+find . -type f -exec dos2unix -k {} \;
+
+for filename in perl/perl_readme.txt README; do
+  iconv -f iso8859-1 -t utf-8 "${filename}" > "${filename}".conv && \
+    touch -r "${filename}" "${filename}".conv && \
+    mv "${filename}".conv "${filename}"
+done
+
+%patch0 -p0 -b .mingw
+
+
+%build
+pushd cpp
+  %mingw_cmake
+  %mingw_make %{?_smp_mflags}
+popd
+
+
+%install
+pushd cpp
+  %mingw_make install DESTDIR=%{buildroot}
+popd
+
+%files -n mingw32-%{mingw_pkg_name}
+%doc License.txt README
+%{mingw32_includedir}/*
+%{mingw32_libdir}/libpolyclipping.dll.a
+%{mingw32_bindir}/libpolyclipping.dll
+
+%files -n mingw64-%{mingw_pkg_name}
+%doc License.txt README
+%{mingw64_includedir}/*
+%{mingw64_libdir}/libpolyclipping.dll.a
+%{mingw64_bindir}/libpolyclipping.dll
+
+
+%changelog
+* Sat Jan 19 2013 Thomas Sailer <t.sailer at alumni.ethz.ch> - 5.0.3-3
+- fix summary to contain the correct architecture name
+
+* Sat Jan 19 2013 Thomas Sailer <t.sailer at alumni.ethz.ch> - 5.0.3-2
+- clarify this is the MinGW version in summary and description
+- remove TODO comment
+
+* Fri Jan 18 2013 Thomas Sailer <t.sailer at alumni.ethz.ch> - 5.0.3-1
+- update to 5.0.3
+
+* Thu Jan 10 2013 Thomas Sailer <t.sailer at alumni.ethz.ch> - 4.9.7-1
+- created from native spec file
diff --git a/polyclipping.patch b/polyclipping.patch
new file mode 100644
index 0000000..f89a90b
--- /dev/null
+++ b/polyclipping.patch
@@ -0,0 +1,123 @@
+--- cpp/clipper.hpp.mingw	2013-01-12 07:47:30.000000000 +0100
++++ cpp/clipper.hpp	2013-01-18 22:00:08.918673624 +0100
+@@ -40,6 +40,16 @@
+ #include <cstdlib>
+ #include <ostream>
+ 
++#if defined (_WIN32) 
++  #if defined(polyclipping_EXPORTS)
++    #define  CLIPPER_EXPORT __declspec(dllexport)
++  #else
++    #define  CLIPPER_EXPORT __declspec(dllimport)
++  #endif /* polyclipping_EXPORTS */
++#else /* defined (_WIN32) */
++ #define CLIPPER_EXPORT
++#endif
++
+ namespace ClipperLib {
+ 
+ enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor };
+@@ -53,7 +63,7 @@
+ typedef signed long long long64;
+ typedef unsigned long long ulong64;
+ 
+-struct IntPoint {
++struct CLIPPER_EXPORT IntPoint {
+ public:
+   long64 X;
+   long64 Y;
+@@ -64,10 +74,10 @@
+ typedef std::vector< IntPoint > Polygon;
+ typedef std::vector< Polygon > Polygons;
+ 
+-std::ostream& operator <<(std::ostream &s, Polygon &p);
+-std::ostream& operator <<(std::ostream &s, Polygons &p);
++CLIPPER_EXPORT std::ostream& operator <<(std::ostream &s, Polygon &p);
++CLIPPER_EXPORT std::ostream& operator <<(std::ostream &s, Polygons &p);
+ 
+-struct ExPolygon {
++struct CLIPPER_EXPORT ExPolygon {
+   Polygon  outer;
+   Polygons holes;
+ };
+@@ -75,16 +85,16 @@
+ 
+ enum JoinType { jtSquare, jtRound, jtMiter };
+ 
+-bool Orientation(const Polygon &poly);
+-double Area(const Polygon &poly);
+-void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys,
++CLIPPER_EXPORT bool Orientation(const Polygon &poly);
++CLIPPER_EXPORT double Area(const Polygon &poly);
++CLIPPER_EXPORT void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys,
+   double delta, JoinType jointype = jtSquare, double MiterLimit = 2, bool AutoFix = true);
+-void SimplifyPolygon(const Polygon &in_poly, Polygons &out_polys, PolyFillType fillType = pftEvenOdd);
+-void SimplifyPolygons(const Polygons &in_polys, Polygons &out_polys, PolyFillType fillType = pftEvenOdd);
+-void SimplifyPolygons(Polygons &polys, PolyFillType fillType = pftEvenOdd);
++CLIPPER_EXPORT void SimplifyPolygon(const Polygon &in_poly, Polygons &out_polys, PolyFillType fillType = pftEvenOdd);
++CLIPPER_EXPORT void SimplifyPolygons(const Polygons &in_polys, Polygons &out_polys, PolyFillType fillType = pftEvenOdd);
++CLIPPER_EXPORT void SimplifyPolygons(Polygons &polys, PolyFillType fillType = pftEvenOdd);
+ 
+-void ReversePolygon(Polygon& p);
+-void ReversePolygons(Polygons& p);
++CLIPPER_EXPORT void ReversePolygon(Polygon& p);
++CLIPPER_EXPORT void ReversePolygons(Polygons& p);
+ 
+ //used internally ...
+ enum EdgeSide { esLeft = 1, esRight = 2};
+@@ -177,7 +187,7 @@
+ //ClipperBase is the ancestor to the Clipper class. It should not be
+ //instantiated directly. This class simply abstracts the conversion of sets of
+ //polygon coordinates into edge objects that are stored in a LocalMinima list.
+-class ClipperBase
++class CLIPPER_EXPORT ClipperBase
+ {
+ public:
+   ClipperBase();
+@@ -198,7 +208,7 @@
+   EdgeList          m_edges;
+ };
+ 
+-class Clipper : public virtual ClipperBase
++class CLIPPER_EXPORT Clipper : public virtual ClipperBase
+ {
+ public:
+   Clipper();
+@@ -288,7 +298,7 @@
+ //------------------------------------------------------------------------------
+ //------------------------------------------------------------------------------
+ 
+-class clipperException : public std::exception
++class CLIPPER_EXPORT clipperException : public std::exception
+ {
+   public:
+     clipperException(const char* description): m_descr(description) {}
+--- cpp/CMakeLists.txt.mingw	2012-12-29 06:00:24.000000000 +0100
++++ cpp/CMakeLists.txt	2013-01-19 01:12:08.996004360 +0100
+@@ -1,15 +1,23 @@
+-CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
++CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6)
+ PROJECT(polyclipping)
+ 
++INCLUDE (GenerateExportHeader)
++
+ SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Release type")
+ SET(CMAKE_INSTALL_LIBDIR lib${LIB_SUFFIX})
+ 
+ SET(BUILD_SHARED_LIBS ON CACHE BOOL
+     "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)")
+ ADD_LIBRARY(polyclipping clipper.cpp)
++GENERATE_EXPORT_HEADER(polyclipping
++             BASE_NAME polyclipping
++             EXPORT_MACRO_NAME polyclipping_EXPORT
++             EXPORT_FILE_NAME polyclipping_Export.h
++             STATIC_DEFINE polyclipping_BUILT_AS_STATIC
++)
+ 
+ # The header name clipper.hpp is too generic, so install in a subdirectory
+ INSTALL (FILES clipper.hpp DESTINATION include/polyclipping)
+-INSTALL (TARGETS polyclipping LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
++INSTALL (TARGETS polyclipping ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin)
+ 
+ SET_TARGET_PROPERTIES(polyclipping PROPERTIES VERSION 5.0.0 SOVERSION 5 )
+\ No newline at end of file
diff --git a/sources b/sources
index e69de29..a53a750 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+8509ee63d716e46e88a21ab31b315411  clipper_ver5.0.3.zip


More information about the scm-commits mailing list