File libcfitsio0.spec of Package libcfitsio0

#
# spec file for package libcfitsio0 (Version 3.23.0)
#
# Copyright (c) 2010 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
BuildRequires:  gcc-fortran
Url:            http://heasarc.nasa.gov/fitsio/fitsio.html
License:        GPLv2 ; Other uncritical OpenSource License
Group:          Development/Libraries/Other
AutoReqProv:    on
Version:        3.23.0
Release:        2
Summary:        A FITS File Subroutine Library
Source:         cfitsio3230.tar.bz2
Patch1:         cfitsio-makefile.patch
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 informationin FITS files.



%package -n libcfitsio-devel 
License:        GPLv2 ; Other uncritical OpenSource License
Group:          Development/Libraries/Other
Summary:        Headers required when building programs against cfitsio library
Requires:       %{name} = %{version}-%{release}                                       
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
Group:          Development/Libraries/Other
Summary:        The documentation for FITS File Subroutine Library
Requires:       %{name} = %{version}-%{release}                                       

%description -n libcfitsio-doc
This pacakge contains documentation for FITS File Subroutine Library.



%prep
%setup -n cfitsio
%patch1

%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)
if [ "%version" = "3.18.1" ]; then
	#fix hardcoded libdir
	%__sed -i 's|${exec_prefix}/lib|${exec_prefix}/%{_lib}|' cfitsio.pc.in
	#add include dir
	%__sed -i 's|Cflags: -I${includedir}|$Cflags: -I${includedir} -I${includedir}/libcfitsio0|' cfitsio.pc.in
	#and fix version
	%__sed -i 's|3.006|3.18|' cfitsio.pc.in
fi
export CC=gcc
export FC=f95
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
%configure
make shared

%check
# testsuite
make testprog
./testprog > testprog.lis
diff testprog.lis testprog.out
cmp testprog.fit testprog.std ; echo $?

%install
mkdir -p $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_libdir}        
mkdir -p $RPM_BUILD_ROOT%{_includedir}/%{name}
make LIBDIR=%{_lib} INCLUDEDIR=include/%{name} CFITSIO_LIB=$RPM_BUILD_ROOT%{_libdir} \
     CFITSIO_INCLUDE=$RPM_BUILD_ROOT%{_includedir}/%{name} install 
pushd $RPM_BUILD_ROOT%{_libdir}
ln -s libcfitsio.so.0 libcfitsio.so                                             
popd       
#   mkdir -p $RPM_BUILD_ROOT/usr/lib/pkgconfig
#mkdir -p $RPM_BUILD_ROOT/usr/include
# make DESTDIR=$RPM_BUILD_ROOT install

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc License.txt README changes.txt
%{_libdir}/libcfitsio.so.*

%files -n libcfitsio-devel
%defattr(-,root,root)
/usr/include/%{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