openblas/openblas.spec
Corot Sebastien 467c75daaa Accepting request 143758 from home:scorot:branches:science
- version 0.2.5
 * Export LAPACK 3.4.2 symbols in shared library. (#147)
 * Restore the original CPU affinity when calling 
   openblas_set_num_threads(1) (#153)
 * Fixed a SEGFAULT bug in dgemv_t when m is very large.(#154)

OBS-URL: https://build.opensuse.org/request/show/143758
OBS-URL: https://build.opensuse.org/package/show/science/openblas?expand=0&rev=15
2012-12-01 14:37:19 +00:00

221 lines
7.1 KiB
RPMSpec

#
# spec file for package openblas
#
# Copyright (c) 2012 SUSE LINUX Products 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/
#
Name: openblas
Version: 0.2.5
Release: 0
Summary: An optimized BLAS library based on GotoBLAS2
License: BSD-3-Clause
Group: System/Libraries
Url: https://github.com/xianyi/OpenBLAS/
# Tarball gotten from
# https://github.com/xianyi/OpenBLAS/tarball/v%{version}
Source0: xianyi-OpenBLAS-v%{version}-0-ge01b3d4.tar.gz
# LAPACK
Source1: http://www.netlib.org/lapack/lapack-3.4.2.tgz
# Link against libgfortran
Patch0: openblas-0.1.1-libs.patch
Patch1: c_xerbla_no-void-return.patch
Patch2: openblas-0.1.0-soname.patch
Patch3: openblas-0.2.1-noexecstack.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: gcc-fortran
# For execstack
# BuildRequires: prelink
%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
%package -n libopenblas0
Summary: An optimized BLAS library based on GotoBLAS2, serial version
Group: System/Libraries
%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
%package -n libopenblaso0
Summary: An optimized BLAS library based on GotoBLAS2, OpenMP version
Group: System/Libraries
%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
This package contains the library compiled with OpenMP support.
%package -n libopenblasp0
Summary: An optimized BLAS library based on GotoBLAS2, pthreads version
Group: System/Libraries
%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
This package contains the library compiled with threading support.
%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}
%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
This package contains the development headers and libraries.
%package devel-static
Summary: Static version of OpenBLAS
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
This package contains the static libraries.
%prep
%setup -q -c -T
# Untar source
tar zxf %{SOURCE0}
mv xianyi-OpenBLAS-*/ xianyi-OpenBLAS
cd xianyi-OpenBLAS
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
cd ..
# prepare build for serial, threaded and OpenMP versions
cp -ar xianyi-OpenBLAS openmp
cp -ar xianyi-OpenBLAS threaded
mv xianyi-OpenBLAS serial
# Copy LAPACK sources
for dir in openmp threaded serial; do
cp %{SOURCE1} $dir
done
%build
# Make serial, threaded and OpenMP versions
make -C serial DYNAMIC_ARCH=1 USE_THREAD=0 USE_OPENMP=0 \
FC=gfortran CC=gcc COMMON_OPT="%{optflags}" NUM_THREADS=32
make -C openmp DYNAMIC_ARCH=1 USE_THREAD=0 USE_OPENMP=1 LIBNAMESUFFIX=o \
FC=gfortran CC=gcc COMMON_OPT="%{optflags}" NUM_THREADS=32
make -C threaded DYNAMIC_ARCH=1 USE_THREAD=1 USE_OPENMP=0 LIBNAMESUFFIX=p \
FC=gfortran CC=gcc COMMON_OPT="%{optflags}" NUM_THREADS=32
%install
rm -rf %{buildroot}
# 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}
# Put libraries in correct location
rm -rf %{buildroot}%{_prefix}/lib
mkdir -p %{buildroot}%{_libdir}
# Install the serial library
install -D -p -m 755 serial/libopenblas.so %{buildroot}%{_libdir}/lib%{name}.so.%{version}
install -D -p -m 644 serial/libopenblas.a %{buildroot}%{_libdir}/lib%{name}.a
# Install the OpenMP library
install -D -p -m 755 openmp/libopenblaso.so %{buildroot}%{_libdir}/lib%{name}o.so.%{version}
install -D -p -m 644 openmp/libopenblaso.a %{buildroot}%{_libdir}/lib%{name}o.a
# Install the threaded library
install -D -p -m 755 threaded/libopenblasp.so %{buildroot}%{_libdir}/lib%{name}p.so.%{version}
install -D -p -m 644 threaded/libopenblasp.a %{buildroot}%{_libdir}/lib%{name}p.a
# Fix source permissions (also applies to LAPACK)
find -name \*.f -exec chmod 644 {} \;
# Fix symlinks
pushd %{buildroot}%{_libdir}
# Serial libraries
ln -sf lib%{name}.so.%{version} lib%{name}.so.0
ln -sf lib%{name}.so.0 lib%{name}.so
# OpenMP libraries
ln -sf lib%{name}o.so.%{version} lib%{name}o.so.0
ln -sf lib%{name}o.so.0 lib%{name}o.so
# Threaded libraries
ln -sf lib%{name}p.so.%{version} 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
%post -n libopenblas0 -p /sbin/ldconfig
%postun -n libopenblas0 -p /sbin/ldconfig
%post -n libopenblaso0 -p /sbin/ldconfig
%postun -n libopenblaso0 -p /sbin/ldconfig
%post -n libopenblasp0 -p /sbin/ldconfig
%postun -n libopenblasp0 -p /sbin/ldconfig
%clean
rm -rf %{buildroot}
%files -n libopenblas0
%defattr(-,root,root,-)
%doc serial/Changelog.txt serial/GotoBLAS* serial/LICENSE serial/README.md
%{_libdir}/lib%{name}.so.*
%files -n libopenblaso0
%defattr(-,root,root,-)
%{_libdir}/lib%{name}o.so.*
%files -n libopenblasp0
%defattr(-,root,root,-)
%{_libdir}/lib%{name}p.so.*
%files devel
%defattr(-,root,root,-)
%{_includedir}/%{name}
%{_libdir}/lib%{name}.so
%{_libdir}/lib%{name}o.so
%{_libdir}/lib%{name}p.so
%files devel-static
%defattr(-,root,root,-)
%{_libdir}/lib%{name}.a
%{_libdir}/lib%{name}o.a
%{_libdir}/lib%{name}p.a
%changelog