[sfcgal] 01/01: Add patch by Sebastien Loriot to fix FTBFS with CGAL 4.11. (closes: #876521)

Bas Couwenberg sebastic at debian.org
Thu Mar 15 13:59:02 UTC 2018


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository sfcgal.

commit bb5593c81551058051fc3703d1be6b5ad52f17ba
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Thu Mar 15 14:24:08 2018 +0100

    Add patch by Sebastien Loriot to fix FTBFS with CGAL 4.11. (closes: #876521)
---
 debian/changelog                              |   2 +
 debian/patches/Compatibility-with-gmpxx.patch | 159 ++++++++++++++++++++++++++
 debian/patches/series                         |   1 +
 3 files changed, 162 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 304d312..a2d27f6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ sfcgal (1.3.2-1) UNRELEASED; urgency=medium
   * Add patch by Pierre-Eric Pelloux-Prayer to fix FTBFS with CGAL 4.11.
     (closes: #876521)
   * Update copyright-format URL to use HTTPS.
+  * Add patch by Sebastien Loriot to fix FTBFS with CGAL 4.11.
+    (closes: #876521)
 
  -- Bas Couwenberg <sebastic at debian.org>  Fri, 15 Sep 2017 20:49:16 +0200
 
diff --git a/debian/patches/Compatibility-with-gmpxx.patch b/debian/patches/Compatibility-with-gmpxx.patch
new file mode 100644
index 0000000..131d612
--- /dev/null
+++ b/debian/patches/Compatibility-with-gmpxx.patch
@@ -0,0 +1,159 @@
+Description: compatibility with gmpxx
+Author: =?UTF-8?q?S=C3=A9bastien=20Loriot?= <sebastien.loriot at cgal.org>
+Origin: https://github.com/Oslandia/SFCGAL/pull/157/commits/644a289a9fa88327334447a42adf225922613324
+Bug: https://github.com/Oslandia/SFCGAL/issues/145
+Bug-Debian: https://bugs.debian.org/876521
+
+--- a/src/detail/io/Serialization.cpp
++++ b/src/detail/io/Serialization.cpp
+@@ -169,5 +169,53 @@ void load( boost::archive::binary_iarchi
+     }
+ }
+ 
++#ifdef CGAL_USE_GMPXX
++void save( boost::archive::text_oarchive& ar, const mpz_class& z, const unsigned int /*version*/ )
++{
++    std::ostringstream ostr;
++    ostr << z;
++    std::string str = ostr.str();
++    ar << str;
++}
++
++// specialization for binary archives
++void save ( boost::archive::binary_oarchive& ar, const mpz_class& z, const unsigned int/* version*/ )
++{
++    mpz_srcptr mpz = z.get_mpz_t();
++    int32_t size = mpz->_mp_size;
++    ar& size;
++    uint32_t rsize = size >= 0 ? size : -size;
++
++    for ( uint32_t i = 0; i < rsize; ++i ) {
++        ar& mpz->_mp_d[i];
++    }
++}
++
++
++void load( boost::archive::text_iarchive& ar, mpz_class& z, const unsigned int /*version*/ )
++{
++    std::string line;
++    ar >> line;
++    std::istringstream istr( line );
++    istr >> z;
++}
++
++void load( boost::archive::binary_iarchive& ar, mpz_class& z, const unsigned int /*version*/ )
++{
++    int32_t size;
++    uint32_t rsize;
++    mpz_ptr mpz = z.get_mpz_t();
++    ar& size;
++    rsize = size >= 0 ? size : -size;
++    mpz->_mp_size = size;
++    _mpz_realloc( mpz, rsize );
++    uint32_t i;
++
++    for ( i = 0; i < rsize; ++i ) {
++        ar& mpz->_mp_d[i];
++    }
++}
++#endif
++
+ }
+ }
+--- a/src/detail/io/Serialization.h
++++ b/src/detail/io/Serialization.h
+@@ -34,6 +34,10 @@
+ #include <boost/archive/binary_iarchive.hpp>
+ #include <boost/archive/text_oarchive.hpp>
+ #include <boost/archive/text_iarchive.hpp>
++#ifdef CGAL_USE_GMPXX
++#include <CGAL/mpz_class.h>
++#include <CGAL/mpq_class.h>
++#endif
+ 
+ namespace SFCGAL {
+ 
+@@ -132,6 +136,63 @@ void serialize( Archive& ar, CGAL::Gmpq&
+     split_free( ar, q, version );
+ }
+ 
++#ifdef CGAL_USE_GMPXX
++/**
++ * Serialization of mpz_class for text archives
++ */
++SFCGAL_API void save( boost::archive::text_oarchive& ar, const mpz_class& z, const unsigned int version );
++
++/**
++ * Serialization of mpz_class for binary archives
++ */
++SFCGAL_API void save ( boost::archive::binary_oarchive& ar, const mpz_class& z, const unsigned int version );
++
++/**
++ * Unserialization of mpz_class for text archives
++ */
++SFCGAL_API void load( boost::archive::text_iarchive& ar, mpz_class& z, const unsigned int version );
++
++/**
++ * Unserialization of mpz_class for binary archives
++ */
++SFCGAL_API void load( boost::archive::binary_iarchive& ar, mpz_class& z, const unsigned int version );
++
++template<class Archive>
++void serialize( Archive& ar, mpz_class& z, const unsigned int version )
++{
++    split_free( ar, z, version );
++}
++
++/**
++ * Serializer of mpq_class
++ */
++template<class Archive>
++void save( Archive& ar, const mpq_class& q, const unsigned int /*version*/ )
++{
++    mpz_class n = q.get_num();
++    mpz_class d = q.get_den();
++    ar& n;
++    ar& d;
++}
++
++/**
++ * Unserializer of mpq_class
++ */
++template<class Archive>
++void load( Archive& ar, mpq_class& q, const unsigned int /*version*/ )
++{
++    mpz_class n;
++    mpz_class d;
++    ar& n;
++    ar& d;
++    q = mpq_class( n, d );
++}
++template<class Archive>
++void serialize( Archive& ar, mpq_class& q, const unsigned int version )
++{
++    split_free( ar, q, version );
++}
++#endif
+ 
+ /**
+  * Serializer of Kernel::FT
+--- a/src/detail/io/WktReader.cpp
++++ b/src/detail/io/WktReader.cpp
+@@ -647,7 +647,7 @@ bool WktReader::readPointCoordinate( Poi
+         }
+ 
+         p = Point( coordinates[0], coordinates[1], coordinates[2] );
+-        p.setM( coordinates[3].to_double() );
++        p.setM( CGAL::to_double(coordinates[3]) );
+     }
+     else if ( _isMeasured && ! _is3D ) {
+         // XYM
+@@ -656,7 +656,7 @@ bool WktReader::readPointCoordinate( Poi
+         }
+ 
+         p = Point( coordinates[0], coordinates[1] );
+-        p.setM( coordinates[2].to_double() );
++        p.setM( CGAL::to_double(coordinates[2]) );
+     }
+     else if ( coordinates.size() == 3 ) {
+         // XYZ
diff --git a/debian/patches/series b/debian/patches/series
index bf10af7..39187ef 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 no-matching-function-call.patch
+Compatibility-with-gmpxx.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/sfcgal.git



More information about the Pkg-grass-devel mailing list