File libcfitsio0.spec of Package libcfitsio0

#
# spec file for package libcfitsio0
#
# Copyright (c) 2011 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/
#

# norootforbuild


Name:           libcfitsio0
Version:        3.280
Release:        1
License:        GPLv2 ; Other uncritical OpenSource License
Summary:        Library for manipulating FITS data files
Url:            http://heasarc.nasa.gov/fitsio/fitsio.html
Group:          System/Libraries
Source0:        ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3280.tar.gz
# PATCH-FIX-OPENSUSE cfitsio-makefile.patch -- Fix installation paths and library soname
Patch0:         cfitsio-makefile.patch
BuildRequires:  gcc-fortran
BuildRequires:  pkg-config
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.

%package -n cfitsio
License:        GPLv2 ; Other uncritical OpenSource License
Summary:        FITS image compression and decompression utilities
Group:          Productivity/Scientific/Other
Requires:       %{name} = %{version}

%description -n cfitsio
This package contains some FITS image compression and decompression utilities.

%package -n libcfitsio-devel
License:        GPLv2 ; Other uncritical OpenSource License
Summary:        Headers required when building programs against cfitsio library
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}
Requires:       pkgconfig

%description -n libcfitsio-devel
This package contains headers required when building programs against cfitsio
library.

%package -n libcfitsio-doc
License:        GPLv2 ; Other uncritical OpenSource License
Summary:        Documentation for the cfitsio library
Group:          Documentation/Other
Requires:       %{name} = %{version}

%description -n libcfitsio-doc
This package contains documentation for the cfitsio library.

%prep
%setup -q -n cfitsio
%patch0

%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
sed -i 's|Cflags: -I${includedir}|Cflags: -I${includedir} -I${includedir}/%{name}|' cfitsio.pc.in
# Fix version
sed -i 's|3.28|3.280|' cfitsio.pc.in

export CC=gcc
export FC=f95
export CFLAGS="%{optflags} -fno-strict-aliasing"
%configure
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
mkdir -p %{buildroot}
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_includedir}/%{name}
make LIBDIR=%{_lib} INCLUDEDIR=include/%{name} CFITSIO_LIB=%{buildroot}%{_libdir} \
     CFITSIO_INCLUDE=%{buildroot}%{_includedir}/%{name} install
pushd %{buildroot}%{_libdir}
ln -s libcfitsio.so.0 libcfitsio.so
popd
mkdir %{buildroot}%{_bindir}
install -pm 0755 f{,un}pack %{buildroot}%{_bindir}/

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%{_libdir}/libcfitsio.so.0*

%files -n cfitsio
%defattr(-,root,root,-)
%doc License.txt README changes.txt fpackguide.pdf
%{_bindir}/fpack
%{_bindir}/funpack

%files -n libcfitsio-devel
%defattr(-,root,root,-)
%{_includedir}/%{name}/
%{_libdir}/libcfitsio.a
%{_libdir}/libcfitsio.so
%{_libdir}/pkgconfig/cfitsio.pc

%files -n libcfitsio-doc
%defattr(-,root,root,-)
%doc cfitsio.doc cfitsio.ps cfortran.doc fitsio.doc fitsio.ps quick.ps

%changelog
openSUSE Build Service is sponsored by