Blob Blame Raw
Name:           atlas
Version:        3.6.0
Release:        6
Summary:        Automatically Tuned Linear Algebra Software

Group:          System Environment/Libraries
License:        BSD
URL:            http://math-atlas.sourceforge.net/
Source0:        http://prdownloads.sourceforge.net/math-atlas/%{name}%{version}.tar.bz2
Source1:	README.Fedora
Patch0:         http://ftp.debian.org/debian/pool/main/a/atlas3/%{name}3_%{version}-19.diff.gz
Patch1:		%{name}-%{version}-gfortran.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Requires:       /etc/ld.so.conf.d
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
BuildRequires:  gcc-gfortran lapack-devel expect sharutils gawk

%define ver_major 3
%define ver %{ver_major}.0

%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 largely obtained via
compile-time optimizations and tend to be specific to a given hardware
configuration. In order to package ATLAS for Fedora some compromises
were 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 specific hardware.  However, the source
package can be used to compile customized ATLAS packages--see the
documentation for information.



%package devel
Summary:        Development libraries for ATLAS
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

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


############## Subpackages for architecture extensions #################
#
# Because a set of ATLAS libraries is a ~5 MB package, separate packages
# are created for SSE, SSE2, and 3DNow extensions to ix86 and AltiVec
# extensions to PowerPC.
#
# The current version does not compile shared libraries for the extended
# architectures on gcc 4 (errors generated by assembly kernels), so
# some of these subpackages are currently disabled and will be enabled
# in the future when they compile properly (probably in the 3.8.0 release).
%ifarch i386
%define archt i386
%define types base sse sse2 3dnow

%package sse
Summary:        ATLAS libraries for SSE extensions
Group:          System Environment/Libraries
%description sse
This package contains the ATLAS (Automatically Tuned Linear Algebra
Software) libraries compiled with optimizations for the SSE extensions
to the ix86 architecture.
%package sse-devel
Summary:        Development libraries for ATLAS with SSE extensions
Group:          Development/Libraries
#Requires:       %{name}-sse = %{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 extensions to the ix86 architecture.


%package sse2
Summary:        ATLAS libraries for SSE2 extensions
Group:          System Environment/Libraries
%description sse2
This package contains the ATLAS (Automatically Tuned Linear Algebra
Software) libraries compiled with optimizations for the SSE2
extensions to the ix86 architecture.
%package sse2-devel
Summary:        Development libraries for ATLAS with SSE2 extensions
Group:          Development/Libraries
#Requires:       %{name}-sse2 = %{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 3dnow
Summary:        ATLAS libraries for 3DNow extensions
Group:          System Environment/Libraries
%description 3dnow
This package contains the ATLAS (Automatically Tuned Linear Algebra
Software) libraries compiled with optimizations for the 3DNow
extensions to the ix86 architecture.
%package 3dnow-devel
Summary:        Development libraries for ATLAS with 3DNow extensions
Group:          Development/Libraries
#Requires:       %{name}-3dnow = %{version}-%{release}
%description 3dnow-devel
This package contains headers and static versions of the ATLAS
(Automatically Tuned Linear Algebra Software) libraries compiled with
optimizations for the 3DNow extensions to the ix86 architecture.


%endif
%ifarch ppc
%define archt powerpc
%define types base altivec

%package altivec
Summary:        ATLAS libraries for AltiVec extensions
Group:          System Environment/Libraries
%description altivec
This package contains the ATLAS (Automatically Tuned Linear Algebra
Software) libraries compiled with optimizations for the AltiVec
extensions to the PowerPC architecture.
%package altivec-devel
Summary:        Development libraries for ATLAS with AltiVec extensions
Group:          Development/Libraries
#Requires:       %{name}-altivec = %{version}-%{release}
%description altivec-devel
This package contains headers and static versions of the ATLAS
(Automatically Tuned Linear Algebra Software) libraries compiled with
optimizations for the AltiVec extensions to the PowerPC architecture.

%endif
%ifarch x86_64
%define archt amd64
%define types base
%define bit 2
%else
%define bit 1
%endif

%if "%{?enable_custom_atlas}" == "1"
# This flag enables building customized ATLAS libraries with all
# compile-time optimizations. Note that compilation will take a very
# long time, and that the resulting binaries are not guaranteed to
# work well or even at all on other hardware.

%define archt %{_arch}
%define types custom

%package custom
Summary:        Custom-compiled ATLAS libraries
Group:          System Environment/Libraries
%description custom
This package contains the ATLAS (Automatically Tuned Linear Algebra
Software) libraries compiled with all compile-time optimizations enabled.
%package custom-devel
Summary:        Development libraries for ATLAS with AltiVec extensions
Group:          Development/Libraries
#Requires:       %{name}-custom = %{version}-%{release}
%description custom-devel
This package contains headers and static versions of the ATLAS
(Automatically Tuned Linear Algebra Software) libraries compiled with
all compile-time optimizations enabled.
%endif


%prep
%setup -q -n ATLAS
%patch0 -p1
%patch1 -p0
cp %{SOURCE1} doc


%build
# The following build procedure is more or less copied from the Debian
# sources, where the output of a previously recorded build is
# replayed, so as to bypass the compile-time optimizations and produce
# predictable results independent of the hardware on which it is
# compiled. This forces builds to be sequential, so SMP builds are not
# supported.
chmod +x debian/config.expect debian/ab
sed -i debian/ab -e s/g77/gfortran/

########## Static Libraries ##########################################
for TYPE in %{types}; do
  if [ "$TYPE" = "3dnow" ]; then
    TDN=y
  else
    TDN=n
  fi
  BUILD_DIR=Linux_${TYPE}_static
  ARCH_DIR=$BUILD_DIR CACHE_SIZE= BIT=%{bit} \
    DEFAULTS=y TDNCOMP=$TDN debian/config.expect
  cat Make.$BUILD_DIR |\
	sed -e "s, TOPdir = \(.*\), TOPdir = `pwd`,1" \
	    -e "s, FLAPACKlib = , FLAPACKlib = %{_libdir}/liblapack.a,1" >foo
  mv foo Make.$BUILD_DIR
  make killall arch=$BUILD_DIR
  make startup arch=$BUILD_DIR

  if [ "$TYPE" = "custom" ]; then
    BUILD_DATA_DIR=custom_%{archt}
    if [ -a $BUILD_DATA_DIR.tgz ]; then
      tar zxf $BUILD_DATA_DIR.tgz
    else
      make install arch=$BUILD_DIR >out 2>&1 &
      pid=$!
      echo Waiting on $pid
      tail -f --pid $pid out &
      wait $pid
      rm -rf ${BUILD_DATA_DIR}
      mkdir -p ${BUILD_DATA_DIR}
      cat out | sed -e "s,`pwd`,TOPDIR,g" -e "s,$BUILD_DIR,CARCH,g" | \
		gzip -9 | uuencode - >${BUILD_DATA_DIR}/build.uu
      rm -f out
      mkdir -p ${BUILD_DATA_DIR}/include
      cp include/$BUILD_DIR/* ${BUILD_DATA_DIR}/include
      mkdir -p ${BUILD_DATA_DIR}/mm
      cp tune/blas/gemm/$BUILD_DIR/res/* ${BUILD_DATA_DIR}/mm
      mkdir -p ${BUILD_DATA_DIR}/mv
      cp tune/blas/gemv/$BUILD_DIR/res/* ${BUILD_DATA_DIR}/mv
      mkdir -p ${BUILD_DATA_DIR}/r1
      cp tune/blas/ger/$BUILD_DIR/res/* ${BUILD_DATA_DIR}/r1
      mkdir -p ${BUILD_DATA_DIR}/l1
      cp tune/blas/level1/$BUILD_DIR/res/* ${BUILD_DATA_DIR}/l1
      tar zcf ${BUILD_DATA_DIR}.tgz ${BUILD_DATA_DIR}
    fi
  else
    BUILD_DATA_DIR=debian/%{archt}/${TYPE}
  fi

  cp ${BUILD_DATA_DIR}/mm/* tune/blas/gemm/$BUILD_DIR/res
  cp ${BUILD_DATA_DIR}/mv/* tune/blas/gemv/$BUILD_DIR/res
  cp ${BUILD_DATA_DIR}/r1/* tune/blas/ger/$BUILD_DIR/res
  cp ${BUILD_DATA_DIR}/l1/* tune/blas/level1/$BUILD_DIR/res
  cp ${BUILD_DATA_DIR}/include/* include/$BUILD_DIR

  cat ${BUILD_DATA_DIR}/build.uu | uudecode | zcat - | \
	sed -e s/g77/gfortran/ -e s/-DAdd__/-DAdd_/ | debian/ab topdir=`pwd` \
	carch=$BUILD_DIR debug= | bash -x -e
  mv lib/$BUILD_DIR/liblapack.a lib/$BUILD_DIR/liblapack_atlas.a

  # Create replacement for BLAS and LAPACK Libraries
  mkdir tmp
  pushd tmp
    ar x ../lib/$BUILD_DIR/libatlas.a
    ar x ../lib/$BUILD_DIR/libf77blas.a
    ar x ../lib/$BUILD_DIR/libcblas.a
  popd
  rm -f lib/$BUILD_DIR/libblas.a
  ar r lib/$BUILD_DIR/libblas.a tmp/*.o
  rm -rf tmp

  mkdir tmp
  pushd tmp
    ar x %{_libdir}/liblapack.a
    ar x ../lib/$BUILD_DIR/liblapack_atlas.a
    ar x ../lib/$BUILD_DIR/libcblas.a
  popd
  rm -f lib/$BUILD_DIR/liblapack.a
  ar r lib/$BUILD_DIR/liblapack.a tmp/*.o
  rm -rf tmp


 ## Shared libs are currently broken for SIMD extensions with gcc 4.
 ## Until this is fixed, the following is only performed for "base".
 if [ "$TYPE" = "base" ] ; then
  ########## Shared Libraries ##########################################
  BUILD_DIR=Linux_${TYPE}_shared
  ARCH_DIR=$BUILD_DIR CACHE_SIZE= BIT=%{bit} \
      DEFAULTS=y TDNCOMP=$TDN debian/config.expect
  cat Make.$BUILD_DIR |\
	sed -e "s, TOPdir = \(.*\), TOPdir = `pwd`,1" \
	    -e "s, FLAPACKlib = , FLAPACKlib = %{_libdir}/liblapack.a,1" \
	    -e "s, F77FLAGS = \(.*\), F77FLAGS = \1 -fPIC,1" \
	    -e "s, CCFLAGS = \(.*\), CCFLAGS = \1 -fPIC,1" \
	    -e "s, MMFLAGS = \(.*\), MMFLAGS = \1 -fPIC,1" \
	    -e "s, XCCFLAGS = \(.*\), XCCFLAGS = \1 -fPIC,1" >foo
  mv foo Make.$BUILD_DIR
  make killall arch=$BUILD_DIR
  make startup arch=$BUILD_DIR

  cp ${BUILD_DATA_DIR}/mm/* tune/blas/gemm/$BUILD_DIR/res
  cp ${BUILD_DATA_DIR}/mv/* tune/blas/gemv/$BUILD_DIR/res
  cp ${BUILD_DATA_DIR}/r1/* tune/blas/ger/$BUILD_DIR/res
  cp ${BUILD_DATA_DIR}/l1/* tune/blas/level1/$BUILD_DIR/res
  cp ${BUILD_DATA_DIR}/include/* include/$BUILD_DIR

  cat ${BUILD_DATA_DIR}/build.uu | uudecode | zcat - | \
	sed -e s/g77/gfortran/ -e s/-DAdd__/-DAdd_/ | debian/ab topdir=`pwd` \
	carch=$BUILD_DIR fpic="-fPIC" debug= | bash -x -e
  mv lib/$BUILD_DIR/liblapack.a lib/$BUILD_DIR/liblapack_atlas.a

  mkdir tmp
  pushd tmp
    ar x ../lib/$BUILD_DIR/libatlas.a
    rm -f ilaenv.o
  popd
  cc -shared -Wl,-soname=libatlas.so.%{ver_major} \
	-o lib/$BUILD_DIR/libatlas.so.%{ver} tmp/*.o -lm
  ln -s libatlas.so.%{ver} lib/$BUILD_DIR/libatlas.so.%{ver_major}
  ln -s libatlas.so.%{ver} lib/$BUILD_DIR/libatlas.so
  rm -rf tmp

  mkdir tmp
  pushd tmp
    ar x ../lib/$BUILD_DIR/libcblas.a
    rm -f ilaenv.o
  popd
  cc -shared -Wl,-soname=libcblas.so.%{ver_major} \
	-o lib/$BUILD_DIR/libcblas.so.%{ver} tmp/*.o -L lib/$BUILD_DIR -latlas
  ln -s libcblas.so.%{ver} lib/$BUILD_DIR/libcblas.so.%{ver_major}
  ln -s libcblas.so.%{ver} lib/$BUILD_DIR/libcblas.so
  rm -rf tmp

  mkdir tmp
  pushd tmp
    ar x ../lib/$BUILD_DIR/libf77blas.a
    rm -f ilaenv.o
  popd
  cc -shared -Wl,-soname=libf77blas.so.%{ver_major} \
	-o lib/$BUILD_DIR/libf77blas.so.%{ver} tmp/*.o \
	-L lib/$BUILD_DIR -latlas -lgfortran
  ln -s libf77blas.so.%{ver} lib/$BUILD_DIR/libf77blas.so.%{ver_major}
  ln -s libf77blas.so.%{ver} lib/$BUILD_DIR/libf77blas.so
  rm -rf tmp

  mkdir tmp
  pushd tmp
    ar x ../lib/$BUILD_DIR/liblapack_atlas.a
    rm -f ilaenv.o
  popd
  cc -shared -Wl,-soname=liblapack_atlas.so.%{ver_major} \
	-o lib/$BUILD_DIR/liblapack_atlas.so.%{ver} tmp/*.o \
	-L lib/$BUILD_DIR -lcblas -lf77blas
  ln -s liblapack_atlas.so.%{ver} lib/$BUILD_DIR/liblapack_atlas.so.%{ver_major}
  ln -s liblapack_atlas.so.%{ver} lib/$BUILD_DIR/liblapack_atlas.so
  rm -rf tmp

  # Create replacement for BLAS and LAPACK Libraries
  mkdir tmp
  pushd tmp
    ar x ../lib/$BUILD_DIR/libatlas.a
    ar x ../lib/$BUILD_DIR/libf77blas.a
    ar x ../lib/$BUILD_DIR/libcblas.a
  popd
  cc -shared -Wl,-soname=libblas.so.%{ver_major} \
	-o lib/$BUILD_DIR/libblas.so.%{ver} tmp/*.o -lgfortran
  ln -s libblas.so.%{ver} lib/$BUILD_DIR/libblas.so.%{ver_major}
  ln -s libblas.so.%{ver} lib/$BUILD_DIR/libblas.so
  rm -rf tmp

  mkdir tmp
  pushd tmp
    ar x %{_libdir}/liblapack_pic.a
    ar x ../lib/$BUILD_DIR/liblapack_atlas.a
    ar x ../lib/$BUILD_DIR/libcblas.a
  popd
  cc -shared -Wl,-soname=liblapack.so.%{ver_major} \
	-o lib/$BUILD_DIR/liblapack.so.%{ver} tmp/*.o \
	-L lib/$BUILD_DIR -lblas -lgfortran
  ln -s liblapack.so.%{ver} lib/$BUILD_DIR/liblapack.so.%{ver_major}
  ln -s liblapack.so.%{ver} lib/$BUILD_DIR/liblapack.so
  rm -rf tmp
 fi
done


%install
rm -rf $RPM_BUILD_ROOT
for TYPE in %{types}; do
  EXTDIR=$TYPE
  if [ "$TYPE" = "base" ]; then
    EXTDIR=""
  fi

  mkdir -p $RPM_BUILD_ROOT%{_libdir}/${EXTDIR}
  mkdir -p $RPM_BUILD_ROOT%{_libdir}/atlas/${EXTDIR}
  for LIB in libblas liblapack; do
    if [ "$TYPE" = "base" ]; then
      LIBS="lib/Linux_${TYPE}_static/$LIB.a lib/Linux_${TYPE}_shared/$LIB.so*"
    else
      LIBS="lib/Linux_${TYPE}_static/$LIB.a"
    fi
    cp -a $LIBS ${RPM_BUILD_ROOT}%{_libdir}/atlas/${EXTDIR}
  done
  for LIB in libatlas libcblas libf77blas liblapack_atlas; do
    if [ "$TYPE" = "base" ]; then
      LIBS="lib/Linux_${TYPE}_static/$LIB.a lib/Linux_${TYPE}_shared/$LIB.so*"
    else
      LIBS="lib/Linux_${TYPE}_static/$LIB.a"
    fi
    cp -a $LIBS ${RPM_BUILD_ROOT}%{_libdir}/${EXTDIR}
  done
done

mkdir -p $RPM_BUILD_ROOT%{_includedir}/atlas
cp -a include/*.h $RPM_BUILD_ROOT%{_includedir}/atlas

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



%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%if "%{?enable_custom_atlas}" == "1"

#%files custom
#%defattr(-,root,root,-)
#%doc debian/copyright doc/README.Fedora
#%dir %{_libdir}/custom
#%dir %{_libdir}/atlas/custom
#%{_libdir}/custom/*.so.*
#%{_libdir}/atlas/custom/*.so.*
#%config(noreplace) /etc/ld.so.conf.d/atlas-custom-%{_arch}.conf

%files custom-devel
%defattr(-,root,root,-)
%doc debian/copyright doc
%dir %{_libdir}/custom
%dir %{_libdir}/atlas/custom
#%{_libdir}/custom/*.{a,so}
%{_libdir}/custom/*.a
#%{_libdir}/atlas/custom/*.{a,so}
%{_libdir}/atlas/custom/*.a
%{_includedir}/atlas
%exclude /etc/ld.so.conf.d/*

%else


%files
%defattr(-,root,root,-)
%doc debian/copyright doc/README.Fedora
%dir %{_libdir}/atlas
%{_libdir}/*.so.*
%{_libdir}/*/*.so.*
#%{_libdir}/atlas/*/*.so.*
%config(noreplace) /etc/ld.so.conf.d/atlas-%{_arch}.conf

%files devel
%defattr(-,root,root,-)
%doc debian/copyright doc
%{_libdir}/*.a
%{_libdir}/*.so
%{_libdir}/atlas/*.a
%{_libdir}/atlas/*.so
%{_includedir}/atlas

%ifarch i386

#%files sse
#%defattr(-,root,root,-)
#%doc debian/copyright doc/README.Fedora
#%dir %{_libdir}/sse
#%dir %{_libdir}/atlas/sse
#%{_libdir}/sse/*.so.*
#%{_libdir}/atlas/sse/*.so.*
#%config(noreplace) /etc/ld.so.conf.d/atlas-sse-%{_arch}.conf

%files sse-devel
%defattr(-,root,root,-)
%doc debian/copyright doc
%dir %{_libdir}/sse
%dir %{_libdir}/atlas/sse
#%{_libdir}/sse/*.so
%{_libdir}/sse/*.a
#%{_libdir}/atlas/sse/*.so
%{_libdir}/atlas/sse/*.a
%{_includedir}/atlas


#%files sse2
#%defattr(-,root,root,-)
#%doc debian/copyright doc/README.Fedora
#%dir %{_libdir}/sse2
#%dir %{_libdir}/atlas/sse2
#%{_libdir}/sse2/*.so.*
#%{_libdir}/atlas/sse2/*.so.*
#%config(noreplace) /etc/ld.so.conf.d/atlas-sse2-%{_arch}.conf

%files sse2-devel
%defattr(-,root,root,-)
%doc debian/copyright doc
%dir %{_libdir}/sse2
%dir %{_libdir}/atlas/sse2
#%{_libdir}/sse2/*.so
%{_libdir}/sse2/*.a
#%{_libdir}/atlas/sse2/*.so
%{_libdir}/atlas/sse2/*.a
%{_includedir}/atlas


#%files 3dnow
#%defattr(-,root,root,-)
#%doc debian/copyright doc/README.Fedora
#%dir %{_libdir}/3dnow
#%dir %{_libdir}/atlas/3dnow
#%{_libdir}/3dnow/*.so.*
#%{_libdir}/atlas/3dnow/*.so.*
#%config(noreplace) /etc/ld.so.conf.d/atlas-3dnow-%{_arch}.conf

%files 3dnow-devel
%defattr(-,root,root,-)
%doc debian/copyright doc
%dir %{_libdir}/3dnow
%dir %{_libdir}/atlas/3dnow
#%{_libdir}/3dnow/*.so
%{_libdir}/3dnow/*.a
#%{_libdir}/atlas/3dnow/*.so
%{_libdir}/atlas/3dnow/*.a
%{_includedir}/atlas

%endif
%ifarch ppc

#%files altivec
#%defattr(-,root,root,-)
#%doc debian/copyright doc/README.Fedora
#%dir %{_libdir}/altivec
#%dir %{_libdir}/atlas/altivec
#%{_libdir}/altivec/*.so.*
#%{_libdir}/atlas/altivec/*.so.*
#%config(noreplace) /etc/ld.so.conf.d/atlas-altivec-%{_arch}.conf

%files altivec-devel
%defattr(-,root,root,-)
%doc debian/copyright doc
%dir %{_libdir}/altivec
%dir %{_libdir}/atlas/altivec
#%{_libdir}/altivec/*.so
%{_libdir}/altivec/*.a
#%{_libdir}/atlas/altivec/*.so
%{_libdir}/atlas/altivec/*.a
%{_includedir}/atlas

%endif

%endif

%changelog
* Tue Oct 04 2005 Quentin Spencer <qspencer@users.sourceforge.net> 3.6.0-6
- Fix buildroot, minor updates to description.

* Wed Sep 28 2005 Quentin Spencer <qspencer@users.sourceforge.net> 3.6.0-5
- fix files lists.

* Mon Sep 26 2005 Quentin Spencer <qspencer@users.sourceforge.net> 3.6.0-4
- generate library symlinks earlier for the benefit of later linking steps.

* Wed Sep 14 2005 Quentin Spencer <qspencer@users.sourceforge.net> 3.6.0-3
- Change lapack dependency to lapack-devel, and use lapack_pic.a for
  building liblapack.so.

* Wed Sep 14 2005 Quentin Spencer <qspencer@users.sourceforge.net> 3.6.0-2
- Add "bit" macro to correctly build on x86_64.

* Tue Aug 16 2005 Quentin Spencer <qspencer@users.sourceforge.net> 3.6.0-1
- Initial version.