diff --git a/README.HPC.SUSE b/README.HPC.SUSE
new file mode 100644
index 0000000..147ee69
--- /dev/null
+++ b/README.HPC.SUSE
@@ -0,0 +1,23 @@
+openSUSE specific packaging
+===========================
+
+OpenBLAS provides optimized implementations of BLAS and LAPACK.
+openSUSE provides two variants:
+ * With OpenMP support
+ * With threading support
+The serial variant has been dropped. To run a program
+which requires the serial version (ie. because it is
+multi-threaded itself), either specify the environment
+variable OMP_NUM_THREADS=1 or place a call to
+ void openblas_set_num_threads(int num_threads);
+in your program to limit the number of threads this library
+uses to 1.
+
+On x86 systems OpenBLAS uses dynamic architectures support,
+so it contains all CPU-related optimizations.
+
+How to switch between the various BLAS/LAPACK implementations
+=============================================================
+
+The openmp and threaded variants may be installed in parallel.
+To select which one to use please use the 'modules' command.
diff --git a/_constraints b/_constraints
new file mode 100644
index 0000000..bd77583
--- /dev/null
+++ b/_constraints
@@ -0,0 +1,10 @@
+
+
+
+ 20
+
+
+ 8000
+
+
+
diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..74856ab
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,7 @@
+
+ serial
+ openmp
+ pthreads
+ gnu-hpc
+ gnu-hpc-pthreads
+
diff --git a/fix-arm64-cpuid-return.patch b/fix-arm64-cpuid-return.patch
new file mode 100644
index 0000000..2439774
--- /dev/null
+++ b/fix-arm64-cpuid-return.patch
@@ -0,0 +1,25 @@
+From 63d4fcdecd40cb9eee8228680521ff93a80a8e11 Mon Sep 17 00:00:00 2001
+From: Eric Van Hensbergen
+Date: Tue, 23 Aug 2016 11:29:27 -0500
+Subject: [PATCH] fix-arm64-cpuid-return
+
+---
+ cpuid_arm64.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cpuid_arm64.c b/cpuid_arm64.c
+index c7a27f8..95fc708 100644
+--- a/cpuid_arm64.c
++++ b/cpuid_arm64.c
+@@ -59,7 +59,7 @@ int get_feature(char *search)
+ fclose(infile);
+
+
+- if( p == NULL ) return;
++ if( p == NULL ) return(0);
+
+ t = strtok(p," ");
+ while( t = strtok(NULL," "))
+--
+2.7.4
+
diff --git a/openblas.changes b/openblas.changes
index c8e3a4b..e52cd2c 100644
--- a/openblas.changes
+++ b/openblas.changes
@@ -1,3 +1,18 @@
+-------------------------------------------------------------------
+Thu Oct 12 10:01:10 UTC 2017 - eich@suse.com
+
+- Generate baselib.conf dynamically and only for the non-HPC
+ builds: this avoids issues with the source validator.
+
+-------------------------------------------------------------------
+Fri Sep 8 14:30:29 UTC 2017 - eich@suse.com
+
+- Convert openblas to multibuild.
+- Add HPC build using environment modules.
+ (FATE#321708).
+- fix-arm64-cpuid-return.patch
+ Fix CPUID detection on ARM (From OHPC).
+
-------------------------------------------------------------------
Wed Aug 9 19:45:54 UTC 2017 - dmitry_r@opensuse.org
diff --git a/openblas.spec b/openblas.spec
index 7ff22a4..702249a 100644
--- a/openblas.spec
+++ b/openblas.spec
@@ -16,152 +16,233 @@
#
-Name: openblas
-Version: 0.2.20
+%global flavor @BUILD_FLAVOR@%{nil}
+
+%define _vers 0_2_20
+%define vers 0.2.20
+%define pname openblas
+
+%if "%flavor" == ""
+%define package_name %{pname}
+ExclusiveArch: do_not_build
+%endif
+
+%global build_flags USE_THREAD=1 USE_OPENMP=1
+
+%if "%flavor" == "serial"
+%define build_flags USE_THREAD=0 USE_OPENMP=0
+%define openblas_so_prio 20
+# we build devel packages only from one flavor
+%define build_devel 1
+%{bcond_with hpc}
+%endif
+
+%if "%flavor" == "pthreads"
+%define build_flags USE_THREAD=1 USE_OPENMP=0
+ %ifarch %ix86 x86_64
+ %define openblas_so_prio 50
+ %else
+ %define openblas_so_prio 20
+ %endif
+%{bcond_with hpc}
+%endif
+
+%if "%flavor" == "openmp"
+ %ifarch %ix86 x86_64
+ %define openblas_so_prio 20
+ %else
+ %define openblas_so_prio 50
+ %endif
+%{bcond_with hpc}
+%endif
+
+%if "%flavor" == "gnu-hpc"
+%define compiler_family gnu
+%undefine c_f_ver
+%{bcond_without hpc}
+%endif
+
+%if "%flavor" == "gnu6-hpc"
+%define compiler_family gnu
+%define c_f_ver 6
+%{bcond_without hpc}
+%endif
+
+%if "%flavor" == "gnu-hpc-pthreads"
+%define compiler_family gnu
+%undefine c_f_ver
+%define ext pthreads
+%define build_flags USE_THREAD=1 USE_OPENMP=0
+%{bcond_without hpc}
+%endif
+
+%if "%flavor" == "gnu6-hpc-pthreads"
+%define compiler_family gnu
+%define c_f_ver 6
+%define ext pthreads
+%define build_flags USE_THREAD=1 USE_OPENMP=0
+%{bcond_without hpc}
+%endif
+
+%if %{without hpc}
+%if 0%{!?package_name:1}
+%define package_name %{pname}_%{flavor}
+%endif
+%define so_v 0
+%define p_prefix %_prefix
+%define p_includedir %_includedir/%pname
+%define p_libdir %_libdir
+%define p_cmakedir %{p_libdir}/cmake/%{pname}
+%define num_threads 64
+
+%else
+%define package_name %{hpc_package_name %_vers}
+
+%define p_prefix %hpc_prefix
+%define p_includedir %hpc_includedir
+%define p_libdir %hpc_libdir
+%define p_cmakedir %{hpc_libdir}/cmake
+%define num_threads 256
+
+%{hpc_init -c %{compiler_family} %{?c_f_ver:-v %{c_f_ver}} %{?ext:-e %{ext}}}
+%endif
+
+Name: %{package_name}
+Version: %vers
Release: 0
Summary: An optimized BLAS library based on GotoBLAS2
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
+Source0: https://github.com/xianyi/OpenBLAS/archive/v%{version}.tar.gz#/%{pname}-%{version}.tar.gz
Source1: README.SUSE
+Source2: README.HPC.SUSE
# PATCH-FIX-UPSTREAM c_xerbla_no-void-return.patch
Patch1: c_xerbla_no-void-return.patch
# PATCH-FIX-UPSTREAM openblas-noexecstack.patch
Patch2: openblas-noexecstack.patch
+# PATCH-FIX-UPSTREADM fix-arm64-cpuid-return.patch
+Patch4: fix-arm64-cpuid-return.patch
+
BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+%if %{without hpc}
BuildRequires: gcc-fortran
BuildRequires: update-alternatives
Requires(post): update-alternatives
Requires(preun): update-alternatives
+%else
+BuildRequires: %{compiler_family}%{?c_f_ver}-compilers-hpc-macros-devel
+BuildRequires: lua-lmod
+BuildRequires: suse-hpc
+%global dep_summary %{summary}
+%endif
%description
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
-%package -n lib%{name}_serial0
-Summary: An optimized BLAS library based on GotoBLAS2, serial version
+%package -n lib%{name}%{?so_v}
+Summary: An optimized BLAS library based on GotoBLAS2, %{flavor} version
Group: System/Libraries
+%if %{without hpc}
Requires(post): update-alternatives
Requires(preun): update-alternatives
-Obsoletes: lib%{name}0 < %{version}
-Provides: lib%{name}0 = %{version}
+ %if "%flavor" == "serial"
+Obsoletes: lib%{pname}%{so_v} < %{version}
+Provides: lib%{pname}%{so_v} = %{version}
+ %else
+Obsoletes: lib%{pname}0
+ %endif
+ %if "%flavor" == "pthreads"
+Obsoletes: lib%{pname}p0
+ %endif
+ %if "%flavor" == "openmp"
+Obsoletes: lib%{pname}o0
+ %endif
+%else # with hpc
+Requires: lua-lmod
+%endif
-%description -n lib%{name}_serial0
+%description -n lib%{name}%{?so_v}
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}
+%{?with_hpc:%{hpc_master_package -l -L}}
-%description -n lib%{name}_serial-devel
+%package -n lib%{name}-devel
+Summary: Development libraries for OpenBLAS, %{flavor} version
+Group: Development/Libraries/C and C++
+Requires: lib%{name}%{?so_v} = %{version}
+%if %{without hpc}
+Requires: %{pname}-devel-headers = %{version}
+%else
+%hpc_requires_devel
+%endif
+
+%description -n lib%{name}-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
-Obsoletes: lib%{name}0
-Obsoletes: lib%{name}o0
-
-%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 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
-Obsoletes: lib%{name}0
-Obsoletes: lib%{name}p0
-
-%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}_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: %{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.
-
-This package contains the development libraries and headers for OpenBLAS.
-
-%package devel-headers
-Summary: Development headers for OpenBLAS
-Group: Development/Libraries/C and C++
-Conflicts: %{name}-devel < %{version}
-BuildArch: noarch
-
-%description devel-headers
-OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
-
-This package contains headers for OpenBLAS.
+%{?with_hpc:%{hpc_master_package -l -L devel}}
%package devel-static
Summary: Static version of OpenBLAS
Group: Development/Libraries/C and C++
-Requires: %{name}-devel = %{version}
+%if %{without hpc}
+Requires: %{pname}-devel = %{version}
+%else
+Requires: lib%{name}-devel = %{version}
+%endif
%description devel-static
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
This package contains the static libraries.
-%prep
-%setup -q -c -T
+%package -n %{pname}-devel
+Summary: Development headers and libraries for OpenBLAS
+Group: Development/Libraries/C and C++
+Requires: %{pname}-devel-headers = %{version}
+%ifarch %ix86 x86_64
+Requires: lib%{pname}_pthreads-devel = %{version}
+%else
+Requires: lib%{pname}_openmp-devel = %{version}
+%endif
-# Untar source
-tar -zxf %{SOURCE0}
-cd OpenBLAS-%{version}
+%description -n %{pname}-devel
+OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
+
+%package -n %{pname}-devel-headers
+Summary: Development headers for OpenBLAS
+Group: Development/Libraries/C and C++
+Conflicts: %{pname}-devel < %{version}
+BuildArch: noarch
+
+%description -n %{pname}-devel-headers
+OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
+
+This package contains headers for OpenBLAS.
+
+%prep
+
+%setup -q -n OpenBLAS-%{version}
%patch1 -p1
%patch2 -p1
-cd ..
-
-# Prepare build for serial, pthreads and OpenMP versions
-cp -ar OpenBLAS-%{version} openmp
-cp -ar OpenBLAS-%{version} pthreads
-mv OpenBLAS-%{version} serial
+%patch4 -p1
+%if %{without hpc}
cp %{SOURCE1} .
+%else
+cp %{SOURCE2} .
+%endif
%build
+
+%if %{with hpc}
+%hpc_debug
+%hpc_setup_compiler
+%endif
+
# Only x86/x86-64 CPUs support DYNAMIC_ARCH
%ifarch %ix86 x86_64
%define openblas_target DYNAMIC_ARCH=1
@@ -171,227 +252,206 @@ cp %{SOURCE1} .
%define openblas_target TARGET=ARMV8
%endif
# Make serial, threaded and OpenMP versions
-make -C serial %{?openblas_target} USE_THREAD=0 USE_OPENMP=0 LIBNAMESUFFIX=serial \
- FC=gfortran CC=gcc COMMON_OPT="%{optflags}" NUM_THREADS=64 V=1
-make -C openmp %{?openblas_target} USE_THREAD=1 USE_OPENMP=1 LIBNAMESUFFIX=openmp \
- FC=gfortran CC=gcc COMMON_OPT="%{optflags}" NUM_THREADS=64 V=1
-make -C pthreads %{?openblas_target} USE_THREAD=1 USE_OPENMP=0 LIBNAMESUFFIX=pthreads \
- FC=gfortran CC=gcc COMMON_OPT="%{optflags}" NUM_THREADS=64 V=1
+make %{?_smp_mflags} %{?openblas_target} %{?build_flags} \
+ COMMON_OPT="%{optflags}" \
+ NUM_THREADS=%{num_threads} V=1 \
+ OPENBLAS_LIBRARY_DIR=%{p_libdir} \
+ OPENBLAS_INCLUDE_DIR=%{hpc_includedir} \
+ OPENBLAS_CMAKE_DIR=%{p_cmakedir} \
+ PREFIX=%{p_prefix} \
+ %{!?with_hpc:LIBNAMESUFFIX=%flavor FC=gfortran CC=gcc}
%install
+%if %{with hpc}
+%hpc_setup_compiler
+%endif
+
# Install serial library and headers
-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
+%make_install %{?build_flags} \
+ OPENBLAS_LIBRARY_DIR=%{p_libdir} \
+ OPENBLAS_INCLUDE_DIR=%{p_includedir} \
+ OPENBLAS_CMAKE_DIR=%{p_cmakedir} \
+ PREFIX=%{p_prefix} \
+ %{!?with_hpc:LIBNAMESUFFIX=%flavor}
+
+# Delete info about OBS host cpu
+%ifarch %ix86 x86_64
+ sed -i '/#define OPENBLAS_NEEDBUNDERSCORE/,/#define OPENBLAS_VERSION/{//!d}' \
+ %{buildroot}%{p_includedir}/openblas_config.h
+%endif
+
+%if %{without hpc}
+
+%if 0%{!?build_devel:1}
+# We need the includes only once
+rm -rf %{buildroot}%{p_includedir}/
+rm -rf %{buildroot}%{p_libdir}/cmake/
+%else
+# Fix cmake config file
+sed -i 's|%{buildroot}||g' %{buildroot}%{p_cmakedir}/*.cmake
+sed -i 's|_serial||g' %{buildroot}%{p_cmakedir}/*.cmake
+%endif
# Put libraries in correct location
-rm -rf %{buildroot}%{_libdir}/lib%{name}*
+rm -rf %{buildroot}%{p_libdir}/lib%{name}*
# Install the serial library
-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/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 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
+install -D -p -m 755 lib%{name}.so %{buildroot}%{p_libdir}/lib%{name}.so.0
+install -D -p -m 644 lib%{name}.a %{buildroot}%{p_libdir}/lib%{name}.a
# Fix source permissions (also applies to LAPACK)
find -name \*.f -exec chmod 644 {} +
# Remove pkgconfig file, it can't be configured for different library suffixes we use and, as such, is useless
-rm -fr %{buildroot}%{_libdir}/pkgconfig/
+rm -fr %{buildroot}%{p_libdir}/pkgconfig/
# 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
+ln -s lib%{pname}.so.0 %{buildroot}/%{p_libdir}/lib%{pname}.so.0
+ln -s lib%{pname}.so.0 %{buildroot}/%{_sysconfdir}/alternatives/lib%{pname}.so.0
+ln -s lib%{pname}.so.0 %{buildroot}/%{p_libdir}/libblas.so.3
+ln -s lib%{pname}.so.0 %{buildroot}/%{p_libdir}/libcblas.so.3
+ln -s lib%{pname}.so.0 %{buildroot}/%{p_libdir}/liblapack.so.3
+ln -s lib%{pname}.so.0 %{buildroot}/%{_sysconfdir}/alternatives/libblas.so.3
+ln -s lib%{pname}.so.0 %{buildroot}/%{_sysconfdir}/alternatives/libcblas.so.3
+ln -s lib%{pname}.so.0 %{buildroot}/%{_sysconfdir}/alternatives/liblapack.so.3
# Fix symlinks
-pushd %{buildroot}%{_libdir}
+pushd %{buildroot}%{p_libdir}
+%if 0%{?build_devel}
+ln -sf lib%{pname}.so.0 lib%{pname}.so
+%endif
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
-# Threaded libraries
-ln -sf lib%{name}_pthreads.so.0 lib%{name}_pthreads.so
-# Fix cmake config file
-sed -i 's|%{buildroot}||g' %{buildroot}%{_libdir}/cmake/%{name}/*.cmake
-sed -i 's|_serial||g' %{buildroot}%{_libdir}/cmake/%{name}/*.cmake
+%else # with hpc
-# Delete info about OBS host cpu
-%ifarch %ix86 x86_64
-sed -i '/#define OPENBLAS_NEEDBUNDERSCORE/,/#define OPENBLAS_VERSION/{//!d}' %{buildroot}%{_includedir}/%{name}/openblas_config.h
-%endif
+# HPC module file
+%hpc_write_modules_files
+#%%Module1.0#####################################################################
-%post -n lib%{name}_serial0
+proc ModulesHelp { } {
+
+puts stderr " "
+puts stderr "This module loads the %{pname} library built with the %{compiler_family} compiler toolchain."
+puts stderr "\nVersion %{version}\n"
+
+}
+module-whatis "Name: %{PNAME} built with %{compiler_family} toolchain"
+module-whatis "Version: %{version}"
+module-whatis "Category: runtime library"
+module-whatis "Description: %{dep_summary}"
+module-whatis "%{url}"
+
+set version %{version}
+
+prepend-path LD_LIBRARY_PATH %{p_libdir}
+
+setenv %{hpc_upcase %pname}_DIR %{hpc_prefix}
+
+if {[file isdirectory %{hpc_includedir}]} {
+prepend-path LIBRARY_PATH %{hpc_libdir}
+prepend-path CPATH %{hpc_includedir}
+prepend-path C_INCLUDE_PATH %{hpc_includedir}
+prepend-path CPLUS_INCLUDE_PATH %{hpc_includedir}
+prepend-path INCLUDE %{hpc_includedir}
+%hpc_modulefile_add_pkgconfig_path
+
+setenv %{hpc_upcase %pname}_LIB %{hpc_libdir}
+}
+
+family "openblas"
+EOF
+%{hpc_write_pkgconfig -l %{pname}}
+
+%endif # with hpc
+
+%if %{without hpc}
+
+%post -n lib%{name}%{so_v}
%{_sbindir}/update-alternatives --install \
- %{_libdir}/libblas.so.3 libblas.so.3 %{_libdir}/lib%{name}_serial.so.0 20
+ %{p_libdir}/libblas.so.3 libblas.so.3 %{p_libdir}/lib%{name}.so.%{so_v} 20
%{_sbindir}/update-alternatives --install \
- %{_libdir}/libcblas.so.3 libcblas.so.3 %{_libdir}/lib%{name}_serial.so.0 20
+ %{p_libdir}/libcblas.so.3 libcblas.so.3 %{p_libdir}/lib%{name}.so.%{so_v} 20
%{_sbindir}/update-alternatives --install \
- %{_libdir}/liblapack.so.3 liblapack.so.3 %{_libdir}/lib%{name}_serial.so.0 20
+ %{p_libdir}/liblapack.so.3 liblapack.so.3 %{p_libdir}/lib%{name}.so.%{so_v} 20
%{_sbindir}/update-alternatives --install \
- %{_libdir}/lib%{name}.so.0 lib%{name}.so.0 %{_libdir}/lib%{name}_serial.so.0 20
+ %{p_libdir}/lib%{pname}.so.%{so_v} lib%{name}.so.%{so_v} %{p_libdir}/lib%{name}.so.%{so_v} %openblas_so_prio
/sbin/ldconfig
-%preun -n lib%{name}_serial0
+%preun -n lib%{name}%{so_v}
if [ "$1" = 0 ] ; then
- %{_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
+ %{_sbindir}/update-alternatives --remove libblas.so.3 %{p_libdir}/lib%{name}.so.%{so_v}
+ %{_sbindir}/update-alternatives --remove libcblas.so.3 %{p_libdir}/lib%{name}.so.%{so_v}
+ %{_sbindir}/update-alternatives --remove liblapack.so.3 %{p_libdir}/lib%{name}.so.%{so_v}
+ %{_sbindir}/update-alternatives --remove lib%{name}.so.0 %{p_libdir}/lib%{name}.so.%{so_v}
fi
-%postun -n lib%{name}_serial0 -p /sbin/ldconfig
+%postun -n lib%{name}%{so_v} -p /sbin/ldconfig
-%posttrans -n lib%{name}_serial0
+%posttrans -n lib%{name}%{so_v}
if [ "$1" = 0 ] ; then
- if ! [ -f %{_libdir}/lib%{name}.so.0 ] ; then
- %{_sbindir}/update-alternatives --auto lib%{name}.so.0
+ if ! [ -f %{p_libdir}/lib%{name}.so.%{so_v} ] ; then
+ %{_sbindir}/update-alternatives --auto lib%{pname}.so.%{so_v}
fi
fi
-%post -n lib%{name}_openmp0
-%{_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
+
+%postun -n lib%{name}
+%hpc_module_delete_if_default
+
%endif
-/sbin/ldconfig
-%preun -n lib%{name}_openmp0
-if [ "$1" = 0 ] ; then
- %{_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 lib%{name}_openmp0 -p /sbin/ldconfig
-
-%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
-%{_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
+%if %{without hpc}
+%define libname %name
%else
- %{_libdir}/lib%{name}.so.0 lib%{name}.so.0 %{_libdir}/lib%{name}_pthreads.so.0 20
+%define libname %pname
%endif
-/sbin/ldconfig
-%preun -n lib%{name}_pthreads0
-if [ "$1" = 0 ] ; then
- %{_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 lib%{name}_pthreads0 -p /sbin/ldconfig
-
-%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 lib%{name}_serial0
+%files -n lib%{name}%{?so_v}
%defattr(-,root,root,-)
-%{_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
+%{p_libdir}/lib%{libname}.so.0
+%if %{without hpc}
+%ghost %{p_libdir}/lib%{pname}.so.%{so_v}
+%ghost %{p_libdir}/libblas.so.3
+%ghost %{p_libdir}/libcblas.so.3
+%ghost %{p_libdir}/liblapack.so.3
+%ghost %{_sysconfdir}/alternatives/lib%{pname}.so.%{so_v}
%ghost %{_sysconfdir}/alternatives/libblas.so.3
%ghost %{_sysconfdir}/alternatives/libcblas.so.3
%ghost %{_sysconfdir}/alternatives/liblapack.so.3
+%else
+%hpc_dirs
+%{p_libdir}/libopenblas*r*.so
+%hpc_modules_files
+%endif
-%files -n lib%{name}_serial-devel
+%files -n lib%{name}-devel
%defattr(-,root,root,-)
-%{_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}_openmp-devel
-%defattr(-,root,root,-)
-%{_libdir}/lib%{name}_openmp.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}_pthreads-devel
-%defattr(-,root,root,-)
-%{_libdir}/lib%{name}_pthreads.so
-
-%files devel
-%defattr(-,root,root,-)
-%doc serial/Changelog.txt serial/GotoBLAS* serial/LICENSE serial/README.md README.SUSE
-%{_libdir}/lib%{name}.so
-%dir %{_libdir}/cmake
-%{_libdir}/cmake/%{name}/
-
-%files devel-headers
-%defattr(-,root,root,-)
-%{_includedir}/%{name}/
+%{p_libdir}/lib%{libname}.so
+%if %{with hpc}
+%doc Changelog.txt GotoBLAS* LICENSE README.md README.HPC.SUSE
+%hpc_pkgconfig_file
+%{p_cmakedir}/
+%{p_includedir}/
+%endif
%files devel-static
%defattr(-,root,root,-)
-%{_libdir}/lib%{name}_serial.a
-%{_libdir}/lib%{name}_openmp.a
-%{_libdir}/lib%{name}_pthreads.a
+#%%{p_libdir}/lib%{libname}.a
+%{p_libdir}/libopenblas*.a
+
+%if 0%{?build_devel}
+%files -n %{pname}-devel
+%defattr(-,root,root,-)
+%doc Changelog.txt GotoBLAS* LICENSE README.md README.SUSE
+%{p_libdir}/libopenblas.so
+%dir %{p_libdir}/cmake
+%{p_cmakedir}/
+
+%files -n %{pname}-devel-headers
+%defattr(-,root,root,-)
+%{p_includedir}/
+%endif
%changelog