1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/kicad/hotfix-boost-sha1.patch
3 # Copyright (C) 2024 The T2 SDE Project
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 From 9779ee0fd3c8891d80b0a75edc1ce673d7a82b0a Mon Sep 17 00:00:00 2001
15 From: John Beard <john.j.beard@gmail.com>
16 Date: Tue, 10 Sep 2024 12:08:12 +0100
17 Subject: [PATCH] Fix Boost 1.86 SHA1 one last time
19 There's a change in Boost 1.86 that breaks the SHA1 hashing
22 The master KiCad branch ditches SHA1 entirely here, but it's quite
23 an invasive change to backport. So apply a sticking plaster for
26 Relates-To: https://gitlab.archlinux.org/archlinux/packaging/packages/kicad/-/issues/1
28 3d-viewer/3d_cache/3d_cache.cpp | 8 +++++++-
29 1 file changed, 7 insertions(+), 1 deletion(-)
31 diff --git a/3d-viewer/3d_cache/3d_cache.cpp b/3d-viewer/3d_cache/3d_cache.cpp
32 index 33c04d0fffd..72dd50d734e 100644
33 --- a/3d-viewer/3d_cache/3d_cache.cpp
34 +++ b/3d-viewer/3d_cache/3d_cache.cpp
35 @@ -381,7 +381,13 @@ bool S3D_CACHE::getSHA1( const wxString& aFileName, unsigned char* aSHA1Sum )
38 unsigned int digest[5];
39 - dblock.get_digest( digest );
41 + // Boost 1.86 and later changed digest_type from uchar[20] from int[5]
42 + // But KiCad 8.99 and later use MurmurHash3 here, so just do a fairly ugly cast to keep
43 + // this going for another few months.
44 + static_assert( sizeof( digest ) == sizeof( boost::uuids::detail::sha1::digest_type& ),
45 + "SHA1 digest size mismatch" );
46 + dblock.get_digest( reinterpret_cast<boost::uuids::detail::sha1::digest_type&>( digest ) );
49 for( int i = 0; i < 5; ++i )
53 From 9fdd825681fb5c639470f8a68f1bf4cf73cc5cd1 Mon Sep 17 00:00:00 2001
54 From: John Beard <john.j.beard@gmail.com>
55 Date: Sat, 7 Sep 2024 16:13:42 +0100
56 Subject: [PATCH] KIID: Use Boost uuids own hash function (fix Boost 1.86)
58 Not only is this simpler, but it should be compatible
59 with all Boost versions (the cast is a problem in 1.86)
60 and it was also 'improved' in 1.86 for better mixing.
62 Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18651
63 (cherry picked from commit 9a3ebfba404e43d82b5c194e01f6afb67909bf88)
65 common/kiid.cpp | 11 +----------
66 1 file changed, 1 insertion(+), 10 deletions(-)
68 diff --git a/common/kiid.cpp b/common/kiid.cpp
69 index 80aea3e55da..81266cbd226 100644
73 #include <boost/random/mersenne_twister.hpp>
74 #include <boost/uuid/uuid_generators.hpp>
75 #include <boost/uuid/uuid_io.hpp>
76 -#include <boost/functional/hash.hpp>
78 #if BOOST_VERSION >= 106700
79 #include <boost/uuid/entropy_error.hpp>
80 @@ -236,15 +235,7 @@ timestamp_t KIID::AsLegacyTimestamp() const
82 size_t KIID::Hash() const
86 - // Note: this is NOT little-endian/big-endian safe, but as long as it's just used
87 - // at runtime it won't matter.
89 - for( int i = 0; i < 4; ++i )
90 - boost::hash_combine( hash, reinterpret_cast<const uint32_t*>( m_uuid.data )[i] );
93 + return boost::uuids::hash_value( m_uuid );
100 From f4f9513f808fae515acf8253269a4eec9a667cd5 Mon Sep 17 00:00:00 2001
101 From: Ian McInerney <ian.s.mcinerney@ieee.org>
102 Date: Tue, 27 Aug 2024 11:49:28 +0100
103 Subject: [PATCH] Fix compilation with Boost 1.86
105 Boost 1.86 removed the boost::random dependency from boost::uuid, so
106 we need to include those headers on our own now to use the random
107 mersenne twister implementation.
109 (cherry picked from commit a9e115925a5168034f60d0fe1e7b369861f84b82)
111 common/kiid.cpp | 1 +
112 1 file changed, 1 insertion(+)
114 diff --git a/common/kiid.cpp b/common/kiid.cpp
115 index 4c7e8eb18cd..80aea3e55da 100644
116 --- a/common/kiid.cpp
117 +++ b/common/kiid.cpp
122 +#include <boost/random/mersenne_twister.hpp>
123 #include <boost/uuid/uuid_generators.hpp>
124 #include <boost/uuid/uuid_io.hpp>
125 #include <boost/functional/hash.hpp>