Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Nov 2024 20:14:29 GMT
From:      Christoph Moench-Tegeder <cmt@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 67cb6c7f956a - main - cad/kicad: unbreak build after 33d6f548e666c89bf3feef18e4c0569eac57adaf
Message-ID:  <202411242014.4AOKETf3028125@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by cmt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=67cb6c7f956a11720434890bba4266f01b93e8d1

commit 67cb6c7f956a11720434890bba4266f01b93e8d1
Author:     Christoph Moench-Tegeder <cmt@FreeBSD.org>
AuthorDate: 2024-11-24 20:12:48 +0000
Commit:     Christoph Moench-Tegeder <cmt@FreeBSD.org>
CommitDate: 2024-11-24 20:12:48 +0000

    cad/kicad: unbreak build after 33d6f548e666c89bf3feef18e4c0569eac57adaf
    
    some hacks to get to get the old KiCAD build with modern boost
---
 cad/kicad/Makefile                                 |  2 -
 .../files/patch-3d-viewer_3d__cache_3d__cache.cpp  | 24 +++++++++++
 cad/kicad/files/patch-common_kiid.cpp              | 47 ++++++++++++++++++++++
 3 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/cad/kicad/Makefile b/cad/kicad/Makefile
index 6cfb1be3d698..664b286d3c7d 100644
--- a/cad/kicad/Makefile
+++ b/cad/kicad/Makefile
@@ -11,8 +11,6 @@ WWW=		https://kicad.org/
 
 LICENSE=	GPLv2
 
-BROKEN=		fails to build with boost-1.86+
-
 BUILD_DEPENDS=	${LOCALBASE}/include/glm/glm.hpp:math/glm	\
 		swig:devel/swig
 LIB_DEPENDS=	libboost_thread.so:devel/boost-libs	\
diff --git a/cad/kicad/files/patch-3d-viewer_3d__cache_3d__cache.cpp b/cad/kicad/files/patch-3d-viewer_3d__cache_3d__cache.cpp
new file mode 100644
index 000000000000..643ed29c8485
--- /dev/null
+++ b/cad/kicad/files/patch-3d-viewer_3d__cache_3d__cache.cpp
@@ -0,0 +1,24 @@
+# this is a terrible hack - you can but should not copy this -- cmt
+--- 3d-viewer/3d_cache/3d_cache.cpp.orig
++++ 3d-viewer/3d_cache/3d_cache.cpp
+@@ -381,14 +381,17 @@
+         dblock.process_bytes( block, bsize );
+ 
+     fclose( fp );
+-    unsigned int digest[5];
+-    dblock.get_digest( digest );
++    union {
++        unsigned int digest[5];
++        unsigned char boost_digest[20];
++    } _digest;
++    dblock.get_digest( _digest.boost_digest );
+ 
+     // ensure MSB order
+     for( int i = 0; i < 5; ++i )
+     {
+         int idx = i << 2;
+-        unsigned int tmp = digest[i];
++        unsigned int tmp = _digest.digest[i];
+         aSHA1Sum[idx+3] = tmp & 0xff;
+         tmp >>= 8;
+         aSHA1Sum[idx+2] = tmp & 0xff;
diff --git a/cad/kicad/files/patch-common_kiid.cpp b/cad/kicad/files/patch-common_kiid.cpp
new file mode 100644
index 000000000000..86b398ae2078
--- /dev/null
+++ b/cad/kicad/files/patch-common_kiid.cpp
@@ -0,0 +1,47 @@
+--- common/kiid.cpp.orig
++++ common/kiid.cpp
+@@ -40,15 +40,15 @@
+ 
+ #include <wx/log.h>
+ 
+-// boost:mt19937 is not thread-safe
++// OBSOLTE: boost:mt19937 is not thread-safe
+ static std::mutex                                           rng_mutex;
+ 
+ // Static rng and generators are used because the overhead of constant seeding is expensive
+ // We rely on the default non-arg constructor of basic_random_generator to provide a random seed.
+ // We use a separate rng object for cases where we want to control the basic_random_generator
+ // initial seed by calling SeedGenerator from unit tests and other special cases.
+-static boost::mt19937                                       rng;
+-static boost::uuids::basic_random_generator<boost::mt19937> randomGenerator;
++static std::mt19937                                       rng;
++static boost::uuids::basic_random_generator<std::mt19937> randomGenerator;
+ 
+ // These don't have the same performance penalty, but we might as well be consistent
+ static boost::uuids::string_generator                       stringGenerator;
+@@ -235,15 +235,7 @@
+ 
+ size_t KIID::Hash() const
+ {
+-    size_t hash = 0;
+-
+-    // Note: this is NOT little-endian/big-endian safe, but as long as it's just used
+-    // at runtime it won't matter.
+-
+-    for( int i = 0; i < 4; ++i )
+-        boost::hash_combine( hash, reinterpret_cast<const uint32_t*>( m_uuid.data )[i] );
+-
+-    return hash;
++    return boost::uuids::hash_value(m_uuid);
+ }
+ 
+ 
+@@ -300,7 +292,7 @@
+ void KIID::SeedGenerator( unsigned int aSeed )
+ {
+     rng.seed( aSeed );
+-    randomGenerator = boost::uuids::basic_random_generator<boost::mt19937>( rng );
++    randomGenerator = boost::uuids::basic_random_generator<std::mt19937>( rng );
+ }
+ 
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202411242014.4AOKETf3028125>