commit:     37bd1334b41213813cb38acf46c98b1f80c5fd15
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Mon Mar 11 04:00:26 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Mar 11 14:22:51 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37bd1334

dev-libs/igraph: add 0.10.10

Include backported patch from upstream which fixes strict-aliasing
violations.

Closes: https://bugs.gentoo.org/924864
Closes: https://bugs.gentoo.org/925227
Closes: https://bugs.gentoo.org/921172
Signed-off-by: Eli Schwartz <eschwartz93 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/igraph/Manifest                           |  1 +
 .../808c083fbe661207ee8f0fcd3be5096b5dc17d0d.patch | 35 ++++++++++++++
 dev-libs/igraph/igraph-0.10.10.ebuild              | 53 ++++++++++++++++++++++
 3 files changed, 89 insertions(+)

diff --git a/dev-libs/igraph/Manifest b/dev-libs/igraph/Manifest
index 66b81a40a784..a03b857e7f2b 100644
--- a/dev-libs/igraph/Manifest
+++ b/dev-libs/igraph/Manifest
@@ -1 +1,2 @@
+DIST igraph-0.10.10.tar.gz 4336247 BLAKE2B 
cef87afe544d09446c999894c44e1d56120cac74b6af5d749835fbf60e5ae0f1676d6754e084f167d23718c6ce9f7b8cee159d3d670d1d5f1f495775c7b0d2f0
 SHA512 
d4b8d29f9c39f8390c442877183e64c442fccbc6a02b3aed5c1d8871ca5998d1a168f392f8dde26a8c3593ed6c09a66a200ac1155fbde87d368b101011bb122c
 DIST igraph-0.10.4.tar.gz 4279321 BLAKE2B 
4e1fc8e8d6dd38cdb24ec564f51f2924e457376c258497b51d7dd4cec88d2226d5b202cdcfa69560e43fdb3cbd49656511178acd2ed705b4af26b1947a92f1ab
 SHA512 
71bcec5f0ba100aae7614753f9232a4221580b822b4dc120e3a80eab59d70c42aedddb00728eb13faf7e522332c514c2e030314c416ded8a70e5de990ea8039b

diff --git 
a/dev-libs/igraph/files/808c083fbe661207ee8f0fcd3be5096b5dc17d0d.patch 
b/dev-libs/igraph/files/808c083fbe661207ee8f0fcd3be5096b5dc17d0d.patch
new file mode 100644
index 000000000000..4bf0f2c6c3a9
--- /dev/null
+++ b/dev-libs/igraph/files/808c083fbe661207ee8f0fcd3be5096b5dc17d0d.patch
@@ -0,0 +1,35 @@
+From 808c083fbe661207ee8f0fcd3be5096b5dc17d0d Mon Sep 17 00:00:00 2001
+From: David Seifert <[email protected]>
+Date: Tue, 5 Mar 2024 14:54:46 +0100
+Subject: [PATCH] Fix `-Wstrict-aliasing`
+
+* Casting a `uint64_t*` to `double*` invokes undefined behavior, since
+  it violates the strict aliasing rules of ISO C. Instead of casting
+  pointers, let's read through a union which is supported by C and
+  yields the same performant assembly code.
+
+Closes: https://bugs.gentoo.org/924864
+---
+ src/random/random.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/src/random/random.c b/src/random/random.c
+index 8f2d0898aa..b5b44451ae 100644
+--- a/src/random/random.c
++++ b/src/random/random.c
+@@ -681,8 +681,13 @@ igraph_real_t igraph_rng_get_unif01(igraph_rng_t *rng) {
+          * Then we subtract 1 to arrive at the [0; 1) interval. This is fast
+          * but we lose one bit of precision as there are 2^53 possible doubles
+          * between 0 and 1. */
+-        uint64_t r = (igraph_i_rng_get_random_bits_uint64(rng, 52) & 
0xFFFFFFFFFFFFFull) | 0x3FF0000000000000ull;
+-        return *(double *)(&r) - 1.0;
++        union {
++            uint64_t as_uint64_t;
++            double as_double;
++        } value;
++        value.as_uint64_t =
++            (igraph_i_rng_get_random_bits_uint64(rng, 52) & 
0xFFFFFFFFFFFFFull) | 0x3FF0000000000000ull;
++        return value.as_double - 1.0;
+     }
+ }
+ 

diff --git a/dev-libs/igraph/igraph-0.10.10.ebuild 
b/dev-libs/igraph/igraph-0.10.10.ebuild
new file mode 100644
index 000000000000..f270109ee806
--- /dev/null
+++ b/dev-libs/igraph/igraph-0.10.10.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+DESCRIPTION="Creating and manipulating undirected and directed graphs"
+HOMEPAGE="https://igraph.org/";
+SRC_URI="https://github.com/igraph/igraph/releases/download/${PV}/${P}.tar.gz";
+
+LICENSE="GPL-2"
+SLOT="0/0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="debug test threads"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       dev-libs/gmp:0=
+       dev-libs/libxml2
+       sci-libs/arpack
+       sci-mathematics/glpk:=
+       sci-mathematics/plfit
+       virtual/blas
+       virtual/lapack"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+       # backport fix for strict-aliasing
+       "${FILESDIR}"/808c083fbe661207ee8f0fcd3be5096b5dc17d0d.patch
+)
+
+src_configure() {
+       local mycmakeargs=(
+               -DUSE_CCACHE=OFF
+               -DIGRAPH_GLPK_SUPPORT=ON
+               -DIGRAPH_GRAPHML_SUPPORT=ON
+               -DIGRAPH_USE_INTERNAL_ARPACK=OFF
+               -DIGRAPH_USE_INTERNAL_BLAS=OFF
+               -DIGRAPH_USE_INTERNAL_GLPK=OFF
+               -DIGRAPH_USE_INTERNAL_GMP=OFF
+               -DIGRAPH_USE_INTERNAL_LAPACK=OFF
+               -DIGRAPH_USE_INTERNAL_PLFIT=OFF
+               -DIGRAPH_ENABLE_TLS=$(usex threads)
+               -DBUILD_TESTING=$(usex test)
+       )
+       cmake_src_configure
+}
+
+src_test() {
+       cmake_build check
+}

Reply via email to