File cfitsio.spec of Package cfitsio
#
# spec file for package cfitsio
#
# 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: cfitsio
Version: 3.310
Release: 0
Summary: Library for manipulating FITS data files
License: ISC
Group: Productivity/Scientific/Other
Url: http://heasarc.nasa.gov/fitsio/
Source0: ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3310.tar.gz
# PATCH-FIX-OPENSUSE cfitsio.patch asterios.dramis@gmail.com -- Fix library soname (taken from Fedora)
Patch0: cfitsio.patch
# PATCH-FIX-OPENSUSE cfitsio-zlib.patch asterios.dramis@gmail.com -- Use system zlib, link programs to shared libcfitsio (based on patches from Fedora and Debian)
Patch1: cfitsio-zlib.patch
# PATCH-FIX-OPENSUSE implicit-pointer-decl.patch asterios.dramis@gmail.com -- Fix "implicit-pointer-decl" rpm post build check warning
Patch2: implicit-pointer-decl.patch
BuildRequires: gcc-fortran
BuildRequires: pkg-config
BuildRequires: zlib-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
CFITSIO is a library of C and Fortran subroutines for reading and writing data
files in FITS (Flexible Image Transport System) data format. CFITSIO provides
simple high-level routines for reading and writing FITS files that insulate the
programmer from the internal complexities of the FITS format. CFITSIO also
provides many advanced features for manipulating and filtering the information
in FITS files.
This package contains some FITS image compression and decompression utilities.
%package -n libcfitsio0
Summary: Library for manipulating FITS data files
Group: System/Libraries
%description -n libcfitsio0
CFITSIO is a library of C and Fortran subroutines for reading and writing data
files in FITS (Flexible Image Transport System) data format. CFITSIO provides
simple high-level routines for reading and writing FITS files that insulate the
programmer from the internal complexities of the FITS format. CFITSIO also
provides many advanced features for manipulating and filtering the information
in FITS files.
%package -n libcfitsio-devel
Summary: Headers required when building programs against cfitsio library
Group: Development/Libraries/Other
Requires: libcfitsio0 = %{version}
Requires: pkg-config
Suggests: libcfitsio-devel-doc = %{version}
%description -n libcfitsio-devel
This package contains headers required when building programs against cfitsio
library.
%package -n libcfitsio-devel-doc
Summary: Documentation for the cfitsio library
Group: Documentation/Other
# libcfitsio-doc was last used in openSUSE 12.1 (version 3.280)
Obsoletes: libcfitsio-doc <= 3.280
%description -n libcfitsio-devel-doc
This package contains documentation for the cfitsio library.
%prep
%setup -q -n cfitsio
%patch0 -p1
%patch1 -p1
%patch2
# Remove bundled zlib
rm -f adler32.c crc32.c crc32.h deflate.c deflate.h infback.c inffast.c \
inffast.h inffixed.h inflate.c inflate.h inftrees.c inftrees.h trees.c trees.h \
uncompr.c zconf.h zlib.h zutil.c zutil.h
%build
# lines bellow contain fixes for pkgconfig file bnc#546004, some of them are already fixed by upstream
# so please drop them if they are not needed (in next round of updates)
# Add include dir, multithreading support, zlib dependency
sed -i 's|Cflags: -I${includedir}|Cflags: -D_REENTRANT -I${includedir} -I${includedir}/%{name}|' cfitsio.pc.in
sed -i 's|Libs: -L${libdir} -lcfitsio @LIBS@|Libs: -L${libdir} -lcfitsio|' cfitsio.pc.in
sed -i 's|Libs.private: -lm|Libs.private: @LIBS@ -lz -lm|' cfitsio.pc.in
# Fix version
sed -i 's|3.31|3.310|' cfitsio.pc.in
export CC=gcc
export FC=f95
export CFLAGS="%{optflags}"
%configure --enable-reentrant
make shared %{?_smp_mflags}
ln -s libcfitsio.so.0 libcfitsio.so
make fpack %{?_smp_mflags}
make funpack %{?_smp_mflags}
%check
# testsuite
make testprog
./testprog > testprog.lis
diff testprog.lis testprog.out
cmp testprog.fit testprog.std ; echo $?
%install
%makeinstall CFITSIO_INCLUDE=%{buildroot}%{_includedir}/%{name}
pushd %{buildroot}%{_libdir}
ln -s libcfitsio.so.0 libcfitsio.so
popd
mkdir %{buildroot}%{_bindir}
install -pm 0755 f{,un}pack %{buildroot}%{_bindir}/
# Remove static libraries
rm -f %{buildroot}%{_libdir}/libcfitsio.a
%post -n libcfitsio0 -p /sbin/ldconfig
%postun -n libcfitsio0 -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%doc License.txt README changes.txt fpackguide.pdf
%{_bindir}/fpack
%{_bindir}/funpack
%files -n libcfitsio0
%defattr(-,root,root,-)
%{_libdir}/libcfitsio.so.0*
%files -n libcfitsio-devel
%defattr(-,root,root,-)
%{_includedir}/%{name}/
%{_libdir}/libcfitsio.so
%{_libdir}/pkgconfig/cfitsio.pc
%files -n libcfitsio-devel-doc
%defattr(-,root,root,-)
%doc cfitsio.doc cfitsio.ps cfortran.doc fitsio.doc fitsio.ps quick.ps
%changelog