- Change library name suffix

* drop openblas-soname.patch
- Add RPM %post script for manual BLAS/LAPACK update-alternatives
  configuration update
- Use update-alternatives mechanism for OpenBLAS variants (serial,
  openmp, pthreads). pthreads variant is default for x86 and x86_64,
  OpenMP for other architectures.
- Fix build on ARM64
  * openblas-arm64-build.patch
- Add update-alternatives mechanism for CBLAS
- Provide cmake module
- Delete info about host cpu from openblas_config.h for dynamic arch
- Add update-alternatives to 'preup' and 'post' requires list for 
  libraries
- Add README.SUSE

OBS-URL: https://build.opensuse.org/package/show/science/openblas?expand=0&rev=38
This commit is contained in:
Dmitry Roshchin 2015-08-12 08:12:08 +00:00 committed by Git OBS Bridge
parent d541b436fe
commit 9e74d420ec
5 changed files with 385 additions and 111 deletions

25
README.SUSE Normal file
View File

@ -0,0 +1,25 @@
openSUSE specific packaging
===========================
OpenBLAS provides optimized implementations of BLAS and LAPACK.
openSUSE provides three variants:
* Serial library (libopenblas_serial0)
* With OpenMP support (libopenblas_openmp0)
* With threading support (libopenblas_pthreads0)
By defult openSUSE uses pthreads version on x86 systems and OpenMP
for other architectures. On x86 systems OpenBLAS uses dynamic
architectures support, so it contains all CPU-related optimizations.
How to switch between the various BLAS/LAPACK implementations
=============================================================
BLAS:
sudo /usr/sbin/update-alternatives --config libblas.so.3
LAPACK:
sudo /usr/sbin/update-alternatives --config liblapack.so.3
More information is available at:
https://en.opensuse.org/openSUSE:Science_Linear_algebra_libraries

View File

@ -0,0 +1,18 @@
From e5b96e55a727bee4010a2ae4c96c6f71327ba96b Mon Sep 17 00:00:00 2001
From: Zhang Xianyi <traits.zhang@gmail.com>
Date: Tue, 24 Mar 2015 15:27:17 -0500
Subject: [PATCH] Fix build bug for ARM64.
---
kernel/arm64/KERNEL.XGENE1 | 1 +
1 file changed, 1 insertion(+)
create mode 100644 kernel/arm64/KERNEL.XGENE1
diff --git a/kernel/arm64/KERNEL.XGENE1 b/kernel/arm64/KERNEL.XGENE1
new file mode 100644
index 0000000..6ee0c73
--- /dev/null
+++ b/kernel/arm64/KERNEL.XGENE1
@@ -0,0 +1 @@
+include $(KERNELDIR)/KERNEL.ARMV8
\ No newline at end of file

View File

@ -1,13 +0,0 @@
Index: OpenBLAS-0.2.13/Makefile.system
===================================================================
--- OpenBLAS-0.2.13.orig/Makefile.system
+++ OpenBLAS-0.2.13/Makefile.system
@@ -844,7 +844,7 @@ endif
ifndef LIBNAMESUFFIX
LIBPREFIX = libopenblas
else
-LIBPREFIX = libopenblas_$(LIBNAMESUFFIX)
+LIBPREFIX = libopenblas$(LIBNAMESUFFIX)
endif
ifndef SYMBOLPREFIX

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Wed Jul 29 21:13:47 UTC 2015 - dmitry_r@opensuse.org
- Change library name suffix
* drop openblas-soname.patch
- Add RPM %post script for manual BLAS/LAPACK update-alternatives
configuration update
- Use update-alternatives mechanism for OpenBLAS variants (serial,
openmp, pthreads). pthreads variant is default for x86 and x86_64,
OpenMP for other architectures.
- Fix build on ARM64
* openblas-arm64-build.patch
- Add update-alternatives mechanism for CBLAS
- Provide cmake module
- Delete info about host cpu from openblas_config.h for dynamic arch
- Add update-alternatives to 'preup' and 'post' requires list for
libraries
- Add README.SUSE
-------------------------------------------------------------------
Wed Mar 25 08:05:20 UTC 2015 - dmitry_r@opensuse.org

View File

@ -24,71 +24,144 @@ License: BSD-3-Clause
Group: Productivity/Scientific/Math
Url: http://www.openblas.net
Source0: https://github.com/xianyi/OpenBLAS/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: README.SUSE
# PATCH-FIX-UPSTREAM openblas-libs.patch: Link against libgfortran
Patch0: openblas-libs.patch
# PATCH-FIX-UPSTREAM c_xerbla_no-void-return.patch
Patch1: c_xerbla_no-void-return.patch
# PATCH-FEATURE-OPENSUSE openblas-soname.patch
Patch2: openblas-soname.patch
# PATCH-FIX-UPSTREAM openblas-noexecstack.patch
Patch3: openblas-noexecstack.patch
Patch2: openblas-noexecstack.patch
# PATCH-FIX-UPSTREAM openblas-arm64-build.patch
Patch3: openblas-arm64-build.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: %ix86 ia64 ppc ppc64 x86_64
ExclusiveArch: %ix86 ia64 ppc ppc64 x86_64 aarch64
BuildRequires: gcc-fortran
BuildRequires: update-alternatives
Requires(post): update-alternatives
Requires(preun): update-alternatives
%description
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. The
project is supported by the Lab of Parallel Software and Computational Science,
ISCAS. http://www.rdcps.ac.cn
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
%package -n libopenblas0
%package -n lib%{name}_serial0
Summary: An optimized BLAS library based on GotoBLAS2, serial version
Group: System/Libraries
Requires(post): update-alternatives
Requires(preun): update-alternatives
# TODO set <= 0.2.14
Obsoletes: lib%{name}0 < %{version}-%{release}
Provides: lib%{name}0 = %{version}-%{release}
%description -n libopenblas0
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. The
project is supported by the Lab of Parallel Software and Computational Science,
ISCAS. http://www.rdcps.ac.cn
%description -n lib%{name}_serial0
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
%package -n lib%{name}_serial-devel
Summary: Development libraries for OpenBLAS, serial version
Group: Development/Libraries/C and C++
Requires: %{name}-devel-headers = %{version}
Requires: lib%{name}_serial0 = %{version}
%package -n libopenblaso0
%description -n lib%{name}_serial-devel
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
This package contains the development libraries for serial OpenBLAS version.
%package -n lib%{name}_openmp0
Summary: An optimized BLAS library based on GotoBLAS2, OpenMP version
Group: System/Libraries
Requires(post): update-alternatives
Requires(preun): update-alternatives
# TODO set <= 0.2.14
Obsoletes: lib%{name}0 < %{version}-%{release}
Provides: lib%{name}0 = %{version}-%{release}
%description -n libopenblaso0
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. The
project is supported by the Lab of Parallel Software and Computational Science,
ISCAS. http://www.rdcps.ac.cn
%description -n lib%{name}_openmp0
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
This package contains the library compiled with OpenMP support.
%package -n libopenblasp0
%package -n lib%{name}o0
Summary: An optimized BLAS library based on GotoBLAS2, OpenMP version
Group: System/Libraries
Requires: lib%{name}_openmp0 = %{version}
%description -n lib%{name}o0
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
This package contains files for backward compatibility.
%package -n lib%{name}_openmp-devel
Summary: Development libraries for OpenBLAS, OpenMP version
Group: Development/Libraries/C and C++
Requires: %{name}-devel-headers = %{version}
Requires: lib%{name}_openmp0 = %{version}
%description -n lib%{name}_openmp-devel
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
This package contains the development libraries for OpenMP OpenBLAS version.
%package -n lib%{name}_pthreads0
Summary: An optimized BLAS library based on GotoBLAS2, pthreads version
Group: System/Libraries
Requires(post): update-alternatives
Requires(preun): update-alternatives
# TODO set <= 0.2.14
Obsoletes: lib%{name}0 < %{version}-%{release}
Provides: lib%{name}0 = %{version}-%{release}
%description -n libopenblasp0
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. The
project is supported by the Lab of Parallel Software and Computational Science,
ISCAS. http://www.rdcps.ac.cn
%description -n lib%{name}_pthreads0
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
This package contains the library compiled with threading support.
%package -n lib%{name}p0
Summary: An optimized BLAS library based on GotoBLAS2, pthreads version
Group: System/Libraries
Requires: lib%{name}_pthreads0 = %{version}
%description -n lib%{name}p0
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
This package contains files for backward compatibility.
%package -n lib%{name}_pthreads-devel
Summary: Development headers and libraries for OpenBLAS, pthreads version
Group: Development/Libraries/C and C++
Requires: %{name}-devel-headers = %{version}
Requires: lib%{name}_pthreads0 = %{version}
%description -n lib%{name}_pthreads-devel
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
This package contains the development libraries for pthreads OpenBLAS version.
%package devel
Summary: Development headers and libraries for OpenBLAS
Group: Development/Libraries/C and C++
Requires: lib%{name}0 = %{version}
Requires: lib%{name}o0 = %{version}
Requires: lib%{name}p0 = %{version}
Requires: %{name}-devel-headers = %{version}
%ifarch %ix86 x86_64
Requires: lib%{name}_pthreads-devel = %{version}
%else
Requires: lib%{name}_openmp-devel = %{version}
%endif
%description devel
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. The
project is supported by the Lab of Parallel Software and Computational Science,
ISCAS. http://www.rdcps.ac.cn
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
This package contains the development headers and libraries.
This package contains the development libraries and headers for OpenBLAS.
%package devel-headers
Summary: Development headers for OpenBLAS
Group: Development/Libraries/C and C++
# TODO set <= 0.2.14
Conflicts: %{name}-devel < %{version}-%{release}
BuildArch: noarch
%description devel-headers
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
This package contains headers for OpenBLAS.
%package devel-static
Summary: Static version of OpenBLAS
@ -96,9 +169,7 @@ Group: Development/Libraries/C and C++
Requires: %{name}-devel = %{version}
%description devel-static
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. The
project is supported by the Lab of Parallel Software and Computational Science,
ISCAS. http://www.rdcps.ac.cn
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
This package contains the static libraries.
@ -114,133 +185,287 @@ cd OpenBLAS-%{version}
%patch3 -p1
cd ..
# prepare build for serial, threaded and OpenMP versions
# Prepare build for serial, pthreads and OpenMP versions
cp -ar OpenBLAS-%{version} openmp
cp -ar OpenBLAS-%{version} threaded
cp -ar OpenBLAS-%{version} pthreads
mv OpenBLAS-%{version} serial
cp %{SOURCE1} .
%build
# Only *86 CPUs support DYNAMIC_ARCH
%ifarch %ix86 x86_64
%define openblas_target DYNAMIC_ARCH=1
%endif
# Temporary fix, OpenBLAS does not autodetect aarch64
%ifarch aarch64
%define openblas_target TARGET=ARMV8
%endif
# Make serial, threaded and OpenMP versions
make -C serial DYNAMIC_ARCH=1 USE_THREAD=0 USE_OPENMP=0 \
make -C serial %{?openblas_target} USE_THREAD=0 USE_OPENMP=0 LIBNAMESUFFIX=serial \
FC=gfortran CC=gcc COMMON_OPT="%{optflags}" NUM_THREADS=64
make -C openmp DYNAMIC_ARCH=1 USE_THREAD=1 USE_OPENMP=1 LIBNAMESUFFIX=o \
make -C openmp %{?openblas_target} USE_THREAD=1 USE_OPENMP=1 LIBNAMESUFFIX=openmp \
FC=gfortran CC=gcc COMMON_OPT="%{optflags}" NUM_THREADS=64
make -C threaded DYNAMIC_ARCH=1 USE_THREAD=1 USE_OPENMP=0 LIBNAMESUFFIX=p \
make -C pthreads %{?openblas_target} USE_THREAD=1 USE_OPENMP=0 LIBNAMESUFFIX=pthreads \
FC=gfortran CC=gcc COMMON_OPT="%{optflags}" NUM_THREADS=64
%install
# Install serial library and headers
make -C serial USE_THREAD=0 PREFIX=%{buildroot}%{_prefix} install
# Move include files to package specific directory, so that they don't clash with reference BLAS and LAPACK
mkdir %{buildroot}%{_includedir}/%{name}
mv %{buildroot}%{_includedir}/*.h %{buildroot}%{_includedir}/%{name}
make -C serial USE_THREAD=0 LIBNAMESUFFIX=serial \
OPENBLAS_LIBRARY_DIR=%{buildroot}%{_libdir} \
OPENBLAS_INCLUDE_DIR=%{buildroot}%{_includedir}/%{name} \
OPENBLAS_CMAKE_DIR=%{buildroot}%{_libdir}/cmake/%{name} \
PREFIX=%{buildroot}%{_prefix} install
# Put libraries in correct location
rm -rf %{buildroot}%{_prefix}/lib
mkdir -p %{buildroot}%{_libdir}
rm -rf %{buildroot}%{_libdir}/lib%{name}*
# Install the serial library
install -D -p -m 755 serial/libopenblas.so %{buildroot}%{_libdir}/lib%{name}.so.0
install -D -p -m 644 serial/libopenblas.a %{buildroot}%{_libdir}/lib%{name}.a
install -D -p -m 755 serial/lib%{name}_serial.so %{buildroot}%{_libdir}/lib%{name}_serial.so.0
install -D -p -m 644 serial/lib%{name}_serial.a %{buildroot}%{_libdir}/lib%{name}_serial.a
# Install the OpenMP library
install -D -p -m 755 openmp/libopenblaso.so %{buildroot}%{_libdir}/lib%{name}o.so.0
install -D -p -m 644 openmp/libopenblaso.a %{buildroot}%{_libdir}/lib%{name}o.a
install -D -p -m 755 openmp/lib%{name}_openmp.so %{buildroot}%{_libdir}/lib%{name}_openmp.so.0
install -D -p -m 644 openmp/lib%{name}_openmp.a %{buildroot}%{_libdir}/lib%{name}_openmp.a
# Install the threaded library
install -D -p -m 755 threaded/libopenblasp.so %{buildroot}%{_libdir}/lib%{name}p.so.0
install -D -p -m 644 threaded/libopenblasp.a %{buildroot}%{_libdir}/lib%{name}p.a
install -D -p -m 755 pthreads/lib%{name}_pthreads.so %{buildroot}%{_libdir}/lib%{name}_pthreads.so.0
install -D -p -m 644 pthreads/lib%{name}_pthreads.a %{buildroot}%{_libdir}/lib%{name}_pthreads.a
# Fix source permissions (also applies to LAPACK)
find -name \*.f -exec chmod 644 {} +
# Dummy target for update-alternatives
install -d %{buildroot}/%{_sysconfdir}/alternatives
ln -s lib%{name}.so.0 %{buildroot}/%{_libdir}/lib%{name}.so.0
ln -s lib%{name}.so.0 %{buildroot}/%{_sysconfdir}/alternatives/lib%{name}.so.0
ln -s lib%{name}.so.0 %{buildroot}/%{_libdir}/libblas.so.3
ln -s lib%{name}.so.0 %{buildroot}/%{_libdir}/libcblas.so.3
ln -s lib%{name}.so.0 %{buildroot}/%{_libdir}/liblapack.so.3
ln -s lib%{name}.so.0 %{buildroot}/%{_sysconfdir}/alternatives/libblas.so.3
ln -s lib%{name}.so.0 %{buildroot}/%{_sysconfdir}/alternatives/libcblas.so.3
ln -s lib%{name}.so.0 %{buildroot}/%{_sysconfdir}/alternatives/liblapack.so.3
# Fix symlinks
pushd %{buildroot}%{_libdir}
# Serial libraries
ln -sf lib%{name}.so.0 lib%{name}.so
# Serial libraries
ln -sf lib%{name}_serial.so.0 lib%{name}_serial.so
# OpenMP libraries
ln -sf lib%{name}_openmp.so.0 lib%{name}_openmp.so
ln -sf lib%{name}_openmp.so.0 lib%{name}o.so.0
ln -sf lib%{name}o.so.0 lib%{name}o.so
# Threaded libraries
ln -sf lib%{name}_pthreads.so.0 lib%{name}_pthreads.so
ln -sf lib%{name}_pthreads.so.0 lib%{name}p.so.0
ln -sf lib%{name}p.so.0 lib%{name}p.so
# Get rid of executable stacks
# for lib in %%{buildroot}%%{_libdir}/libopenblas{,o,p}*.so; do
# execstack -c $lib
# done
# Fix cmake config file
sed -i 's|%{buildroot}||g' %{buildroot}%{_libdir}/cmake/%{name}/*.cmake
sed -i 's|_serial||g' %{buildroot}%{_libdir}/cmake/%{name}/*.cmake
# Remove Config.cmake (we use custom libraries configuration)
rm -rf %{buildroot}%{_libdir}/cmake/openblas/
# Delete info about host cpu
%ifarch %ix86 x86_64
sed -i '/#define OPENBLAS_NEEDBUNDERSCORE/,/#define OPENBLAS_VERSION/{//!d}' %{buildroot}%{_includedir}/%{name}/openblas_config.h
%endif
%post -n libopenblas0
"%_sbindir/update-alternatives" --install \
%{_libdir}/libblas.so.3 libblas.so.3 %{_libdir}/libopenblas.so.0 20
"%_sbindir/update-alternatives" --install \
%{_libdir}/liblapack.so.3 liblapack.so.3 %{_libdir}/libopenblas.so.0 20
%post -n lib%{name}_serial0
%{_sbindir}/update-alternatives --install \
%{_libdir}/libblas.so.3 libblas.so.3 %{_libdir}/lib%{name}_serial.so.0 20
%{_sbindir}/update-alternatives --install \
%{_libdir}/libcblas.so.3 libcblas.so.3 %{_libdir}/lib%{name}_serial.so.0 20
%{_sbindir}/update-alternatives --install \
%{_libdir}/liblapack.so.3 liblapack.so.3 %{_libdir}/lib%{name}_serial.so.0 20
%{_sbindir}/update-alternatives --install \
%{_libdir}/lib%{name}.so.0 lib%{name}.so.0 %{_libdir}/lib%{name}_serial.so.0 20
/sbin/ldconfig
%preun -n libopenblas0
%preun -n lib%{name}_serial0
if [ "$1" = 0 ] ; then
"%_sbindir/update-alternatives" --remove libblas.so.3 %{_libdir}/libopenblas.so.0
"%_sbindir/update-alternatives" --remove liblapack.so.3 %{_libdir}/libopenblas.so.0
%{_sbindir}/update-alternatives --remove libblas.so.3 %{_libdir}/lib%{name}_serial.so.0
%{_sbindir}/update-alternatives --remove libcblas.so.3 %{_libdir}/lib%{name}_serial.so.0
%{_sbindir}/update-alternatives --remove liblapack.so.3 %{_libdir}/lib%{name}_serial.so.0
%{_sbindir}/update-alternatives --remove lib%{name}.so.0 %{_libdir}/lib%{name}_serial.so.0
fi
%postun -n libopenblas0 -p /sbin/ldconfig
%postun -n lib%{name}_serial0 -p /sbin/ldconfig
%post -n libopenblaso0
"%_sbindir/update-alternatives" --install \
%{_libdir}/libblas.so.3 libblas.so.3 %{_libdir}/libopenblaso.so.0 20
"%_sbindir/update-alternatives" --install \
%{_libdir}/liblapack.so.3 liblapack.so.3 %{_libdir}/libopenblaso.so.0 20
%posttrans -n lib%{name}_serial0
if [ "$1" = 0 ] ; then
if ! [ -f %{_libdir}/lib%{name}.so.0 ] ; then
%{_sbindir}/update-alternatives --auto lib%{name}.so.0
fi
fi
%post -n lib%{name}_openmp0
# Check config
config_blas_mode=$(%{_sbindir}/update-alternatives --query libblas.so.3 | grep 'Status:' | sed -e 's/Status: //g')
config_blas_value=$(%{_sbindir}/update-alternatives --query libblas.so.3 | grep 'Value:' | grep -o 'openblas.')
config_lapack_mode=$(%{_sbindir}/update-alternatives --query liblapack.so.3 | grep 'Status:' | sed -e 's/Status: //g')
config_lapack_value=$(%{_sbindir}/update-alternatives --query liblapack.so.3 | grep 'Value:' | grep -o 'openblas.')
# Install
%{_sbindir}/update-alternatives --install \
%{_libdir}/libblas.so.3 libblas.so.3 %{_libdir}/lib%{name}_openmp.so.0 20
%{_sbindir}/update-alternatives --install \
%{_libdir}/libcblas.so.3 libcblas.so.3 %{_libdir}/lib%{name}_openmp.so.0 20
%{_sbindir}/update-alternatives --install \
%{_libdir}/liblapack.so.3 liblapack.so.3 %{_libdir}/lib%{name}_openmp.so.0 20
%{_sbindir}/update-alternatives --install \
%ifarch %ix86 x86_64
%{_libdir}/lib%{name}.so.0 lib%{name}.so.0 %{_libdir}/lib%{name}_openmp.so.0 20
%else
%{_libdir}/lib%{name}.so.0 lib%{name}.so.0 %{_libdir}/lib%{name}_openmp.so.0 50
%endif
# Reconfigure
if [ ${config_blas_mode} = "manual" ] && [ ${config_blas_value} = "openblaso" ]; then
%{_sbindir}/update-alternatives --set libblas.so.3 %{_libdir}/lib%{name}_openmp.so.0
fi
if [ ${config_lapack_mode} = "manual" ] && [ ${config_lapack_value} == "openblaso" ]; then
%{_sbindir}/update-alternatives --set liblapack.so.3 %{_libdir}/lib%{name}_openmp.so.0
fi
# Remove old variants
%{_sbindir}/update-alternatives --remove libblas.so.3 %{_libdir}/lib%{name}o.so.0
%{_sbindir}/update-alternatives --remove liblapack.so.3 %{_libdir}/lib%{name}o.so.0
/sbin/ldconfig
%preun -n libopenblaso0
%preun -n lib%{name}_openmp0
if [ "$1" = 0 ] ; then
"%_sbindir/update-alternatives" --remove libblas.so.3 %{_libdir}/libopenblaso.so.0
"%_sbindir/update-alternatives" --remove liblapack.so.3 %{_libdir}/libopenblaso.so.0
%{_sbindir}/update-alternatives --remove libblas.so.3 %{_libdir}/lib%{name}_openmp.so.0
%{_sbindir}/update-alternatives --remove libcblas.so.3 %{_libdir}/lib%{name}_openmp.so.0
%{_sbindir}/update-alternatives --remove liblapack.so.3 %{_libdir}/lib%{name}_openmp.so.0
%{_sbindir}/update-alternatives --remove lib%{name}.so.0 %{_libdir}/lib%{name}_openmp.so.0
fi
%postun -n libopenblaso0 -p /sbin/ldconfig
%postun -n lib%{name}_openmp0 -p /sbin/ldconfig
%post -n libopenblasp0
"%_sbindir/update-alternatives" --install \
%{_libdir}/libblas.so.3 libblas.so.3 %{_libdir}/libopenblasp.so.0 20
"%_sbindir/update-alternatives" --install \
%{_libdir}/liblapack.so.3 liblapack.so.3 %{_libdir}/libopenblasp.so.0 20
%posttrans -n lib%{name}_openmp0
if [ "$1" = 0 ] ; then
if ! [ -f %{_libdir}/lib%{name}.so.0 ] ; then
%{_sbindir}/update-alternatives --auto lib%{name}.so.0
fi
fi
%post -n lib%{name}_pthreads0
# Check config
config_blas_mode=$(%{_sbindir}/update-alternatives --query libblas.so.3 | grep 'Status:' | sed -e 's/Status: //g')
config_blas_value=$(%{_sbindir}/update-alternatives --query libblas.so.3 | grep 'Value:' | grep -o 'openblas.')
config_lapack_mode=$(%{_sbindir}/update-alternatives --query liblapack.so.3 | grep 'Status:' | sed -e 's/Status: //g')
config_lapack_value=$(%{_sbindir}/update-alternatives --query liblapack.so.3 | grep 'Value:' | grep -o 'openblas.')
# Install
%{_sbindir}/update-alternatives --install \
%{_libdir}/libblas.so.3 libblas.so.3 %{_libdir}/lib%{name}_pthreads.so.0 20
%{_sbindir}/update-alternatives --install \
%{_libdir}/libcblas.so.3 libcblas.so.3 %{_libdir}/lib%{name}_pthreads.so.0 20
%{_sbindir}/update-alternatives --install \
%{_libdir}/liblapack.so.3 liblapack.so.3 %{_libdir}/lib%{name}_pthreads.so.0 20
%{_sbindir}/update-alternatives --install \
%ifarch %ix86 x86_64
%{_libdir}/lib%{name}.so.0 lib%{name}.so.0 %{_libdir}/lib%{name}_pthreads.so.0 50
%else
%{_libdir}/lib%{name}.so.0 lib%{name}.so.0 %{_libdir}/lib%{name}_pthreads.so.0 20
%endif
# Reconfigure
if [ ${config_blas_mode} = "manual" ] && [ ${config_blas_value} = "openblasp" ]; then
%{_sbindir}/update-alternatives --set libblas.so.3 %{_libdir}/lib%{name}_pthreads.so.0
fi
if [ ${config_lapack_mode} = "manual" ] && [ ${config_lapack_value} == "openblasp" ]; then
%{_sbindir}/update-alternatives --set liblapack.so.3 %{_libdir}/lib%{name}_pthreads.so.0
fi
# Remove old variants
%{_sbindir}/update-alternatives --remove libblas.so.3 %{_libdir}/lib%{name}p.so.0
%{_sbindir}/update-alternatives --remove liblapack.so.3 %{_libdir}/lib%{name}p.so.0
/sbin/ldconfig
%preun -n libopenblasp0
%preun -n lib%{name}_pthreads0
if [ "$1" = 0 ] ; then
"%_sbindir/update-alternatives" --remove libblas.so.3 %{_libdir}/libopenblasp.so.0
"%_sbindir/update-alternatives" --remove liblapack.so.3 %{_libdir}/libopenblasp.so.0
%{_sbindir}/update-alternatives --remove libblas.so.3 %{_libdir}/lib%{name}_pthreads.so.0
%{_sbindir}/update-alternatives --remove libcblas.so.3 %{_libdir}/lib%{name}_pthreads.so.0
%{_sbindir}/update-alternatives --remove liblapack.so.3 %{_libdir}/lib%{name}_pthreads.so.0
%{_sbindir}/update-alternatives --remove lib%{name}.so.0 %{_libdir}/lib%{name}_pthreads.so.0
fi
%postun -n libopenblasp0 -p /sbin/ldconfig
%postun -n lib%{name}_pthreads0 -p /sbin/ldconfig
%files -n libopenblas0
%defattr(-,root,root,-)
%doc serial/Changelog.txt serial/GotoBLAS* serial/LICENSE serial/README.md
%{_libdir}/lib%{name}.so.*
%posttrans -n lib%{name}_pthreads0
if [ "$1" = 0 ] ; then
if ! [ -f %{_libdir}/lib%{name}.so.0 ] ; then
%{_sbindir}/update-alternatives --auto lib%{name}.so.0
fi
fi
%files -n libopenblaso0
%files -n lib%{name}_serial0
%defattr(-,root,root,-)
%{_libdir}/lib%{name}o.so.*
%{_libdir}/lib%{name}_serial.so.0
%ghost %{_libdir}/lib%{name}.so.0
%ghost %{_libdir}/libblas.so.3
%ghost %{_libdir}/libcblas.so.3
%ghost %{_libdir}/liblapack.so.3
%ghost %{_sysconfdir}/alternatives/lib%{name}.so.0
%ghost %{_sysconfdir}/alternatives/libblas.so.3
%ghost %{_sysconfdir}/alternatives/libcblas.so.3
%ghost %{_sysconfdir}/alternatives/liblapack.so.3
%files -n libopenblasp0
%files -n lib%{name}_serial-devel
%defattr(-,root,root,-)
%{_libdir}/lib%{name}p.so.*
%{_libdir}/lib%{name}_serial.so
%files -n lib%{name}_openmp0
%defattr(-,root,root,-)
%{_libdir}/lib%{name}_openmp.so.0
%ghost %{_libdir}/lib%{name}.so.0
%ghost %{_libdir}/libblas.so.3
%ghost %{_libdir}/libcblas.so.3
%ghost %{_libdir}/liblapack.so.3
%ghost %{_sysconfdir}/alternatives/lib%{name}.so.0
%ghost %{_sysconfdir}/alternatives/libblas.so.3
%ghost %{_sysconfdir}/alternatives/libcblas.so.3
%ghost %{_sysconfdir}/alternatives/liblapack.so.3
%files -n lib%{name}o0
%defattr(-,root,root,-)
%{_libdir}/lib%{name}o.so.0
%files -n lib%{name}_openmp-devel
%defattr(-,root,root,-)
%{_libdir}/lib%{name}_openmp.so
%{_libdir}/lib%{name}o.so
%files -n lib%{name}_pthreads0
%defattr(-,root,root,-)
%{_libdir}/lib%{name}_pthreads.so.0
%ghost %{_libdir}/lib%{name}.so.0
%ghost %{_libdir}/libblas.so.3
%ghost %{_libdir}/libcblas.so.3
%ghost %{_libdir}/liblapack.so.3
%ghost %{_sysconfdir}/alternatives/lib%{name}.so.0
%ghost %{_sysconfdir}/alternatives/libblas.so.3
%ghost %{_sysconfdir}/alternatives/libcblas.so.3
%ghost %{_sysconfdir}/alternatives/liblapack.so.3
%files -n lib%{name}p0
%defattr(-,root,root,-)
%{_libdir}/lib%{name}p.so.0
%files -n lib%{name}_pthreads-devel
%defattr(-,root,root,-)
%{_libdir}/lib%{name}_pthreads.so
%{_libdir}/lib%{name}p.so
%files devel
%defattr(-,root,root,-)
%{_includedir}/%{name}
%doc serial/Changelog.txt serial/GotoBLAS* serial/LICENSE serial/README.md README.SUSE
%{_libdir}/lib%{name}.so
%{_libdir}/lib%{name}o.so
%{_libdir}/lib%{name}p.so
%dir %{_libdir}/cmake
%{_libdir}/cmake/%{name}/
%files devel-headers
%defattr(-,root,root,-)
%{_includedir}/%{name}/
%files devel-static
%defattr(-,root,root,-)
%{_libdir}/lib%{name}.a
%{_libdir}/lib%{name}o.a
%{_libdir}/lib%{name}p.a
%{_libdir}/lib%{name}_serial.a
%{_libdir}/lib%{name}_openmp.a
%{_libdir}/lib%{name}_pthreads.a
%changelog