commit:     fce668b700ebc88e5b4d26c002a1888adcf1e86f
Author:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  5 12:03:08 2025 +0000
Commit:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
CommitDate: Sun Jan  5 12:09:58 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fce668b7

sci-libs/openlibm: add support for loong, fix riscv build

Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org>

 .../openlibm-0.8.3-fix-loong-riscv-fenv.patch      | 27 ++++++++++++++++++++++
 sci-libs/openlibm/openlibm-0.8.3.ebuild            | 10 +++++---
 2 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/sci-libs/openlibm/files/openlibm-0.8.3-fix-loong-riscv-fenv.patch 
b/sci-libs/openlibm/files/openlibm-0.8.3-fix-loong-riscv-fenv.patch
new file mode 100644
index 000000000000..3e66dfaa46a9
--- /dev/null
+++ b/sci-libs/openlibm/files/openlibm-0.8.3-fix-loong-riscv-fenv.patch
@@ -0,0 +1,27 @@
+https://github.com/JuliaMath/openlibm/commit/c4667caea25ae3487adf6760b4a1dcf32477a4b8
+https://github.com/JuliaMath/openlibm/pull/308
+shipped in openlibm 0.8.4
+From: Li Bohai <[email protected]>
+Date: Sat, 9 Nov 2024 21:40:26 +0800
+Subject: [PATCH] Fix fenv_t initializer (#308)
+
+--- a/loongarch64/fenv.c
++++ b/loongarch64/fenv.c
+@@ -1,5 +1,5 @@
+ #define       __fenv_static
+-#include <fenv.h>
++#include <openlibm_fenv.h>
+ 
+ #ifdef __GNUC_GNU_INLINE__
+ #error "This file must be compiled with C99 'inline' semantics"
+--- a/riscv64/fenv.c
++++ b/riscv64/fenv.c
+@@ -27,7 +27,7 @@
+  */
+ 
+ #define       __fenv_static
+-#include "fenv.h"
++#include <openlibm_fenv.h>
+ 
+ #ifdef __GNUC_GNU_INLINE__
+ #error "This file must be compiled with C99 'inline' semantics"

diff --git a/sci-libs/openlibm/openlibm-0.8.3.ebuild 
b/sci-libs/openlibm/openlibm-0.8.3.ebuild
index 1b03b5cf145c..4a83d97ac718 100644
--- a/sci-libs/openlibm/openlibm-0.8.3.ebuild
+++ b/sci-libs/openlibm/openlibm-0.8.3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -17,6 +17,7 @@ KEYWORDS="amd64 arm arm64 ppc ppc64 ~riscv ~s390 ~x86 
~amd64-linux ~x86-linux"
 
 PATCHES=(
        "${FILESDIR}"/${P}-stack-protection.patch
+       "${FILESDIR}"/${P}-fix-loong-riscv-fenv.patch
 )
 
 src_prepare() {
@@ -28,8 +29,11 @@ src_prepare() {
 }
 
 src_compile() {
-       # Build system uses the riscv64 arch variable
-       use riscv && export ARCH=riscv64
+       # Build system uses different ARCH for the following arches
+       case "${ARCH}" in
+               loong) export ARCH=loongarch64 ;;
+               riscv) export ARCH=riscv64 ;;
+       esac
 
        emake \
                CC="$(tc-getCC)" \

Reply via email to