add support for riscv

This commit is contained in:
xiaoqianlv 2023-06-30 20:42:55 +08:00 committed by laokz
parent 087461bebb
commit 15ea428032

View File

@ -2,7 +2,7 @@
Name: openblas
Version: 0.3.18
Release: 4
Release: 5
Summary: An optimized BLAS library based on GotoBLAS2 1.13 BSD version
License: BSD-3-Clause
URL: https://github.com/xianyi/OpenBLAS/
@ -48,7 +48,7 @@ Obsoletes: openblas-serial64_ < %{version}-%{release} openblas-openmp64_ <
Obsoletes: openblas-threads64_ < %{version}-%{release} openblas-Rblas < %{version}-%{release}
%endif
ExclusiveArch: x86_64 aarch64
ExclusiveArch: x86_64 aarch64 riscv64
%description
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD \
@ -182,6 +182,9 @@ TARGET="TARGET=CORE2 DYNAMIC_ARCH=1 DYNAMIC_OLDER=0"
%ifarch aarch64
TARGET="TARGET=ARMV8 DYNAMIC_ARCH=0"
%endif
%ifarch riscv64
TARGET="TARGET=RISCV64_GENERIC DYNAMIC_ARCH=0"
%endif
COMMON="%{optflags} -fPIC"
FCOMMON="%{optflags} -fPIC -frecursive"
@ -231,6 +234,9 @@ TARGET="TARGET=CORE2 DYNAMIC_ARCH=1 DYNAMIC_OLDER=0"
%ifarch aarch64
TARGET="TARGET=ARMV8 DYNAMIC_ARCH=0"
%endif
%ifarch riscv64
TARGET="TARGET=RISCV64_GENERIC DYNAMIC_ARCH=0"
%endif
COMMON="%{optflags} -fPIC"
FCOMMON="%{optflags} -fPIC -frecursive"
@ -266,7 +272,12 @@ make -C openmp64_ tests $TARGET USE_THREAD=1 USE_OPENMP=1 FC=gfortran CC=gcc CO
%install
rm -rf %{buildroot}
# Install serial library and headers
make -C serial USE_THREAD=0 PREFIX=%{buildroot} OPENBLAS_LIBRARY_DIR=%{buildroot}%{_libdir} OPENBLAS_INCLUDE_DIR=%{buildroot}%{_includedir}/%name OPENBLAS_BINARY_DIR=%{buildroot}%{_bindir} OPENBLAS_CMAKE_DIR=%{buildroot}%{_libdir}/cmake install
%ifarch riscv64
TARGET="TARGET=RISCV64_GENERIC DYNAMIC_ARCH=0"
%else
TARGET=
%endif
make -C serial $TARGET USE_THREAD=0 PREFIX=%{buildroot} OPENBLAS_LIBRARY_DIR=%{buildroot}%{_libdir} OPENBLAS_INCLUDE_DIR=%{buildroot}%{_includedir}/%name OPENBLAS_BINARY_DIR=%{buildroot}%{_bindir} OPENBLAS_CMAKE_DIR=%{buildroot}%{_libdir}/cmake install
# Copy lapacke include files
%if %{with system_lapack} && %{lapacke}
@ -277,6 +288,9 @@ cp -a %{_includedir}/lapacke %{buildroot}%{_includedir}/%{name}
%ifarch aarch64
suffix="_armv8"
%endif
%ifarch riscv64
suffix="_riscv64_generic"
%endif
slibname=`basename %{buildroot}%{_libdir}/libopenblas${suffix}-*.so .so`
mv %{buildroot}%{_libdir}/${slibname}.a %{buildroot}%{_libdir}/lib%{name}.a
if [[ "$suffix" != "" ]]; then
@ -420,6 +434,9 @@ rm -rf %{buildroot}%{_libdir}/pkgconfig
%endif
%changelog
* Fri Jun 30 2023 xiaoqianlv <xiaoqian@nj.iscas.ac.cn>- 0.3.18-5
- add support for riscv
* Mon Apr 18 2022 zhouwenpei <zhouwenpei1@h-partners.com>- 0.3.18-4
- sync master build speed optimization