mirror of
https://gitlab.univ-nantes.fr/glicid-public/guix-glicid.git
synced 2025-04-30 06:08:37 +02:00
170 lines
7.7 KiB
Scheme
170 lines
7.7 KiB
Scheme
|
(define-module (glicid packages r)
|
||
|
#:use-module (guix build-system gnu)
|
||
|
#:use-module (guix download)
|
||
|
#:use-module ((guix licenses) #:prefix license:)
|
||
|
#:use-module (guix packages)
|
||
|
#:use-module (guix utils)
|
||
|
#:use-module (gnu packages base)
|
||
|
#:use-module (gnu packages bash)
|
||
|
#:use-module (gnu packages compression)
|
||
|
#:use-module (gnu packages curl)
|
||
|
#:use-module (gnu packages gcc)
|
||
|
#:use-module (gnu packages gtk)
|
||
|
#:use-module (gnu packages icu4c)
|
||
|
#:use-module (gnu packages image)
|
||
|
#:use-module (gnu packages maths)
|
||
|
#:use-module (gnu packages pcre)
|
||
|
#:use-module (gnu packages perl)
|
||
|
#:use-module (gnu packages pkg-config)
|
||
|
#:use-module (gnu packages readline)
|
||
|
#:use-module (gnu packages statistics)
|
||
|
#:use-module (gnu packages tcl)
|
||
|
#:use-module (gnu packages tex)
|
||
|
#:use-module (gnu packages texinfo)
|
||
|
#:use-module (gnu packages xorg)
|
||
|
#:use-module (glicid packages gcc)
|
||
|
#:use-module (guix build-system gnu)
|
||
|
)
|
||
|
|
||
|
; stolen from r-with-tests @ (gnu packages statistics
|
||
|
(define R
|
||
|
(package
|
||
|
(name "R")
|
||
|
(version "4.3.1")
|
||
|
(source (origin
|
||
|
(method url-fetch)
|
||
|
(uri (string-append "mirror://cran/src/base/R-"
|
||
|
(version-major version) "/R-"
|
||
|
version ".tar.gz"))
|
||
|
(sha256
|
||
|
(base32
|
||
|
"16dswjcymzr2mj1vjwqdyjaa9d4isa1p6c9viihnyg02y4jbzl4d"))))
|
||
|
(build-system gnu-build-system)
|
||
|
(arguments
|
||
|
`(#:disallowed-references (,tzdata-for-tests)
|
||
|
#:make-flags
|
||
|
(list (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib/R/lib")
|
||
|
"PKG_BUILT_STAMP=1970-01-01")
|
||
|
#:phases
|
||
|
(modify-phases %standard-phases
|
||
|
(add-before 'configure 'do-not-compress-serialized-files
|
||
|
(lambda* (#:key inputs #:allow-other-keys)
|
||
|
(substitute* "src/library/base/makebasedb.R"
|
||
|
(("compress = TRUE") "compress = FALSE"))))
|
||
|
(add-before 'configure 'patch-coreutils-paths
|
||
|
(lambda* (#:key inputs #:allow-other-keys)
|
||
|
(let ((uname-bin (search-input-file inputs "/bin/uname"))
|
||
|
(rm-bin (search-input-file inputs "/bin/rm")))
|
||
|
(substitute* "src/scripts/R.sh.in"
|
||
|
(("uname") uname-bin))
|
||
|
(substitute* "src/unix/sys-std.c"
|
||
|
(("rm -Rf ") (string-append rm-bin " -Rf ")))
|
||
|
(substitute* "src/library/parallel/R/detectCores.R"
|
||
|
(("'grep")
|
||
|
(string-append "'" (search-input-file inputs "/bin/grep")))
|
||
|
(("\\| wc -l")
|
||
|
(string-append "| " (search-input-file inputs "/bin/wc") " -l"))))))
|
||
|
(add-after 'unpack 'patch-tests
|
||
|
(lambda _
|
||
|
(substitute* "src/unix/sys-unix.c"
|
||
|
(("\"/bin/sh\"")
|
||
|
(string-append "\"" (which "sh") "\"")))
|
||
|
(substitute* "tests/reg-packages.R"
|
||
|
(("8 <= print" m) (string-append "## " m)))))
|
||
|
(add-after 'unpack 'build-reproducibly
|
||
|
(lambda _
|
||
|
(substitute* "src/library/tools/man/Rd2HTML.Rd"
|
||
|
(("\\\\%Y-\\\\%m-\\\\%d at \\\\%H:\\\\%M:\\\\%S")
|
||
|
"(removed for reproducibility)"))
|
||
|
(substitute* "src/library/methods/R/trace.R"
|
||
|
(("dateCreated = Sys.time\\(\\)")
|
||
|
"dateCreated = as.POSIXct(\"1970-1-1 00:00:00\", tz = \"UTC\")"))
|
||
|
(substitute* '("src/library/grDevices/Makefile.in"
|
||
|
"doc/manual/Makefile.in")
|
||
|
(("R_GZIPCMD\\)" line)
|
||
|
(string-append line " -n")))
|
||
|
(substitute* "src/library/base/R/srcfile.R"
|
||
|
(("timestamp <- (timestamp.*|file.mtime.*)" _ time)
|
||
|
(string-append "timestamp <- \
|
||
|
as.POSIXct(if (\"\" != Sys.getenv(\"SOURCE_DATE_EPOCH\")) {\
|
||
|
as.numeric(Sys.getenv(\"SOURCE_DATE_EPOCH\"))\
|
||
|
} else { " time "}, origin=\"1970-01-01\")\n")))
|
||
|
(substitute* "src/library/tools/Makefile.in"
|
||
|
(("(install_package_description\\(.*\"')\\)\"" line prefix)
|
||
|
(string-append prefix ", builtStamp='1970-01-01')\"")))
|
||
|
|
||
|
(substitute* "src/library/Recommended/Makefile.in"
|
||
|
(("INSTALL_OPTS =" m)
|
||
|
(string-append m " --built-timestamp=1970-01-01" m)))
|
||
|
(with-fluids ((%default-port-encoding "ISO-8859-1"))
|
||
|
(substitute* "tools/help2man.pl"
|
||
|
(("my \\$date = strftime \"%B %Y\", localtime" line)
|
||
|
(string-append line " 1"))))
|
||
|
(substitute* "src/library/methods/DESCRIPTION.in"
|
||
|
(("\\(2008\\)\n") "(2008) ")
|
||
|
((" ``Software") "``Software")
|
||
|
(("Data Analysis:.") "Data Analysis:\n")
|
||
|
(("Programming with R") " Programming with R"))
|
||
|
(substitute* "src/library/tools/DESCRIPTION.in"
|
||
|
(("codetools, methods, xml2, curl, commonmark, knitr, xfun, mathjaxr")
|
||
|
"codetools, methods, xml2, curl, commonmark,
|
||
|
knitr, xfun, mathjaxr"))))
|
||
|
(add-before 'build 'set-locales
|
||
|
(lambda _
|
||
|
(setlocale LC_ALL "C")
|
||
|
(setenv "LC_ALL" "C")))
|
||
|
(add-before 'configure 'set-default-pager
|
||
|
(lambda _ (setenv "PAGER" "cat")))
|
||
|
(add-before 'configure 'set-timezone
|
||
|
(lambda* (#:key inputs #:allow-other-keys)
|
||
|
(setenv "TZ" "UTC+1")
|
||
|
(setenv "TZDIR"
|
||
|
(search-input-directory inputs
|
||
|
"share/zoneinfo"))))
|
||
|
(add-before 'check 'set-home
|
||
|
(lambda _ (setenv "HOME" "/tmp")))
|
||
|
(add-after 'build 'make-info
|
||
|
(lambda _ (invoke "make" "info")))
|
||
|
(add-after 'build 'install-info
|
||
|
(lambda _ (invoke "make" "install-info"))))
|
||
|
#:configure-flags
|
||
|
`(
|
||
|
"--with-cairo"
|
||
|
"--with-blas=-lopenblas"
|
||
|
"--with-libpng"
|
||
|
"--with-jpeglib"
|
||
|
"--with-libtiff"
|
||
|
"--with-ICU"
|
||
|
"--with-tcltk"
|
||
|
,(string-append "--with-tcl-config="
|
||
|
(assoc-ref %build-inputs "tcl")
|
||
|
"/lib/tclConfig.sh")
|
||
|
,(string-append "--with-tk-config="
|
||
|
(assoc-ref %build-inputs "tk")
|
||
|
"/lib/tkConfig.sh")
|
||
|
"--enable-R-shlib"
|
||
|
"--enable-BLAS-shlib"
|
||
|
"--with-system-tre")))
|
||
|
(native-inputs
|
||
|
(list bzip2 perl pkg-config texinfo
|
||
|
(texlive-updmap.cfg
|
||
|
(list texlive-fancyvrb texlive-inconsolata texlive-upquote texlive-xkeyval))
|
||
|
tzdata-for-tests xz))
|
||
|
(inputs
|
||
|
(list coreutils curl openblas gfortran grep icu4c libjpeg-turbo libpng libtiff libxt
|
||
|
pango pcre2 readline tcl tk which zlib bash-minimal))
|
||
|
(native-search-paths
|
||
|
(list (search-path-specification
|
||
|
(variable "R_LIBS_SITE")
|
||
|
(files (list "site-library/")))))
|
||
|
(home-page "https://www.r-project.org/")
|
||
|
(synopsis "Environment for statistical computing and graphics")
|
||
|
(description
|
||
|
"R is a language and environment for statistical computing and graphics.
|
||
|
It provides a variety of statistical techniques, such as linear and nonlinear
|
||
|
modeling, classical statistical tests, time-series analysis, classification
|
||
|
and clustering. It also provides robust support for producing
|
||
|
publication-quality data plots. A large amount of 3rd-party packages are
|
||
|
available, greatly increasing its breadth and scope.")
|
||
|
(license license:gpl3+)))
|