[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/212: import/cran: Add generic way to detect needed libraries.
From: |
guix-commits |
Subject: |
06/212: import/cran: Add generic way to detect needed libraries. |
Date: |
Sat, 18 Feb 2023 14:00:44 -0500 (EST) |
rekado pushed a commit to branch master
in repository guix.
commit 049cff91acd3ace275c3f2af97755812af023c6b
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Fri Feb 17 22:25:27 2023 +0100
import/cran: Add generic way to detect needed libraries.
* guix/import/cran.scm (needed-libraries-in-directory): New procedure.
(libraries-pattern, packages-for-matches): New variables.
---
guix/import/cran.scm | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index ebd340ecfa..75caecb620 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -55,6 +55,7 @@
#:use-module (guix ui)
#:use-module (guix upstream)
#:use-module (guix packages)
+ #:use-module (guix sets)
#:use-module (gnu packages)
#:export (%input-style
@@ -475,6 +476,50 @@ the given REGEXP."
zlib linker flag."
(files-match-pattern? dir "-lz" "(Makevars.*|configure.*)"))
+(define packages-for-matches
+ '(("-lcrypto" . "openssl")
+ ("-lcurl" . "curl")
+ ("-lgit2" . "libgit2")
+ ("-lpcre" . "pcre2")
+ ("-lssh" . "openssh")
+ ("-lssl" . "openssl")
+ ("-ltbb" . "tbb")
+ ("-lz" . "zlib")
+ ("gsl-config" . "gsl")
+ ("xml2-config" . "libxml2")
+ ("CURL_LIBS" . "curl")))
+
+(define libraries-pattern
+ (make-regexp
+ (string-append "("
+ (string-join
+ (map (compose regexp-quote first) packages-for-matches) "|")
+ ")")))
+
+(define (needed-libraries-in-directory dir)
+ "Return a list of package names that correspond to libraries that are
+referenced in build system files."
+ (set->list
+ (fold
+ (lambda (file packages)
+ (call-with-input-file file
+ (lambda (port)
+ (let loop ((packages packages))
+ (let ((line (read-line port)))
+ (cond
+ ((eof-object? line) packages)
+ (else
+ (loop
+ (fold (lambda (match acc)
+ (or (and=> (assoc-ref packages-for-matches
+ (match:substring match))
+ (cut set-insert <> acc))
+ acc))
+ packages
+ (list-matches libraries-pattern line))))))))))
+ (set)
+ (find-files dir "(Makevars.in*|configure.*)"))))
+
(define (directory-needs-pkg-config? dir)
"Return #T if any of the Makevars files in the src directory DIR reference
the pkg-config tool."
- branch master updated (b795976778 -> 0ba69c1ee2), guix-commits, 2023/02/18
- 01/212: gnu: r-liger: Rename to r-rliger., guix-commits, 2023/02/18
- 05/212: import/cran: Process all vignette builders., guix-commits, 2023/02/18
- 07/212: import/cran: Remove directory-needs-zlib? in favor of needed-libraries-in-directory., guix-commits, 2023/02/18
- 02/212: gnu: r-readods: Update to 1.8.0., guix-commits, 2023/02/18
- 04/212: import/cran: Add name mapping for libjpeg., guix-commits, 2023/02/18
- 03/212: import/cran: Add directory-needs-esbuild?., guix-commits, 2023/02/18
- 06/212: import/cran: Add generic way to detect needed libraries.,
guix-commits <=
- 08/212: gnu: r-flexdashboard: Update to 0.6.1., guix-commits, 2023/02/18
- 11/212: gnu: Add r-gfonts., guix-commits, 2023/02/18
- 13/212: gnu: r-d3r: Update to 1.0.1., guix-commits, 2023/02/18
- 14/212: gnu: r-wgcna: Update to 1.72-1., guix-commits, 2023/02/18
- 15/212: gnu: r-abn: Update to 2.7-3., guix-commits, 2023/02/18
- 17/212: gnu: r-ggalluvial: Update to 0.12.4., guix-commits, 2023/02/18
- 23/212: gnu: r-mapproj: Update to 1.2.11., guix-commits, 2023/02/18
- 18/212: gnu: r-ggpp: Update to 0.5.1., guix-commits, 2023/02/18
- 28/212: gnu: r-lpsolve: Update to 5.6.18., guix-commits, 2023/02/18
- 12/212: gnu: r-sendmailr: Update to 1.4-0., guix-commits, 2023/02/18