guix_mirror_bot pushed a commit to branch r-team
in repository guix.
commit 03ed8fd4a36d99f4da37d0220e7a860e6014a541
Author: Ricardo Wurmus <[email protected]>
AuthorDate: Tue Nov 11 13:25:15 2025 +0100
gnu: r-sdmtools: Replace removed constants.
R 4.5.0 removed previously deprecated definitions.
* gnu/packages/cran.scm (r-sdmtools)[arguments]: Add phase 'patch-constants.
Change-Id: I06125aeff8b7b1f219f8458b6c9aeeb696e33f11
---
gnu/packages/cran.scm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm
index 40d65dbbaa..d0dbbe6afc 100644
--- a/gnu/packages/cran.scm
+++ b/gnu/packages/cran.scm
@@ -19674,6 +19674,22 @@ normalizations, minimum variance matching, and so on.")
"1xvcd97ikqsfdpk2fddy3k0z1ajqga7nv9bgac9c1wnjk1gqrpgh"))))
(properties `((upstream-name . "SDMTools")))
(build-system r-build-system)
+ (arguments
+ (list
+ #:phases
+ '(modify-phases %standard-phases
+ (add-after 'unpack 'patch-constants
+ (lambda _
+ ;; Older versions of R used to define PI. As of R 4.5.0 the
+ ;; definition from the default math headers is supposed to be
+ ;; used instead.
+ (substitute* "src/pointinpolygon.c"
+ (("double TWOPI = " m)
+ (string-append "#define PI M_PI\n" m)))
+ (with-fluids ((%default-port-encoding "ISO-8859-1"))
+ (substitute* "src/vincenty.geodesics.c"
+ (("#include <math.h>" m)
+ (string-append m "\n#define PI M_PI")))))))))
(propagated-inputs (list r-r-utils))
(home-page "https://www.rforge.net/SDMTools/")
(synopsis "Species distribution modelling tools")