diff --git a/pythia8.spec b/pythia8.spec index 562beec..ce50c78 100644 --- a/pythia8.spec +++ b/pythia8.spec @@ -1,3 +1,15 @@ +%if %{?rhel}%{!?rhel:0} == 6 +%ifarch ppc64 +# The Python 2 bindings can not be built on ppc64 for EPEL 6 +# Error: operand out of range +%global buildpy2 0 +%else +%global buildpy2 1 +%endif +%else +%global buildpy2 1 +%endif + Name: pythia8 Version: 8.2.35 Release: 1%{?dist} @@ -16,7 +28,9 @@ BuildRequires: gcc-c++ %if %{?rhel}%{!?rhel:0} == 6 BuildRequires: gcc-gfortran %endif +%if %{buildpy2} BuildRequires: python2-devel +%endif %if %{?fedora}%{!?fedora:0} || %{?rhel}%{!?rhel:0} >= 8 BuildRequires: python3-devel %endif @@ -51,6 +65,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release} %description lhapdf This package provides the LHAPDF interface for Pythia 8. +%if %{buildpy2} %package -n python2-%{name} Summary: Pythia 8 Python 2 bindings %{?py2_dist: @@ -61,7 +76,9 @@ Requires: %{name}%{?_isa} = %{version}-%{release} %description -n python2-%{name} This package provides the Python 2 bindings for Pythia 8. +%endif +%if %{?fedora}%{!?fedora:0} || %{?rhel}%{!?rhel:0} >= 7 %package -n python%{python3_pkgversion}-%{name} Summary: Pythia 8 Python 3 bindings %{?py3_dist: @@ -72,6 +89,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release} %description -n python%{python3_pkgversion}-%{name} This package provides the Python 3 bindings for Pythia 8. +%endif %package data Summary: Pythia 8 Data Files @@ -124,6 +142,7 @@ ln -s libpythia8-%{version}.so lib/libpythia8.so make lib/pythia8.py PYTHON_BIN='#' mv lib/pythia8.py . +%if %{buildpy2} mkdir py2 if pkg-config --exists python2 ; then PY2INC=$(pkg-config --cflags python2) @@ -136,6 +155,7 @@ g++ -x c++ include/Pythia8Plugins/PythonWrapper.h -c -o py2/PythonWrapper.o \ ${PY2INC} -Iinclude %{optflags} -fPIC -DGZIPSUPPORT g++ py2/PythonWrapper.o -Llib -lpythia8 -o py2/_pythia8.so \ ${PY2LIB} -ldl %{?__global_ldflags} -Wl,-z,defs -shared +%endif %if %{?fedora}%{!?fedora:0} || %{?rhel}%{!?rhel:0} >= 7 mkdir py3 @@ -149,7 +169,6 @@ g++ py3/PythonWrapper.o -Llib -lpythia8 -o py3/_pythia8.${PY3SOABI}.so \ %endif %install -rm -rf %{buildroot} make %{?_smp_mflags} install \ PREFIX_BIN=%{buildroot}%{_bindir} \ PREFIX_INCLUDE=%{buildroot}%{_includedir} \ @@ -169,9 +188,11 @@ rm %{buildroot}%{_datadir}/Pythia8/examples/Makefile rm %{buildroot}%{_datadir}/Pythia8/examples/Makefile.inc rm %{buildroot}%{_datadir}/Pythia8/examples/runmains +%if %{buildpy2} mkdir -p %{buildroot}%{python2_sitearch} install -p -m 644 pythia8.py %{buildroot}%{python2_sitearch} install -p -m 755 py2/_pythia8.so %{buildroot}%{python2_sitearch} +%endif %if %{?fedora}%{!?fedora:0} || %{?rhel}%{!?rhel:0} >= 7 mkdir -p %{buildroot}%{python3_sitearch} @@ -197,12 +218,14 @@ install -p -m 755 py3/_pythia8.*.so %{buildroot}%{python3_sitearch} %files lhapdf %{_libdir}/libpythia8lhapdf*.so +%if %{buildpy2} %files -n python2-%{name} -%{python2_sitearch} +%{python2_sitearch}/* +%endif %if %{?fedora}%{!?fedora:0} || %{?rhel}%{!?rhel:0} >= 7 %files -n python%{python3_pkgversion}-%{name} -%{python3_sitearch} +%{python3_sitearch}/* %endif %files data @@ -224,7 +247,7 @@ install -p -m 755 py3/_pythia8.*.so %{buildroot}%{python3_sitearch} %changelog * Wed Jul 04 2018 Mattias Ellert - 8.2.35-1 - Update to version 8.2.35 -- Add python bindings +- Add python bindings (except on ppc64 for EPEL 6) - Change license tag from GPLv2 to GPLv2+ * Wed Mar 07 2018 Adam Williamson - 8.2.15-7