Blob Blame History Raw
Name:           healpix
Version:        2.11c
Release:        3%{?dist}
Summary:        Hierarchical Equal Area isoLatitude Pixelization of a sphere

Group:          Development/Libraries
License:        GPLv2+
URL:            http://healpix.jpl.nasa.gov/
Source0:        http://download.sourceforge.net/healpix/Healpix_2.11c_2009Feb19.tar.gz
Patch0:         healpix-2.11c-shlib.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  cfitsio-devel
BuildRequires:  gcc-gfortran

%description
HEALPix is an acronym for Hierarchical Equal Area isoLatitude Pixelization
of a sphere. As suggested in the name, this pixelization produces a
subdivision of a spherical surface in which each pixel covers the same
surface area as every other pixel.


%package -n c%{name}
Summary:        HEALPix C Bindings Library
Group:          System Environment/Libraries

%description -n c%{name}
Library for tools that use HEALPix C bindings.


%package -n c%{name}-devel
Summary:        HEALPix C Bindings Library development files
Group:          Development/Libraries
Requires:       c%{name} = %{version}

%description -n c%{name}-devel
Include file for development with HEALPix.


%package fortran
Summary:        HEALPix Fortran binaries
Group:          Applications/Engineering

%description fortran
Fortran HEALPix library and binaries.


%package fortran-devel
Summary:        HEALPix Fortran headers and static libraries
Group:          Development/Libraries

%description fortran-devel
Fortran modules used for developing HEALPix applications.


%prep
%setup -q -n Healpix_%{version}
%patch0 -p1 -b .shlib


%build
### C bindings

make %{?_smp_mflags} -C src/C/subs PIC="-fPIC" OPT="%{optflags}" \
        CFITSIO_INCDIR=%{_includedir}/cfitsio shared

### F90 bindings

# Make nonsense
export MOD=mod
export OS=Linux

# Directories for the created include, library and binary files
export BINDIR=$PWD/bin
export INCDIR=$PWD/include
export LIBDIR=$PWD/lib
mkdir $INCDIR $LIBDIR $BINDIR

# Compiler stuff
export FC=gfortran
export CFLAGS="%{optflags} -fPIC"
export FFLAGS="%{optflags} -fPIC -DGFORTRAN -I$INCDIR -ffree-line-length-none"

# SMP make doesn't work
make -C src/f90/mod 
make -C src/f90/lib
for dir in anafast map2gif hotspot smoothing synfast ud_grade plmgen \
        alteralm median_filter ngsims_full_sky
do
        make -C src/f90/$dir
done


%install
rm -rf $RPM_BUILD_ROOT

# Directory structure
install -d $RPM_BUILD_ROOT%{_bindir}
install -d $RPM_BUILD_ROOT%{_libdir}
install -d $RPM_BUILD_ROOT%{_includedir}/healpix

# C bindings
make install -C src/C/subs LIBDIR=$RPM_BUILD_ROOT%{_libdir} \
        INCDIR=$RPM_BUILD_ROOT%{_includedir}

# Fortran stuff
install -p bin/* $RPM_BUILD_ROOT%{_bindir}
install -p lib/* $RPM_BUILD_ROOT%{_libdir}
install -pm 0644 include/* $RPM_BUILD_ROOT%{_includedir}/healpix


%clean
rm -rf $RPM_BUILD_ROOT


%files -n chealpix
%defattr(-,root,root,-)
%{_libdir}/libchealpix.so
%doc COPYING READ_Copyrights_Licenses.txt


%files -n chealpix-devel
%defattr(-,root,root,-)
%{_includedir}/chealpix.h


%files -n healpix-fortran
%defattr(-,root,root,-)
%{_bindir}/*
%{_libdir}/libhealpix.so
%{_libdir}/libgif.so
%doc COPYING READ_Copyrights_Licenses.txt


%files -n healpix-fortran-devel
%defattr(-,root,root,-)
%{_includedir}/healpix


%changelog
* Fri Apr 03 2009 Lubomir Rintel (Fedora Astronomy) <lkundrak@v3.sk> - 2.11c-3
- Build Fortran library as DSO

* Thu Mar 26 2009 Jussi Lehtola <jussi.lehtola@helsinki.fi> - 2.11c-2
- Add Fortran bindings.

* Wed Mar 25 2009 Lubomir Rintel (Fedora Astronomy) <lkundrak@v3.sk> - 2.11c-1
- Initial packaging of the C bindings