From patchwork Wed Nov 1 22:57:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Elsing X-Patchwork-Id: 55811 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id ACACB27BBE9; Wed, 1 Nov 2023 22:58:56 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 45A0B27BBE2 for ; Wed, 1 Nov 2023 22:58:51 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyKAQ-0002yb-5J; Wed, 01 Nov 2023 18:58:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qyKAO-0002yD-5Z for guix-patches@gnu.org; Wed, 01 Nov 2023 18:58:28 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyKAN-0002en-Tg for guix-patches@gnu.org; Wed, 01 Nov 2023 18:58:27 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qyKAw-00008n-3z for guix-patches@gnu.org; Wed, 01 Nov 2023 18:59:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66889] [PATCH 2/2] gnu: igraph: Update to 0.10.7. Resent-From: David Elsing Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 01 Nov 2023 22:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66889 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66889@debbugs.gnu.org Cc: David Elsing Received: via spool by 66889-submit@debbugs.gnu.org id=B66889.1698879505464 (code B ref 66889); Wed, 01 Nov 2023 22:59:02 +0000 Received: (at 66889) by debbugs.gnu.org; 1 Nov 2023 22:58:25 +0000 Received: from localhost ([127.0.0.1]:53489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyKAK-00007P-IF for submit@debbugs.gnu.org; Wed, 01 Nov 2023 18:58:25 -0400 Received: from mout02.posteo.de ([185.67.36.66]:59571) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyKAF-00006p-LK for 66889@debbugs.gnu.org; Wed, 01 Nov 2023 18:58:22 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 2FA15240103 for <66889@debbugs.gnu.org>; Wed, 1 Nov 2023 23:57:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1698879459; bh=/o4UVs12vFUhemdeuf+kMxTXwYh4YLKdZLQv26RJhN8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=PBhytQ4l+zMeCRfF98TGPACfYp89P7YAVOygO0yAsRPu5T7coliQmjY0RkzzBce7Q Xx5jLzLq5BMRA0GLed2jSnGOf2ELV5bqg6QcArHzL0pvbA4iQAP5G+GuRbWxUK+9IX wcHs4StyDJatddtI3Al5TqKAmYpleO2dDes6mjsQFZI01M4eVZ6LFXe0kosvNAMr12 bublsh3+xrjowh2pjdSTTlrEfDj2zgCGueHRM0fgqm9LJ6Pmj+RXme0npDxWsQh4yg MM5pjr9mmXeCXaktBa1MhL/PjjVyr12qEsHrsWQTZxCD/bi+pCs1+Yh3FTpGRAV9Nz 4vDbKikmB12Rg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SLMpp3s7qz9rxG; Wed, 1 Nov 2023 23:57:38 +0100 (CET) From: David Elsing Date: Wed, 1 Nov 2023 22:57:15 +0000 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/graph.scm (igraph): Update to 0.10.7. [source]: Use git-fetch. Apply patch. : 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. --- gnu/local.mk | 1 + gnu/packages/graph.scm | 114 +++++++++++++----- .../igraph-fix-varargs-integer-size.patch | 39 ++++++ 3 files changed, 127 insertions(+), 27 deletions(-) create mode 100644 gnu/packages/patches/igraph-fix-varargs-integer-size.patch diff --git a/gnu/local.mk b/gnu/local.mk index 8d817379a7..b51d9d15e8 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1428,6 +1428,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 \ diff --git a/gnu/packages/graph.scm b/gnu/packages/graph.scm index 45a591b9f3..a40b580417 100644 --- a/gnu/packages/graph.scm +++ b/gnu/packages/graph.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2021 Alexandre Hannud Abdo ;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer ;;; Copyright © 2022 Marius Bakke +;;; Copyright © 2023 David Elsing ;;; ;;; This file is part of GNU Guix. ;;; @@ -40,13 +41,18 @@ (define-module (gnu packages graph) #: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 @@ (define-module (gnu packages graph) #: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 @@ (define-public plfit (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_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 \n" + "#include \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") diff --git a/gnu/packages/patches/igraph-fix-varargs-integer-size.patch b/gnu/packages/patches/igraph-fix-varargs-integer-size.patch new file mode 100644 index 0000000000..2d7ffd7e68 --- /dev/null +++ b/gnu/packages/patches/igraph-fix-varargs-integer-size.patch @@ -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");