File fftw3.spec of Package fftw3

#
# spec file for package fftw3
#
# 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:           fftw3
BuildRequires:  fdupes
BuildRequires:  gcc-fortran
BuildRequires:  pkgconfig
%ifnarch s390 s390x
BuildRequires:  openmpi-devel
%endif
Version:        3.3.2
Release:        0
Summary:        Discrete Fourier Transform (DFT) C Subroutine Library
License:        GPL-2.0+
Group:          Productivity/Scientific/Math
Url:            http://www.fftw.org
Source:         http://www.fftw.org/fftw-%{version}.tar.gz
Source1:        %{name}-rpmlintrc
Patch0:         1_man_macro.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires(pre):  %install_info_prereq

%description
FFTW is a C subroutine library for computing the Discrete Fourier
Transform (DFT) in one or more dimensions, of both real and complex
data, and of arbitrary input size.

%package devel
Summary:        Include Files and Libraries mandatory for Development
Group:          Development/Libraries/C and C++
Requires:       glibc-devel
Requires:       libfftw3-3 = %{version}-%{release}
Provides:       fftw-devel

%description devel
This package contains all necessary include files and libraries needed
to develop applications that require these.

%package -n libfftw3-3
Summary:        Discrete Fourier Transform (DFT) C Subroutine Library
Group:          System/Libraries
# Remove Prov/Obs when appropriate; were added 2011-Nov-21 (post-openSUSE-12.1)
Provides:       fftw3 = %{version}-%{release}
Obsoletes:      fftw3 < 3.3

%description -n libfftw3-3
FFTW is a C subroutine library for computing the Discrete Fourier
Transform (DFT) in one or more dimensions, of both real and complex
data, and of arbitrary input size.

%package -n libfftw3_threads3
Summary:        Discrete Fourier Transform (DFT) C subroutine library
Group:          Productivity/Scientific/Math
Provides:       fftw3-threads = %{version}-%{release}
Obsoletes:      fftw3-threads < 3.3
# libfftw3_threads.so does not have a DT_NEEDED entry for fftw symbols, since it
# may be used with either libfftw3.so or libfftw3f.so. Hence, manual Requires.
#Requires:       libfftw3-3 = %%{version}

%description -n libfftw3_threads3
FFTW is a C subroutine library for computing the Discrete Fourier
Transform (DFT) in one or more dimensions, of both real and complex
data, and of arbitrary input size.

%package threads-devel
Summary:        Discrete Fourier Transform (DFT) C subroutine library
Group:          Development/Libraries/C and C++
Requires:       fftw3-devel = %{version}-%{release}
Requires:       glibc-devel
Requires:       libfftw3_threads3 = %{version}-%{release}

%description threads-devel
FFTW is a C subroutine library for computing the Discrete Fourier
Transform (DFT) in one or more dimensions, of both real and complex
data, and of arbitrary input size.

%package -n libfftw3_omp3
Summary:        Discrete Fourier Transform (DFT) C subroutine library
Group:          Productivity/Scientific/Math
Provides:       fftw3-openmp = %{version}-%{release}
Obsoletes:      fftw3-openmp < 3.3
# Same as libfftw3_threads.so: manual Requires for fftw3 main lib
#Requires:       libfftw3-3 = %%{version}

%description -n libfftw3_omp3
FFTW is a C subroutine library for computing the Discrete Fourier
Transform (DFT) in one or more dimensions, of both real and complex
data, and of arbitrary input size.

%package openmp-devel
Summary:        Discrete Fourier Transform (DFT) C subroutine library
Group:          Development/Libraries/C and C++
Requires:       fftw3-devel = %{version}-%{release}
Requires:       glibc-devel
Requires:       libfftw3_omp3 = %{version}-%{release}

%description openmp-devel
FFTW is a C subroutine library for computing the Discrete Fourier
Transform (DFT) in one or more dimensions, of both real and complex
data, and of arbitrary input size.

%ifnarch s390 s390x

%package -n libfftw3_mpi3
Summary:        Discrete Fourier Transform (DFT) C subroutine library
Group:          Productivity/Scientific/Math
Provides:       fftw3-mpi = %{version}-%{release}
Obsoletes:      fftw3-mpi < 3.3
# Same as libfftw3_threads.so: manual Requires for fftw3 main lib
#Requires:       libfftw3-3 = %%{version}
#Requires:       openmpi

%description -n libfftw3_mpi3
FFTW is a C subroutine library for computing the Discrete Fourier
Transform (DFT) in one or more dimensions, of both real and complex
data, and of arbitrary input size.

%package mpi-devel
Summary:        Discrete Fourier Transform (DFT) C subroutine library
Group:          Development/Libraries/C and C++
Requires:       fftw3-devel = %{version}
Requires:       glibc-devel
Requires:       libfftw3_mpi3 = %{version}-%{release}
Requires:       openmpi-devel

%description mpi-devel
FFTW is a C subroutine library for computing the Discrete Fourier
Transform (DFT) in one or more dimensions, of both real and complex
data, and of arbitrary input size.
%endif

%prep
%setup -q -n fftw-%{version}
%patch0

%build
%ifnarch s390 s390x
source %_libdir/mpi/gcc/openmpi/bin/mpivars.sh
%endif
%configure --enable-shared --enable-threads --enable-openmp \
%ifnarch s390 s390x
  --enable-mpi \
%endif
%ifarch %ix86 x86_64
  --enable-sse2 \
  --enable-avx \
%endif
  --disable-static
make %{?_smp_mflags}

%install
%makeinstall

# remove unneeded files
rm -f %{buildroot}%{_libdir}/lib*.*a

# hack to also compile/install single-precision version:
make distclean

%ifnarch s390 s390x
source %_libdir/mpi/gcc/openmpi/bin/mpivars.sh
%endif
%configure --enable-shared --enable-threads --enable-float --enable-openmp \
%ifnarch s390 s390x
  --enable-mpi \
%endif
%ifarch %ix86 x86_64
  --enable-sse \
%endif
  --disable-static

make %{?_smp_mflags}
%makeinstall

# remove unneeded files
rm -f %{buildroot}%{_libdir}/lib*.*a

# gzip -9nf %%{buildroot}%%{_infodir}/*.info*
rm -f %{buildroot}%{_infodir}/dir

# remove Makefiles in doc directory at last
find doc -name 'Makefile*' | xargs rm

%fdupes -s doc

%postun devel
%install_info_delete --info-dir=%{_infodir} %{_infodir}/fftw3.info.gz

%post devel
%install_info --info-dir=%{_infodir} %{_infodir}/fftw3.info.gz

%post -n libfftw3-3 -p /sbin/ldconfig

%postun -n libfftw3-3 -p /sbin/ldconfig

%post -n libfftw3_threads3 -p /sbin/ldconfig

%postun -n libfftw3_threads3 -p /sbin/ldconfig

%post -n libfftw3_omp3 -p /sbin/ldconfig

%postun -n libfftw3_omp3 -p /sbin/ldconfig

%ifnarch s390 s390x

%post -n libfftw3_mpi3 -p /sbin/ldconfig

%postun -n libfftw3_mpi3 -p /sbin/ldconfig
%endif

%files -n libfftw3-3
%defattr(-,root,root)
%{_libdir}/libfftw3.so.3*
%{_libdir}/libfftw3f.so.3*

%files devel
%defattr(-,root,root)
%doc AUTHORS CONVENTIONS COPYING COPYRIGHT ChangeLog NEWS README TODO
%doc doc/*
%doc %{_mandir}/man?/*
%{_infodir}/*.info*
%{_includedir}/fftw3.*
%{_includedir}/fftw3q.f03
%{_includedir}/fftw3l.f03
%{_libdir}/libfftw3.so
%{_libdir}/libfftw3f.so
%{_libdir}/pkgconfig/*.pc
%{_bindir}/*

%files -n libfftw3_threads3
%defattr(-,root,root)
%{_libdir}/libfftw3_threads.so.3*
%{_libdir}/libfftw3f_threads.so.3*

%files threads-devel
%defattr(-,root,root)
%{_libdir}/libfftw3_threads.so
%{_libdir}/libfftw3f_threads.so

%files -n libfftw3_omp3
%defattr(-,root,root)
%{_libdir}/libfftw3_omp.so.3*
%{_libdir}/libfftw3f_omp.so.3*

%files openmp-devel
%defattr(-,root,root)
%{_libdir}/libfftw3_omp.so
%{_libdir}/libfftw3f_omp.so

%ifnarch s390 s390x

%files -n libfftw3_mpi3
%defattr(-,root,root)
%{_libdir}/libfftw3_mpi.so.3*
%{_libdir}/libfftw3f_mpi.so.3*

%files mpi-devel
%defattr(-,root,root)
%{_libdir}/libfftw3_mpi.so
%{_libdir}/libfftw3f_mpi.so
%{_includedir}/fftw3-mpi.*
%{_includedir}/fftw3l-mpi.f03
%endif

%changelog