File atlas.spec of Package atlas

Group:      Development/Libraries
Name:       atlas

Prefix:     /usr
Release:    1
Version:    3.8.0
Source:     atlas%{version}.tar.bz2
Patch:	    complete.shared.patch

URL:        http://math-atlas.sourceforge.net
Summary:    self-tuned implementation of blas and partial lapack.
License:    Freely distributable

BuildRoot:      /var/tmp/atlas-buildroot
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}  
#BuildRequires:  compat-gcc-34-g77 compat-libf2c-34
BuildRequires:  gcc-gfortran gcc lapack3-pic
requires:   	gcc-gfortran gcc
%endif

%if 0%{?suse_version} 
#BuildRequires:  compat-g77
BuildRequires:  gcc-fortran gcc lapack3-pic
requires:   	gcc-fortran gcc
%endif

Packager:       David Cournapeau <cournape@gmail.com>

# Common values
#%define STATICBLASNAME libblas.a
#%define SHAREDBLASNAME libblas.so
#%define SOVERSIONMAJOR 3
#%define SOVERSIONMINOR 0
#%define SOVERSIONMICRO 0
#%define SHAREDFULLBLASNAME %{SHAREDBLASNAME}.%{SOVERSIONMAJOR}.%{SOVERSIONMINOR}.%{SOVERSIONMICRO}
#
#provides:   %{SHAREDBLASNAME}.%{SOVERSIONMAJOR}
#conflicts:  blas

%define F77 gfortran

%description

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 devel
#Summary:        BLAS development libraries
#Group:          Development/Libraries
#provides:   	%{STATICBLASNAME} 
#requires:	refblas3
#conflicts:	blas
#
#%description devel
#BLAS development libraries for applications that link statically.

%prep

%setup -q -n ATLAS 
%patch -p 1
mkdir -p RpmObjs
cd RpmObjs
%ifarch x86_64
    %define BIT_WIDTH 64
%else 
    %define BIT_WIDTH 32
%endif
../configure -Si archdef 1 -C if %{F77} -Fa alg -fPIC -b %{BIT_WIDTH} --with-netlib-lapack=%{_libdir}/liblapack_pic.a

%define SIMD_SET sse2

%build

%if 0%{?opensuse_bs}
	%undefine ATLAS_DO_BUILD
%else
	%define ATLAS_DO_BUILD 1
%endif

%if %{ATLAS_DO_BUILD}
cd RpmObjs
make
make test
make time
(cd lib && make libatlas.so)
(cd lib && make BLAS_MAJOR=3 libblas.so.3)
(cd lib && mv libblas.so.3 libblas.so.3.0)
(cd lib && make LAPACK_MAJOR=3 liblapack.so.3)
(cd lib && mv liblapack.so.3 liblapack.so.3.0)
%endif

%install

%if %{ATLAS_DO_BUILD} == 1
rm -fr $RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT%{_libdir}/atlas/%{SIMD_SET}
install -m 644 RpmObjs/lib/libblas.so.3.0 $RPM_BUILD_ROOT%{_libdir}/atlas/%{SIMD_SET}
install -m 644 RpmObjs/lib/liblapack.so.3.0 $RPM_BUILD_ROOT%{_libdir}/atlas/%{SIMD_SET}
%endif

%clean

rm -rf $RPM_BUILD_ROOT 

%files 
%defattr(-,root,root)
%if %{ATLAS_DO_BUILD} == 1
%{_libdir}/atlas/%{SIMD_SET}/libblas.so.3.0
%{_libdir}/atlas/%{SIMD_SET}/liblapack.so.3.0
%endif