commit: cd90a79d4942ab91e8f7390ba01d07f80ca25b4f Author: Z. Liu <zhixu.liu <AT> gmail <DOT> com> AuthorDate: Fri Dec 19 03:59:59 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Dec 22 13:50:19 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cd90a79d
dev-lang/R: fix build with clang https://github.com/wch/r-source/commit/489a6b8d330bb30da82329f1949f44a0f633f1e8 otherwise clang report error: > mlutils.c:108:8: error: cannot compile this static initializer yet > 108 | double NA_REAL = ML_NAN; > | ^ Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com> Part-of: https://codeberg.org/gentoo/gentoo/pulls/7 Merges: https://codeberg.org/gentoo/gentoo/pulls/7 Signed-off-by: Sam James <sam <AT> gentoo.org> dev-lang/R/R-4.5.0.ebuild | 1 + dev-lang/R/files/R-4.5.0-static-initializer.patch | 38 +++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/dev-lang/R/R-4.5.0.ebuild b/dev-lang/R/R-4.5.0.ebuild index 935e00c20602..291d94c7345b 100644 --- a/dev-lang/R/R-4.5.0.ebuild +++ b/dev-lang/R/R-4.5.0.ebuild @@ -79,6 +79,7 @@ PATCHES=( "${FILESDIR}"/R-4.3.0-parallel.patch "${FILESDIR}"/R-4.3.0-no-LDFLAGS-in-libR-pkg-config.patch "${FILESDIR}"/R-4.3.0-no-gzip-doc.patch + "${FILESDIR}"/R-4.5.0-static-initializer.patch # 4.5.0 only ) # false positive, the linking step fails (as it should) diff --git a/dev-lang/R/files/R-4.5.0-static-initializer.patch b/dev-lang/R/files/R-4.5.0-static-initializer.patch new file mode 100644 index 000000000000..47af8cda226c --- /dev/null +++ b/dev-lang/R/files/R-4.5.0-static-initializer.patch @@ -0,0 +1,38 @@ +https://github.com/wch/r-source/commit/489a6b8d330bb30da82329f1949f44a0f633f1e8 + +From 489a6b8d330bb30da82329f1949f44a0f633f1e8 Mon Sep 17 00:00:00 2001 +From: ripley <ripley@00db46b3-68df-0310-9c12-caf00c1e9a41> +Date: Thu, 10 Apr 2025 05:13:13 +0000 +Subject: [PATCH] workaround for building standalone nmath with recent + compilers + +git-svn-id: https://svn.r-project.org/R/trunk@88128 00db46b3-68df-0310-9c12-caf00c1e9a41 + +diff --git a/src/nmath/mlutils.c b/src/nmath/mlutils.c +index 1b590f860a..8269e7d7f9 100644 +--- a/src/nmath/mlutils.c ++++ b/src/nmath/mlutils.c +@@ -105,7 +105,20 @@ double R_pow_di(double x, int n) + return pow; + } + ++/* It is not clear why these are being defined in standalone nmath: ++ * but that they are is stated in the R-admin manual. ++ * ++ * In R NA_AREAL is a specific NaN computed during initialization. ++ */ ++#if defined(__clang__) && defined(NAN) ++// C99 (optionally) has NAN, which is a float but will coerce to double. ++double NA_REAL = NAN; ++#else ++// ML_NAN is defined as (0.0/0.0) in nmath.h ++// Fails to compile in Intel ics 2025.0, Apple clang 17, LLVM clang 20 + double NA_REAL = ML_NAN; ++#endif ++ + double R_PosInf = ML_POSINF, R_NegInf = ML_NEGINF; + + #include <stdio.h> +-- +2.49.1 +
