lhapdf/lhapdf.spec
2018-02-07 20:46:24 +01:00

329 lines
11 KiB
RPMSpec

# Octave is no longer available for EPEL 6 ppc64
%if %{?rhel}%{!?rhel:0} == 6
%ifarch ppc64
%global octave 0
%else
%global octave 1
%endif
%else
%global octave 1
%endif
Name: lhapdf
Version: 5.9.1
Release: 23%{?dist}
Summary: Les Houches Accord PDF Interface
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
%if %{octave}
BuildRequires: octave-devel
%endif
BuildRequires: ncurses-devel
BuildRequires: python2-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
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
This package provides development files of LHAPDF, including C++ bindings.
%if %{octave}
%global octpkg %{name}
%package -n octave-%{name}
Summary: Les Houches Accord PDF Interface - Octave module
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.
%endif
%package -n python2-%{name}
Summary: Les Houches Accord PDF Interface - Python module
%{?python_provide:%python_provide python2-%{name}}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python2-%{name}
This package provides Python bindings for LHAPDF.
%package pdfsets-minimal
Summary: Les Houches Accord PDF Interface - PDF sets
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
%description pdfsets-minimal
This package provides a minimal PDF sets required by the test suites.
Note: the python2-lhapdf package provides the lhapdf-getdata script to
download other PDF sets.
%package doc
Summary: Les Houches Accord PDF Interface - documentation
BuildArch: noarch
%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/python2!' -i bin/lhapdf-* examples/*.py
sed 's!/usr/bin/env bash!/bin/bash!' -i bin/lhapdf-config.in
# Remove bundled swig generated sources
rm pyext/lhapdf_wrap.cc
rm pyext/lhapdf.py
%build
%if %{?fedora}%{!?fedora:0} >= 28 || %{?rhel}%{!?rhel:0} >= 8
# The code fails to compile without -std=legacy with gfortran >= 8
# Error: Actual argument contains too few elements for dummy argument
export FFLAGS="%{__global_fflags} -std=legacy"
%endif
%if %{octave}
%configure --disable-static --enable-octave
%else
%configure --disable-static --disable-octave
%endif
# Reduce overlinking
sed 's!CC \(.*-shared\) !CC \\\${wl}--as-needed \1 !' -i libtool
make %{?_smp_mflags}
%install
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
%if %{octave}
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
%endif
mkdir -p %{buildroot}%{_datadir}/%{name}/PDFsets
install -m 644 -p PDFsets/* %{buildroot}%{_datadir}/%{name}/PDFsets
%check
%ifnarch s390 %{arm}
GNUTERM=dumb make check
%endif
%ldconfig_scriptlets
%if %{octave}
%post -n octave-%{name}
%octave_cmd pkg rebuild
%postun -n octave-%{name}
%octave_cmd pkg rebuild
%endif
%files
%{_libdir}/libLHAPDF.so.*
%doc AUTHORS ChangeLog README TODO
%license COPYING
%files devel
%{_bindir}/lhapdf-config
%{_mandir}/man1/lhapdf-config.1*
%{_includedir}/LHAPDF
%{_libdir}/libLHAPDF.so
%doc examples/CC*.cc examples/Example*.f
%if %{octave}
%files -n octave-%{name}
%{octpkglibdir}
%{octpkgdir}
%doc lhapdf-octave-example1.m
%endif
%files -n python2-%{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
%license COPYING
%changelog
* Wed Feb 07 2018 Mattias Ellert <mattias.ellert@physics.uu.se> - 5.9.1-23
- Compile with -std=legacy when using gfortran >= 8
* Thu Aug 10 2017 Mattias Ellert <mattias.ellert@physics.uu.se> - 5.9.1-22
- Rename python package
- EPEL 5 End-Of-Life specfile clean-up
- Remove Group and BuildRoot tags
- Don't clear the buildroot in the install section
- Remove the clean section
- Remove octave packaging macro definitions
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.9.1-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.9.1-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Mon May 15 2017 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.9.1-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild
* Wed Feb 08 2017 Kalev Lember <klember@redhat.com> - 5.9.1-18
- Rebuilt for libgfortran soname bump
* Wed Dec 07 2016 Orion Poplawski <orion@cora.nwra.com> - 5.9.1-17
- Rebuild for octave 4.2
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.9.1-16
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Wed Feb 17 2016 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.9.1-15
- Disable octave support for EPEL 6 ppc64 - octave no longer available
* Mon Feb 08 2016 Mattias Ellert <mattias.ellert@fysast.uu.se> - 5.9.1-14
- Disable tests on arm
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 5.9.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Mon Jul 6 2015 Orion Poplawski <orion@cora.nwra.com> - 5.9.1-12
- Rebuild for octave 4.0
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.9.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 5.9.1-10
- Rebuilt for GCC 5 C++11 ABI change
* 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