Blob Blame History Raw
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

Name:		lhapdf
Version:	5.9.1
Release:	9%{?dist}
Summary:	Les Houches Accord PDF Interface
Group:		System Environment/Libraries

License:	GPLv2+
URL:		http://lhapdf.hepforge.org/
Source0:	http://www.hepforge.org/archive/lhapdf/%{name}-%{version}.tar.gz
#		Minimal set of PDFs (needed to run make check)
Source1:	http://www.hepforge.org/archive/lhapdf/pdfsets/%{version}/cteq5l.LHgrid
Source2:	http://www.hepforge.org/archive/lhapdf/pdfsets/%{version}/cteq6ll.LHpdf
Source3:	http://www.hepforge.org/archive/lhapdf/pdfsets/%{version}/cteq61.LHgrid
Source4:	http://www.hepforge.org/archive/lhapdf/pdfsets/%{version}/CT10.LHgrid
Source5:	http://www.hepforge.org/archive/lhapdf/pdfsets/%{version}/GRV98nlo.LHgrid
Source6:	http://www.hepforge.org/archive/lhapdf/pdfsets/%{version}/MRST2001nlo.LHgrid
#		Man pages (from the Debian package)
Source7:	%{name}-config.1
Source8:	%{name}-getdata.1
Source9:	%{name}-query.1
#		Patches (from the Debian package)
Patch0:		%{name}-fix-lhapdf-config.patch
Patch1:		%{name}-fix-test-environment.patch
Patch2:		%{name}-fix-typo.patch
Patch3:		%{name}-path-max.patch
Patch4:		%{name}-lhacontrol.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:	octave-devel
BuildRequires:	ncurses-devel
BuildRequires:	python-devel
BuildRequires:	gcc-gfortran
BuildRequires:	swig
BuildRequires:	doxygen
BuildRequires:	tex(latex)
BuildRequires:	ghostscript

%description
LHAPDF provides a unified and easy to use interface to modern PDF
sets. It is designed to work not only with individual PDF sets but
also with the more recent multiple "error" sets. It can be viewed as
the successor to PDFLIB, incorporating many of the older sets found in
the latter, including pion and photon PDFs. In LHAPDF the computer
code and input parameters/grids are separated thus allowing more easy
updating and no limit to the expansion possibilities.

%package devel
Summary:	Les Houches Accord PDF Interface - development files
Group:		Development/Libraries
Requires:	%{name}%{?_isa} = %{version}-%{release}

%description devel
This package provides development files of LHAPDF, including C++ bindings.

%global octpkg %{name}
%{!?octave_api: %global octave_api %(octave-config -p API_VERSION || echo 0)}
%{!?octpkgdir: %global octpkgdir %{_datadir}/octave/packages/%{octpkg}-%{version}}
%{!?octpkglibdir: %global octpkglibdir %{_libexecdir}/octave/packages/%{octpkg}-%{version}}
%{!?octave_cmd: %global octave_cmd() octave -H -q --no-site-file --eval "%*";}

%package -n octave-%{name}
Summary:	Les Houches Accord PDF Interface - Octave module
Group:		Applications/Engineering
Requires:	%{name}%{?_isa} = %{version}-%{release}
Requires:	octave(api) = %{octave_api}
Requires(post):		octave
Requires(postun):	octave

%description -n octave-%{name}
This package provides Octave bindings for LHAPDF.

%package -n python-%{name}
Summary:	Les Houches Accord PDF Interface - Python module
Group:		Applications/Engineering
Requires:	%{name}%{?_isa} = %{version}-%{release}

%description -n python-%{name}
This package provides Python bindings for LHAPDF.

%package pdfsets-minimal
Summary:	Les Houches Accord PDF Interface - PDF sets
Group:		Applications/Engineering
%if %{?fedora}%{!?fedora:0} >= 10 || %{?rhel}%{!?rhel:0} >= 6
BuildArch:	noarch
%endif
Requires:	%{name} = %{version}-%{release}

%description pdfsets-minimal
This package provides a minimal PDF sets required by the test suites.
Note: the python-lhapdf package provides the lhapdf-getdata script to
download other PDF sets.

%package doc
Summary:	Les Houches Accord PDF Interface - documentation
Group:		Documentation
%if %{?fedora}%{!?fedora:0} >= 10 || %{?rhel}%{!?rhel:0} >= 6
BuildArch:	noarch
%endif

%description doc
This package provides documentation of C++ bindings for LHAPDF.

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
mkdir PDFsets
install -m 644 -p %SOURCE1 PDFsets
install -m 644 -p %SOURCE2 PDFsets
install -m 644 -p %SOURCE3 PDFsets
install -m 644 -p %SOURCE4 PDFsets
install -m 644 -p %SOURCE5 PDFsets
install -m 644 -p %SOURCE6 PDFsets

sed 's!/usr/bin/env python!/usr/bin/python!' -i bin/lhapdf-* examples/*.py
sed 's!/usr/bin/env bash!/bin/bash!' -i bin/lhapdf-config.in

%if %{?fedora}%{!?fedora:0} >= 7 || %{?rhel}%{!?rhel:0} >= 6
# Remove bundled swig generated sources
rm pyext/lhapdf_wrap.cc
rm pyext/lhapdf.py
%endif

%build
%configure --disable-static --enable-octave

# Reduce overlinking
sed 's!CC -shared !CC \${wl}--as-needed -shared !g' -i libtool

make %{?_smp_mflags}

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}

mkdir -p %{buildroot}%{_mandir}/man1
install -m 644 -p %SOURCE7 %{buildroot}%{_mandir}/man1
install -m 644 -p %SOURCE8 %{buildroot}%{_mandir}/man1
install -m 644 -p %SOURCE9 %{buildroot}%{_mandir}/man1

rm %{buildroot}%{_libdir}/libLHAPDF.la
rm %{buildroot}%{_datadir}/%{name}/doc/html

APIDIR=$(octave-config -p CANONICAL_HOST_TYPE)-$(octave-config -p API_VERSION)
mkdir -p %{buildroot}%{octpkglibdir}/${APIDIR}
mv %{buildroot}%{_datadir}/%{name}/%{name}.oct \
   %{buildroot}%{octpkglibdir}/${APIDIR}/%{name}.oct
chmod 755 %{buildroot}%{octpkglibdir}/${APIDIR}/%{name}.oct
mkdir -p %{buildroot}%{octpkgdir}/packinfo
install -m 644 -p COPYING %{buildroot}%{octpkgdir}/packinfo/COPYING
cat << EOF > %{buildroot}%{octpkgdir}/packinfo/DESCRIPTION
Name: %{name}
Version: %{version}
Date: `date -I`
Author: W Giele <giele@fnal.gov>, Mike R Whalley <m.r.whalley@durham.ac.uk>
Maintainer: W Giele <giele@fnal.gov>, Mike R Whalley <m.r.whalley@durham.ac.uk>
Title: Les Houches Accord PDF Interface
Description: LHAPDF provides a unified and easy to use interface to
 modern PDF sets. It is designed to work not only with individual PDF
 sets but also with the more recent multiple "error" sets. It can be
 viewed as the successor to PDFLIB, incorporating many of the older sets
 found in the latter, including pion and photon PDFs. In LHAPDF the
 computer code and input parameters/grids are separated thus allowing
 more easy updating and no limit to the expansion possibilities.
EOF

sed '2a pkg load lhapdf' octave/lhapdf-octave-example1.m \
  > lhapdf-octave-example1.m

mkdir -p %{buildroot}%{_datadir}/%{name}/PDFsets
install -m 644 -p PDFsets/* %{buildroot}%{_datadir}/%{name}/PDFsets

%check
%ifnarch s390
GNUTERM=dumb make check
%endif

%clean
rm -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post -n octave-%{name}
%octave_cmd pkg rebuild

%postun -n octave-%{name}
%octave_cmd pkg rebuild

%files
%{_libdir}/libLHAPDF.so.*
%doc AUTHORS ChangeLog COPYING README TODO

%files devel
%{_bindir}/lhapdf-config
%{_mandir}/man1/lhapdf-config.1*
%{_includedir}/LHAPDF
%{_libdir}/libLHAPDF.so
%doc examples/CC*.cc examples/Example*.f

%files -n octave-%{name}
%{octpkglibdir}
%{octpkgdir}
%doc lhapdf-octave-example1.m

%files -n python-%{name}
%{_bindir}/lhapdf-getdata
%{_bindir}/lhapdf-query
%{_mandir}/man1/lhapdf-getdata.1*
%{_mandir}/man1/lhapdf-query.1*
%{python_sitearch}/*
%doc examples/pdf-*.py

%files pdfsets-minimal
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/PDFsets
%{_datadir}/%{name}/PDFsets.index

%files doc
%doc ccwrap/doxy/html COPYING

%changelog
* Sat Mar 07 2015 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.9.1-9
- Fix lhacontrol common block in example

* Sun Oct 12 2014 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.9.1-8
- Re-enable octave for EPEL 7

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.9.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.9.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Tue Jun 03 2014 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.9.1-5
- Disable octave for EPEL 7 - not yet available

* Tue Jan 07 2014 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.9.1-4
- Add "pkg load lhapdf" to octave example
- Fixes for EPEL 5

* Sat Dec 28 2013 Kevin Fenzi <kevin@scrye.com> - 5.9.1-3
- Rebuild to fix broken deps

* Thu Nov 21 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.9.1-2
- Remove bundled swig generated sources

* Tue Oct 29 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.9.1-1
- Update to version 5.9.1

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.8.9-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Tue Jun 18 2013 Dan HorĂ¡k <dan[at]danny.cz> - 5.8.9-4
- don't run check on s390 - OOM when loading the library in Octave

* Wed Jun 05 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.8.9-3
- Make doc package independent

* Wed May 22 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.8.9-2
- Reduce libtool overlinking
- Add isa to dependencies

* Sat May 18 2013 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.8.9-1
- Update to version 5.8.9

* Wed Nov 14 2012 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.8.8-1
- Initial build