summary refs log tree commit diff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2017-04-05 18:42:08 +0200
committerRicardo Wurmus <rekado@elephly.net>2017-05-16 21:43:35 +0200
commit17a69cf623ed71c3373a5baad92f1a47321cc735 (patch)
treea7d6e4f188a1c2e0030373c6f323fcd30a795043
parenta0f43208cb424306a79fa74690b0f2075c7c35b2 (diff)
downloadguix-17a69cf623ed71c3373a5baad92f1a47321cc735.tar.gz
import cran: Check if pkg-config is needed.
* guix/import/cran.scm (needs-pkg-config?): New procedure.
(description->package): Use it.
-rw-r--r--guix/import/cran.scm18
1 files changed, 13 insertions, 5 deletions
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index db72feba80..8d963a7475 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -235,6 +235,13 @@ contain a zlib linker flag."
    tarball "-lz"
    "*/src/Makevars*" "*/src/configure*" "*/configure*"))
 
+(define (needs-pkg-config? tarball)
+  "Return #T if any of the Makevars files in the src directory of the TARBALL
+reference the pkg-config tool."
+  (tarball-files-match-pattern?
+   tarball "pkg-config"
+   "*/src/Makevars*" "*/src/configure*" "*/configure*"))
+
 (define (description->package repository meta)
   "Return the `package' s-expression for an R package published on REPOSITORY
 from the alist META, which was derived from the R package's DESCRIPTION file."
@@ -284,11 +291,12 @@ from the alist META, which was derived from the R package's DESCRIPTION file."
         (build-system r-build-system)
         ,@(maybe-inputs sysdepends)
         ,@(maybe-inputs (map guix-name propagate) 'propagated-inputs)
-        ,@(if (needs-fortran? tarball)
-              `((native-inputs (,'quasiquote
-                                ,(list "gfortran"
-                                       (list 'unquote 'gfortran)))))
-              '())
+        ,@(maybe-inputs
+           `(,@(if (needs-fortran? tarball)
+                   '("gfortran") '())
+             ,@(if (needs-pkg-config? tarball)
+                   '("pkg-config") '()))
+           'native-inputs)
         (home-page ,(if (string-null? home-page)
                         (string-append base-url name)
                         home-page))