me
/
guix
Archived
1
0
Fork 0

gnu: igraph: Update to 0.10.7.

* gnu/packages/graph.scm (igraph): Update to 0.10.7.
[source]: Use git-fetch. Apply patch.
<snippet>: Remove the entire "vendor" and "src/isomorphism/bliss" directories.
Patch CMakeLists.txt to not build and use vendored dependencies.
[arguments]: Add -DIGRAPH_INTEGER_SIZE=64 to #:configure-flags. Add phases to
use unbundled libraries and build documentation.
[native-inputs]: Add bison, docbook-xml-4.3, docbook-xsl, flex, pcg-c, python,
source-highlight and xmlto.
[inputs]: Remove gmp and libxml2. Add bliss and suitesparse-cxsparse.
* gnu/packages/patches/igraph-fix-varargs-integer-size.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
master
David Elsing 2023-11-01 22:57:15 +00:00 committed by Ludovic Courtès
parent aa4959e602
commit 808f919063
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
3 changed files with 127 additions and 27 deletions

View File

@ -1435,6 +1435,7 @@ dist_patch_DATA = \
%D%/packages/patches/id3lib-CVE-2007-4460.patch \
%D%/packages/patches/id3lib-UTF16-writing-bug.patch \
%D%/packages/patches/idris-test-ffi008.patch \
%D%/packages/patches/igraph-fix-varargs-integer-size.patch \
%D%/packages/patches/igt-gpu-tools-Use-libproc2.patch \
%D%/packages/patches/ilmbase-fix-tests.patch \
%D%/packages/patches/imagemagick-CVE-2020-27829.patch \

View File

@ -10,6 +10,7 @@
;;; Copyright © 2021 Alexandre Hannud Abdo <abdo@member.fsf.org>
;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2022 Marius Bakke <marius@gnu.org>
;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
@ -40,13 +41,18 @@
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
#:use-module (gnu packages bioconductor)
#:use-module (gnu packages bioinformatics)
#:use-module (gnu packages bison)
#:use-module (gnu packages boost)
#:use-module (gnu packages c)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
#:use-module (gnu packages cran)
#:use-module (gnu packages datastructures)
#:use-module (gnu packages docbook)
#:use-module (gnu packages flex)
#:use-module (gnu packages gd)
#:use-module (gnu packages graphics)
#:use-module (gnu packages graphviz)
@ -55,6 +61,7 @@
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages pretty-print)
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
#:use-module (gnu packages python-compression)
@ -93,49 +100,102 @@ distributions in empirical data. SIAM Review 51, 661-703 (2009)}).")
(define-public igraph
(package
(name "igraph")
(version "0.10.4")
(version "0.10.7")
(source
(origin
(method url-fetch)
(uri (string-append "https://github.com/igraph/igraph/releases/"
"download/" version "/igraph-" version ".tar.gz"))
(method git-fetch)
(uri (git-reference
(url "https://github.com/igraph/igraph")
(commit version)))
(file-name (git-file-name name version))
(patches (search-patches "igraph-fix-varargs-integer-size.patch"))
(modules '((guix build utils)
(ice-9 ftw)
(srfi srfi-26)))
(snippet '(begin
;; igraph insists on building its own copy of CxSparse
;; (see: https://github.com/igraph/igraph/commit/\
;; 334318b7dfe46501236272ca336580f4748114b0) and the build
;; has no support to use a system provided 'pcg'.
(define keep-libraries '("cs" "pcg"))
(define keep (append '("." ".." "CMakeLists.txt")
keep-libraries))
(define keep? (cut member <> keep))
(with-directory-excursion "vendor"
(for-each delete-file-recursively
(scandir "." (negate keep?))))
(call-with-output-file "vendor/CMakeLists.txt"
(cut format <> "~{add_subdirectory(~a)~%~}"
keep-libraries))
(delete-file-recursively "vendor")
(delete-file-recursively "src/isomorphism/bliss")
(substitute* '("src/CMakeLists.txt"
"etc/cmake/benchmark_helpers.cmake")
;; Remove extraneous bundling related variables.
((".*_IS_VENDORED.*")
""))))
((".*_IS_VENDORED.*") "")
((".*add_sub.*isomorphism/bliss.*") "")
(("(.*TARGETS.*)bliss(.*)cxsparse_vendored(.*)pcg(.*)"
_ part1 part2 part3 part4)
(string-append part1 part2 part3 part4))
(("cxsparse_vendored") "cxsparse")
((" pcg ") " pcg_random "))
(substitute* "CMakeLists.txt"
(("add_sub.*vendor.*") ""))))
(sha256
(base32 "1z1ay3l1h64jc2igbl2ibvi20sswy56v2yk3ykhis7jzijsh0mxa"))))
(base32
"025f9c2jsawniqkig4l5z3v9aw3ipazmnlsf80b653mns5bvj1yn"))))
(build-system cmake-build-system)
(arguments (list #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON")
#:test-target "check"))
(native-inputs (list pkg-config))
(arguments
(list
#:configure-flags
#~(list "-DBUILD_SHARED_LIBS=ON"
;; Use the same integer width as suitesparse-cxsparse, which
;; uses int64_t in SuiteSparse v6.0.0 and later.
"-DIGRAPH_INTEGER_SIZE=64")
#:test-target "check"
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'version-file
(lambda _
(let ((port (open-file "IGRAPH_VERSION" "w")))
(display #$version port)
(close port))))
(add-after 'unpack 'patch-suitesparse
(lambda _
(substitute* '("src/core/sparsemat.c"
"include/igraph_sparsemat.h")
(("<cs/cs\\.h>") "<cs.h>")
(("cs_igraph") "cs_dl")
(("__BEGIN_DECLS.*" all)
(string-append all "\n#define CS_LONG\n")))))
(add-after 'unpack 'patch-pcg
(lambda _
(substitute* '("src/random/rng_pcg32.c"
"src/random/rng_pcg64.c")
(("#include \"pcg/(.*)\"" _ name)
(string-append "#include <" name ">")))))
(add-after 'unpack 'patch-bliss
(lambda _
(substitute* "src/isomorphism/bliss.cc"
(("#include \"bliss.*")
(string-append
"#include <bliss/graph.hh>\n"
"#include <bliss/digraph.hh>\n")))))
(add-after 'build 'build-doc
(lambda _
(invoke "cmake" "--build" "." "--target" "html")))
(add-after 'install 'install-doc
(lambda _
(copy-recursively
"doc/html"
(string-append #$output "/share/doc/"
#$name "-" #$version "/html")))))))
(native-inputs
(list bison
docbook-xml-4.3
docbook-xsl
flex
pcg-c
pkg-config
;; For the HTML documentation.
python
source-highlight
xmlto))
(inputs
(list arpack-ng
gmp
bliss
glpk
libxml2
lapack
openblas
plfit))
plfit
suitesparse-cxsparse))
;; libxml2 is in the 'Requires.private' of igraph.pc.
(propagated-inputs (list libxml2))
(home-page "https://igraph.org")

View File

@ -0,0 +1,39 @@
If the size of int is different from IGRAPH_INTEGER_SIZE, the integer size
passed to these vararg arguments is different from the assumed one,
leading to undefined behavior.
Submitted upstream: https://github.com/igraph/igraph/pull/2423
diff -ur a/examples/simple/igraph_union.c b/examples/simple/igraph_union.c
--- a/examples/simple/igraph_union.c
+++ b/examples/simple/igraph_union.c
@@ -103,7 +103,7 @@
igraph_vector_ptr_init(&glist, 10);
for (i = 0; i < igraph_vector_ptr_size(&glist); i++) {
VECTOR(glist)[i] = calloc(1, sizeof(igraph_t));
- igraph_vector_int_init_int_end(&v, -1, i, i + 1, 1, 0, -1);
+ igraph_vector_int_init_int_end(&v, -1, (int) i, (int) i + 1, 1, 0, -1);
igraph_create(VECTOR(glist)[i], &v, 0, IGRAPH_DIRECTED);
igraph_vector_int_destroy(&v);
}
@@ -123,7 +123,7 @@
igraph_vector_ptr_init(&glist, 10);
for (i = 0; i < igraph_vector_ptr_size(&glist); i++) {
VECTOR(glist)[i] = calloc(1, sizeof(igraph_t));
- igraph_vector_int_init_int_end(&v, -1, i, i + 1, 1, 0, -1);
+ igraph_vector_int_init_int_end(&v, -1, (int) i, (int) i + 1, 1, 0, -1);
igraph_create(VECTOR(glist)[i], &v, 0, IGRAPH_UNDIRECTED);
igraph_vector_int_destroy(&v);
}
diff -ur a/src/core/matrix.pmt b/src/core/matrix.pmt
--- a/src/core/matrix.pmt
+++ b/src/core/matrix.pmt
@@ -1863,7 +1863,7 @@
#ifdef FPRINTFUNC_ALIGNED
FPRINTFUNC_ALIGNED(file, VECTOR(column_width)[j], MATRIX(*m, i, j));
#else
- fprintf(file, format, VECTOR(column_width)[j], MATRIX(*m, i, j));
+ fprintf(file, format, (int) VECTOR(column_width)[j], MATRIX(*m, i, j));
#endif
}
fprintf(file, "\n");