File fftw.spec of Package fftw

#
# spec file for package fftw (Version 2.1.5)
#
# Copyright (c) 2009 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:           fftw
BuildRequires:  gcc-fortran gmp-devel libtool autoconf
%if %suse_version < 1315
BuildRequires: mpich-devel 
%endif
Summary:        Discrete Fourier Transform (DFT) C Subroutine Library
Version:        2.1.5
Release:        245
License:        GPL-2.0-or-later
Group:          Productivity/Scientific/Math
Source:         fftw-%{version}.tar.bz2
Url:            http://www.fftw.org/

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

%if %suse_version<1315

%package mpi
License:        GPL-2.0-or-later
Summary:        Discrete Fourier Transform (DFT) - MPI support
Group:          Development/Libraries/Parallel
Requires:       fftw = %{version}-%{release}, mpich

%description mpi
Discrete Fourier Transform (DFT) - MPI support. See package fftw for
more details.

%endif

%package devel
License:        GPL-2.0-or-later
Summary:        Development libraries for fftw
Group:          Development/Libraries/Parallel
Requires:       fftw = %{version}-%{release}

%description devel
Development libraries for fftw

%if %suse_version<1315

%package mpi-devel
License:        GPL-2.0-or-later
Summary:        Discrete Fourier Transform (DFT) - Header for MPI-Support
Group:          Development/Libraries/Parallel
Requires:       fftw = %{version}-%{release}, fftw-mpi

%description mpi-devel
Discrete Fourier Transform (DFT) - Header for MPI-Support. See Package
fftw for more information.

%endif

%package threads
License:        GPL-2.0-or-later
Summary:        Discrete Fourier Transform (DFT) - Threads Support
Group:          Development/Libraries/Parallel
Requires:       fftw = %{version}-%{release}

%description threads
Discrete Fourier Transform (DFT) - Threads Support See package fftw for
more details

%package threads-devel
License:        GPL-2.0-or-later
Summary:        Discrete Fourier Transform (DFT) - Headers for Thread support
Group:          Development/Libraries/Parallel
Requires:       fftw-threads = %{version}-%{release}
Requires:       fftw-devel = %{version}-%{release}

%description threads-devel
Discrete Fourier Transform (DFT) - Headers for Thread support See
package fftw for more details


%prep
%setup -q

%build
find -type d | xargs chmod 755

if [  -z "$MPI_HOME" ]; then
        export MPI_HOME=/opt/mpich
fi
# autoreconf -fi
libtoolize -f
aclocal
automake -a -c
autoconf
CFLAGS="$RPM_OPT_FLAGS -L$MPI_HOME/ch-p4/lib -I$MPI_HOME/include" \
MPICC=$MPI_HOME/ch-p4/bin/mpicc \
./configure --prefix=%{_prefix}			\
	--libdir=%{_libdir}			\
	--enable-shared 			\
	--disable-static			\
	--enable-type-prefix 			\
	--enable-threads 			\
%if %suse_version <1315    
	--enable-mpi 				\
%endif    
	--infodir=%{_infodir} 			\
%ifarch %ix86
	--enable-i386-hacks 			\
%endif
	%{_target_cpu}-suse-linux
make %{?jobs:-j %jobs}

%install
if [  -z "$MPI_HOME" ]; then
        export MPI_HOME=/opt/mpich
fi
make DESTDIR=$RPM_BUILD_ROOT install
# remove unneeded files
rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.*a
# hack to also compile/install single-precision version:
make distclean
CFLAGS="$RPM_OPT_FLAGS -L$MPI_HOME/ch-p4/lib -I$MPI_HOME/include" \
MPICC=$MPI_HOME/ch-p4/bin/mpicc \
./configure 	--prefix=%{_prefix}			\
		--libdir=%{_libdir} 			\
		--enable-shared 			\
		--disable-static			\
		--enable-type-prefix 			\
		--enable-threads 			\
		--enable-float 				\
%if %suse_version <1315        
		--enable-mpi 				\
%endif        
		--infodir=%{_infodir} 			\
		%{_target_cpu}-suse-linux
make %{?jobs:-j %jobs}
make DESTDIR=$RPM_BUILD_ROOT install
install -m 0644 fftw/*.h $RPM_BUILD_ROOT%{_includedir}
install -m 0644 rfftw/rfftw.h $RPM_BUILD_ROOT%{_includedir}
install -m 0644 fftw/config.h $RPM_BUILD_ROOT%{_includedir}/fftw-config.h
sed -e 's/<config.h>/<fftw-config.h>/' fftw/fftw-int.h > $RPM_BUILD_ROOT%{_includedir}/fftw-int.h
chmod 0644 $RPM_BUILD_ROOT%{_includedir}/*.h
# remove unneeded files
rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.*a
rm -f $RPM_BUILD_ROOT%{_includedir}/config.h

%clean
rm -rf $RPM_BUILD_ROOT

%post
%run_ldconfig

%postun
%run_ldconfig

%post threads
%run_ldconfig

%postun threads
%run_ldconfig

%if %suse_version <1315    

%post mpi
%run_ldconfig

%postun mpi
%run_ldconfig

%endif

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

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

%files
%defattr(-,root,root)
%{_libdir}/libdfftw.so.*
%{_libdir}/libdrfftw.so.*
%{_libdir}/libsfftw.so.*
%{_libdir}/libsrfftw.so.*

%files threads
%defattr(-,root,root)
%{_libdir}/libdfftw_threads.so.*
%{_libdir}/libdrfftw_threads.so.*
%{_libdir}/libsfftw_threads.so.*
%{_libdir}/libsrfftw_threads.so.*

%if %suse_version<1315

%files mpi
%defattr(-,root,root)
%{_libdir}/libdfftw_mpi.so.*
%{_libdir}/libdrfftw_mpi.so.*
%{_libdir}/libsfftw_mpi.so.*
%{_libdir}/libsrfftw_mpi.so.*

%endif

%files devel
%defattr(-,root,root)
%doc AUTHORS COPYING COPYRIGHT ChangeLog INSTALL NEWS README README.hacks TODO
%doc doc/* FAQ
%{_infodir}/fftw.info*.gz
%{_includedir}/dfftw.h
%{_includedir}/drfftw.h
%{_includedir}/sfftw.h
%{_includedir}/srfftw.h
%{_includedir}/rfftw.h
%{_includedir}/fftw.h
%{_includedir}/fftw-int.h
%{_includedir}/fftw-config.h
%{_libdir}/libdfftw.so
%{_libdir}/libdrfftw.so
%{_libdir}/libsfftw.so
%{_libdir}/libsrfftw.so

%files threads-devel
%defattr(-,root,root)
%{_includedir}/dfftw_threads.h
%{_includedir}/drfftw_threads.h
%{_includedir}/sfftw_threads.h
%{_includedir}/srfftw_threads.h
%{_libdir}/libdfftw_threads.so
%{_libdir}/libdrfftw_threads.so
%{_libdir}/libsfftw_threads.so
%{_libdir}/libsrfftw_threads.so

%if %suse_version<1315

%files mpi-devel
%defattr(-,root,root)
%{_includedir}/dfftw_mpi.h
%{_includedir}/drfftw_mpi.h
%{_includedir}/sfftw_mpi.h
%{_includedir}/srfftw_mpi.h
%{_libdir}/libdfftw_mpi.so
%{_libdir}/libdrfftw_mpi.so
%{_libdir}/libsfftw_mpi.so
%{_libdir}/libsrfftw_mpi.so

%endif

%changelog
openSUSE Build Service is sponsored by