LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File libatlas3-sse.spec of Package libatlas3 (Project home:X0F:branches:multimedia)

#
# spec file for package libatlas3
#
# Copyright (c) 2016 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/
#


%define enable_native_atlas 0
%define flavor sse
%define uaprio 60

Name:           libatlas3
Version:        3.10.3
Release:        0
Summary:        Automatically Tuned Linear Algebra Software
License:        BSD-3-Clause and GPL-2.0
Group:          Development/Libraries/C and C++
Url:            http://math-atlas.sourceforge.net/

Source:         atlas%{version}.tar.bz2
Source2:        README.SuSE
Source3:        POWER332.tar.bz2
Source5:        %name-rpmlintrc
Patch0:         atlas-suse-shared.patch
Patch1:         atlas-hack.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  gcc-fortran
BuildRequires:  lapack-devel
BuildRequires:  update-alternatives
PreReq:         update-alternatives
%if "%flavor" == "sse" || "%flavor" == "sse2"
ExclusiveArch:  %ix86
%endif

%description
The ATLAS (Automatically Tuned Linear Algebra Software) project is an
ongoing research effort focusing on applying empirical techniques in
order to provide portable performance. At present, it provides C and
Fortran77 interfaces to a portably efficient BLAS implementation, as
well as a few routines from LAPACK.

The performance improvements in ATLAS are obtained largely via
compile-time optimizations and tend to be specific to a given hardware
configuration. In order to package ATLAS for openSUSE some compromises
are necessary so that good performance can be obtained on a variety
of hardware. This set of ATLAS binary packages is therefore not
necessarily optimal for any specific hardware configuration.  However,
the source package can be used to compile customized ATLAS packages;
see the documentation for information.

%package basic
Summary:        Development libraries for ATLAS
License:        BSD-3-Clause
Group:          System/Libraries

%description basic
The ATLAS (Automatically Tuned Linear Algebra Software) project is an
ongoing research effort focusing on applying empirical techniques in
order to provide portable performance. At present, it provides C and
Fortran77 interfaces to a portably efficient BLAS implementation, as
well as a few routines from LAPACK.

%package basic-devel
Summary:        Dummy package to please the specfile parser, otherwise empty
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++

%description basic-devel

%package devel
Summary:        Development libraries for ATLAS
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description devel
This package contains the static libraries and headers for development
with ATLAS (Automatically Tuned Linear Algebra Software).

%package sse
Summary:        ATLAS libraries for SSE extensions
License:        BSD-3-Clause
Group:          System/Libraries
Obsoletes:      %{name} < %{version}-%{release}
Provides:       %{name} = %{version}-%{release}
Obsoletes:      %{name}-3dnow < 3.9
Provides:       %{name}-3dnow = %{version}-%{release}
PreReq:         update-alternatives

%description sse
This package contains the ATLAS (Automatically Tuned Linear Algebra
Software) libraries compiled with optimizations for the SSE(1) extensions
to the ix86 architecture. openSUSE also produces ATLAS build with SSE2 and SSE3
extensions.

%package sse-devel
Summary:        Development libraries for ATLAS with SSE extensions
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Requires:       %{name}-devel = %{version}-%{release}
Requires:       %{name}-sse = %{version}-%{release}
Obsoletes:      %{name}-3dnow-devel < 3.9
Provides:       %{name}-3dnow-devel = %{version}-%{release}

%description sse-devel
This package contains headers and static versions of the ATLAS
(Automatically Tuned Linear Algebra Software) libraries compiled with
optimizations for the SSE(1) extensions to the ix86 architecture.

%package sse2
Summary:        ATLAS libraries for SSE2 extensions
License:        BSD-3-Clause
Group:          System/Libraries
Obsoletes:      %{name} < 3.9
Provides:       %{name} = %{version}-%{release}
Obsoletes:      %{name} < %{version}-%{release}
Provides:       %{name} = %{version}-%{release}
PreReq:         update-alternatives

%description sse2
This package contains the ATLAS (Automatically Tuned Linear Algebra
Software) libraries compiled with optimizations for the SSE2
extensions to the ix86 architecture. openSUSE also produces ATLAS build with
SSE(1) and SSE3 extensions.

%package sse2-devel
Summary:        Development libraries for ATLAS with SSE2 extensions
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Requires:       %{name}-devel = %{version}-%{release}
Requires:       %{name}-sse2 = %{version}-%{release}
Obsoletes:      %{name}-devel < 3.9
Provides:       %{name}-devel = %{version}-%{release}

%description sse2-devel
This package contains headers and static versions of the ATLAS
(Automatically Tuned Linear Algebra Software) libraries compiled with
optimizations for the SSE2 extensions to the ix86 architecture.

%package sse3
Summary:        ATLAS libraries for SSE3 extensions
License:        BSD-3-Clause
Group:          System/Libraries
Provides:       %{name} = %{version}-%{release}
Obsoletes:      %{name} < %{version}-%{release}
PreReq:         update-alternatives

%description sse3
This package contains the ATLAS (Automatically Tuned Linear Algebra
Software) libraries compiled with optimizations for the SSE3.
openSUSE also produces ATLAS build with SSE(1) and SSE2 extensions.

%package sse3-devel
Summary:        Development libraries for ATLAS with SSE3 extensions
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Requires:       %{name}-devel = %{version}-%{release}
Requires:       %{name}-sse3 = %{version}-%{release}

%description sse3-devel
This package contains headers and static versions of the ATLAS
(Automatically Tuned Linear Algebra Software) libraries compiled with
optimizations for the sse3 extensions to the ix86 architecture.

%package avx
Summary:        ATLAS libraries for AVX1 extensions
License:        BSD-3-Clause
Group:          System/Libraries
Provides:       %{name} = %{version}-%{release}
Obsoletes:      %{name} < %{version}-%{release}
PreReq:         update-alternatives

%description avx
This package contains the ATLAS (Automatically Tuned Linear Algebra
Software) libraries compiled with optimizations for AVX.

%package avx-devel
Summary:        Development libraries for ATLAS with AVX extensions
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Requires:       %{name}-avx = %{version}-%{release}
Requires:       %{name}-devel = %{version}-%{release}

%description avx-devel
This package contains headers and static versions of the ATLAS
(Automatically Tuned Linear Algebra Software) libraries compiled with
optimizations for the AVX extensions to the ix86 architecture.

%prep
%setup -q -n ATLAS
%patch0 -p1
%ifarch x86_64 i586
%patch1
%endif

cp %{SOURCE2} doc

cp %{SOURCE3} CONFIG/ARCHS/

%build
#Architectural enums (Config's enum MACHTYPE): 0 = UNKNOWN 1 = POWER3 2 =
#POWER4 3 = POWER5 4 = PPCG4 5 = PPCG5 6 = POWER6 7 = POWER7 8 = POWERe6500 9 =
#IBMz9 10 = IBMz10 11 = IBMz196 12 = x86x87 13 = x86SSE1 14 = x86SSE2 15 =
#x86SSE3 16 = P5 17 = P5MMX 18 = PPRO 19 = PII 20 = PIII 21 = PM 22 = CoreSolo
#23 = CoreDuo 24 = Core2Solo 25 = Core2 26 = Corei1 27 = Corei2 28 = Corei3 29
#= Atom 30 = P4 31 = P4E 32 = Efficeon 33 = K7 34 = HAMMER 35 = AMD64K10h 36 =
#AMDLLANO 37 = AMDDOZER 38 = AMDDRIVER 39 = UNKNOWNx86 40 = IA64Itan 41 =
#IA64Itan2 42 = USI[UltraSparc1] 43 = USII 44 = USIII 45 = USIV 46 = UST1 47 =
#UST2 48 = UnknownUS 49 = MIPSR1xK 50 = MIPSICE9 51 = ARMv7
#ISA extensions are combined by adding their values together (bitvector):
#none: 1 VSX: 2 AltiVec: 4 AVXMAC: 8 AVXFMA4: 16 AVX: 32 SSE3: 64 SSE2: 128
#SSE1: 256 3DNow: 512 NEON: 1024
configureflags=""
%if "%flavor" == "basic"
# for basic
# do not set -V -A and let ATLAS build to analyse architecture.
%endif

%if "%flavor" == "sse"
# The -A value chosen stems from earlier versions of libatlas3.spec.
# They (probably) affect -mtune rather than -march.
configureflags="-V 256 -A 20"
%endif
%if "%flavor" == "sse2"
configureflags="-V $((256|128)) -A 14"
%endif
%if "%flavor" == "sse3"
configureflags="-V $((256|128|64)) -A 15"
%endif
%if "%flavor" == "avx"
configureflags="-V $((256|128|64|32)) -A 15"
%endif

lscpu || :
mkdir build
pushd build
export CFLAGS="-g -w %{optflags}"  
%ifarch armv7hl
export CFLAGS="$CFLAGS -mfloat-abi=hard"
%endif
export CXXFLAGS="-g -w %{optflags}"  
../configure -b %__isa_bits --shared \
	--prefix=%{buildroot}%{_prefix}			\
	--incdir=%{buildroot}%{_includedir}		\
	--libdir=%{buildroot}%{_libdir}/atlas-%flavor \
	$configureflags

%ifarch ppc
#sed -i 's#ARCH =.*#ARCH = POWER332#' Make.inc
#sed -i 's#-DATL_ARCH_POWER7#-DATL_ARCH_POWER3#g' Make.inc
#sed -i 's#power7#power3#g' Make.inc
#sed -i 's#-DATL_VSX##g' Make.inc
#sed -i 's#-mvsx##g' Make.inc
#sed -i 's#-DATL_AltiVec##g' Make.inc
grep m64 Make.inc || :
sed -i 's#-m64#-m32#g' Make.inc
%endif
cat Make.inc
# not parallel safe - boo#959154
make

#check
#pushd build
# still make check errors for some arch except ppc64le.
#ifarch ppc64le
#make check ptcheck
#else
#make check ptcheck || echo "Warning: ignore check error for ppc64"
#endif
#popd

%install
pushd build/
%makeinstall
cp -pr lib/*.so* %{buildroot}%{_libdir}/atlas-%flavor/
popd

%if "%flavor" == "basic"
mv %{buildroot}%{_includedir}/*.h %{buildroot}%{_includedir}/atlas/
%else
# The header files between different flavors differ a little,
# but not in the ABI. So share them between all flavors.
rm -Rf "%buildroot/%_includedir"
%endif

mkdir -p %{buildroot}/etc/ld.so.conf.d
echo "%{_libdir}/atlas"	> %{buildroot}/etc/ld.so.conf.d/atlas-%{_arch}.conf
mkdir -p %{buildroot}%{_libdir}/atlas

%post %flavor
"%_sbindir/update-alternatives" --install %_libdir/libblas.so.3   libblas.so.3   %_libdir/atlas-%flavor/libsatlas.so.3 %uaprio
"%_sbindir/update-alternatives" --install %_libdir/liblapack.so.3 liblapack.so.3 %_libdir/atlas-%flavor/libsatlas.so.3 %uaprio
"%_sbindir/update-alternatives" --install %_libdir/libblas.so.3   libblas.so.3   %_libdir/atlas-%flavor/libtatlas.so.3 %uaprio
"%_sbindir/update-alternatives" --install %_libdir/liblapack.so.3 liblapack.so.3 %_libdir/atlas-%flavor/libtatlas.so.3 %uaprio
/sbin/ldconfig

%preun %flavor
if [ "$1" = 0 ] ; then
	"%_sbindir/update-alternatives" --remove libblas.so.3   %_libdir/atlas-%flavor/libsatlas.so.3
	"%_sbindir/update-alternatives" --remove liblapack.so.3 %_libdir/atlas-%flavor/libsatlas.so.3
	"%_sbindir/update-alternatives" --remove libblas.so.3   %_libdir/atlas-%flavor/libtatlas.so.3
	"%_sbindir/update-alternatives" --remove liblapack.so.3 %_libdir/atlas-%flavor/libtatlas.so.3
fi

%postun %flavor -p /sbin/ldconfig

%post %flavor-devel
"%_sbindir/update-alternatives" \
 	--install %_libdir/atlas/libatlas.a   libatlas.a     %_libdir/atlas-%flavor/libatlas.a %uaprio \
	--slave %_libdir/atlas/libptf77blas.a libptf77blas.a %_libdir/atlas-%flavor/libptf77blas.a \
	--slave %_libdir/atlas/libptcblas.a   libptcblas.a   %_libdir/atlas-%flavor/libptcblas.a \
	--slave %_libdir/atlas/libf77blas.a   libf77blas.a   %_libdir/atlas-%flavor/libf77blas.a \
	--slave %_libdir/atlas/libcblas.a     libcblas.a     %_libdir/atlas-%flavor/libcblas.a \
	--slave %_libdir/atlas/liblapack.a    liblapack.a    %_libdir/atlas-%flavor/liblapack.a

%preun %flavor-devel
if [ "$1" = 0 ]; then
	"%_sbindir/update-alternatives" --remove libatlas.a %_libdir/atlas-%flavor/libatlas.a
fi

%if %flavor == basic
%files devel
%defattr(-,root,root)
%_includedir/atlas/
%endif

%files %flavor
%defattr(-,root,root)
%doc doc/README.SuSE
%config(noreplace) /etc/ld.so.conf.d/atlas-%{_arch}.conf
%dir %{_libdir}/atlas
%dir %{_libdir}/atlas-%flavor
%{_libdir}/atlas-%flavor/lib*.so.*

%files %flavor-devel
%defattr(-,root,root)
%doc doc
%dir %{_libdir}/atlas-%flavor
%{_libdir}/atlas-%flavor/*.so
%{_libdir}/atlas-%flavor/*.a

%changelog