superlu/superlu.spec

248 lines
6.6 KiB
RPMSpec
Raw Normal View History

#
# spec file for package superlu
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%global flavor @BUILD_FLAVOR@%{nil}
# Base package name
%define pname superlu
%define ver 5.2.1
%define _ver %(echo %{ver} | tr . _)
%if "%flavor" == ""
ExclusiveArch: do_not_build
%endif
%if "%{flavor}" == "serial"
%bcond_with hpc
%endif
%if "%{flavor}" == "gnu-hpc"
%bcond_without hpc
%global compiler_family gnu
%undefine c_f_ver
%endif
%bcond_with ringdisabled
%if %{with hpc} && %{with ringdisabled}
ExclusiveArch: do_not_build
%endif
%define package_name %pname
%if %{without hpc}
%define p_includedir %_includedir
%define p_libdir %_libdir
%define _sover 5
%else
%{hpc_init -c %compiler_family %{?c_f_ver:-v %{c_f_ver}} %{?ext:-e %{ext}}}
%define package_name %{hpc_package_name %_ver}
%define p_includedir %hpc_includedir
%define p_libdir %hpc_libdir
%endif
Name: %{package_name}
Summary: A general purpose library for the direct solution of linear equations
License: BSD-3-Clause
Group: Development/Libraries/C and C++
Version: %{ver}
Release: 0
Source: http://crd-legacy.lbl.gov/%7Exiaoye/SuperLU/%{pname}_%{version}.tar.gz
Source1: superlu_ug.pdf
Source2: README.SUSE
# PATCH-FEATURE-OPENSUSE superlu-5.2-make.patch : add compiler and build flags in make.inc
Patch0: superlu-5.2-make.patch
# PATCH-FIX-UPSTREAM superlu-4.3-include.patch : avoid implicit declaration warnings
Patch1: superlu-4.3-include.patch
# PATCH-FIX-UPSTREAM superlu-4.3-dont-opt-away.diff
Patch2: superlu-4.3-dont-opt-away.diff
# PATCH-FIX-OPENSUSE superlu-5.2-remove-mc64ad.patch [bnc#796236]
# The Harwell Subroutine Library (HSL) routine mc64ad.c have been removed
# from the original sources for legal reasons. This patch disables the inclusion of
# this routine in the library which, however, remains fully functional
Patch3: superlu-5.2-remove-mc64ad.patch
URL: http://crd.lbl.gov/~xiaoye/SuperLU/
BuildRequires: cmake >= 2.8.12
BuildRequires: fdupes
BuildRequires: tcsh
%if %{without hpc}
BuildRequires: blas-devel
BuildRequires: gcc-fortran
%else
Requires: %{compiler_family}%{?c_f_ver}-compilers-hpc
BuildRequires: %{compiler_family}%{?c_f_ver}-compilers-hpc-macros-devel
BuildRequires: libopenblas%{?hpc_ext}-%{compiler_family}%{?c_f_ver}-hpc-devel
BuildRequires: suse-hpc >= 0.3
%hpc_requires
%hpc_requires_devel
%endif
%description
SuperLU is an algorithm that uses group theory to optimize LU
decomposition of sparse matrices.
Docu can be found in the %{name}-doc package or on http://www.netlib.org.
%package -n lib%{name}%{?_sover}
Summary: SuperLU matrix solver
Group: System/Libraries
%description -n lib%{name}%{?_sover}
SuperLU is an algorithm that uses group theory to optimize LU
decomposition of sparse matrices.
%package devel
Summary: Headers and development library for lib%{name}%{?_sover}
Group: Development/Libraries/C and C++
Requires: lib%{name}%{?_sover} = %version
Recommends: %name-doc
%description devel
SuperLU headers and libraries files needed for development
%package doc
Summary: Documentation for %name
Group: Documentation/Other
%description doc
Documentation (HTML/PDF) for SuperLU.
SuperLU is an algorithm that uses group theory to optimize LU
decomposition of sparse matrices.
%package examples
Summary: Examples for %name
Group: Documentation/Other
Recommends: %name-devel
%description examples
Example programs for SuperLU.
SuperLU is an algorithm that uses group theory to optimize LU
decomposition of sparse matrices.
%if %{with hpc}
%{hpc_master_package -l -L}
%{hpc_master_package devel}
%{hpc_master_package doc}
%{hpc_master_package examples}
%endif
%prep
%setup -q -n SuperLU_%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
cp %SOURCE1 %SOURCE2 ./
# Create baselib.conf dynamically (non-HPC build only).
%if %{without hpc}
cat > %{_sourcedir}/baselibs.conf <<EOF
lib%{name}%{?_sover}
EOF
%endif
%build
%{?hpc_setup}
%if %{without hpc}
%cmake \
%else
module load openblas
%hpc_cmake \
%endif
-DCMAKE_BUILD_TYPE=Release -DUSE_XSDK_DEFAULTS='TRUE' -Denable_tests=OFF
make %{?_smp_mflags}
%install
%cmake_install
#fix permissions
chmod 644 MATLAB/*
# remove all build examples
cd EXAMPLE
make clean
rm -rf *itersol* .gitignore
cd ..
mv EXAMPLE examples
rm -f examples/.gitignore
cp FORTRAN/README README.fortran
%fdupes -s examples
%if %{with hpc}
# TODO: is there any path to add for Matlab files?
%hpc_write_modules_files
#%Module1.0#####################################################################
proc ModulesHelp { } {
puts stderr " "
puts stderr "This module loads the SuperLU library built with the %{compiler_family} compiler"
puts stderr "toolchain."
puts stderr " "
puts stderr "Note that this build of SuperLU leverages the OpenBLAS linear algebra libraries."
puts stderr "Consequently, openblas is loaded automatically with this module."
puts stderr "\nVersion %{version}\n"
}
module-whatis "Name: %{pname} built with %{compiler_family} compiler"
module-whatis "Version: %{version}"
module-whatis "Category: runtime library"
module-whatis "%{url}"
set version %{version}
depends-on openblas
prepend-path INCLUDE %{hpc_includedir}
prepend-path LD_LIBRARY_PATH %{hpc_libdir}
setenv %{hpc_PNAME %pname}_DIR %{hpc_prefix}
setenv %{hpc_PNAME %pname}_INC %{hpc_includedir}
setenv %{hpc_PNAME %pname}_LIB %{hpc_libdir}
EOF
%endif
%if %{without hpc}
%post -n lib%{name}%{?_sover} -p /sbin/ldconfig
%postun -n lib%{name}%{?_sover} -p /sbin/ldconfig
%else
%post -n lib%{name}%{?_sover}
/sbin/ldconfig -N %hpc_libdir
%postun -n lib%{name}%{?_sover}
/sbin/ldconfig -N %hpc_libdir
%endif
%files -n lib%{name}%{?_sover}
%doc README MATLAB README.SUSE
%{?hpc_dirs}
%{?hpc_modules_files}
%{p_libdir}/*.so.*
%files devel
%doc README.fortran
%{p_includedir}/%{!?with_hpc:*}
%{p_libdir}/*.so
%files doc
%doc DOC/html superlu_ug.pdf
%files examples
%doc examples
%changelog