Blame SPECS/python3.11-pybind11.spec

1f644d
%global __python3 /usr/bin/python3.11
1f644d
%global python3_pkgversion 3.11
1f644d
1f644d
# While the headers are architecture independent, the package must be
1f644d
# built separately on all architectures so that the tests are run
1f644d
# properly. See also
1f644d
# https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_Header_Only_Libraries
1f644d
%global debug_package %{nil}
1f644d
1f644d
# Whether to run the tests, enabled by default
1f644d
# ppc64le tests cannot be compiled with lto enabled so we disable them
1f644d
# there for now
1f644d
%ifarch ppc64le
1f644d
%bcond_with tests
1f644d
%else
1f644d
%bcond_without tests
1f644d
%endif
1f644d
1f644d
%global modname pybind11
1f644d
1f644d
Name:    python%{python3_pkgversion}-pybind11
1f644d
Version: 2.10.3
1f644d
Release: 2%{?dist}
1f644d
Summary: Seamless operability between C++11 and Python
1f644d
License: BSD
1f644d
URL:   https://github.com/pybind/pybind11
1f644d
Source0: https://github.com/pybind/pybind11/archive/v%{version}/%{modname}-%{version}.tar.gz
1f644d
1f644d
# Patch out header path
1f644d
Patch1:  pybind11-2.10.1-hpath.patch
1f644d
1f644d
BuildRequires: make
1f644d
1f644d
# Needed to build the python libraries
1f644d
BuildRequires: python%{python3_pkgversion}-devel
1f644d
BuildRequires: python%{python3_pkgversion}-rpm-macros
1f644d
BuildRequires: python%{python3_pkgversion}-setuptools
1f644d
# These are only needed for the checks
1f644d
%if %{with tests}
1f644d
BuildRequires: python%{python3_pkgversion}-pytest
1f644d
BuildRequires: python%{python3_pkgversion}-numpy
1f644d
BuildRequires: python%{python3_pkgversion}-scipy
1f644d
%endif
1f644d
1f644d
BuildRequires: eigen3-devel
1f644d
BuildRequires: gcc-c++
1f644d
BuildRequires: cmake
1f644d
1f644d
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
1f644d
1f644d
%global base_description \
1f644d
pybind11 is a lightweight header-only library that exposes C++ types \
1f644d
in Python and vice versa, mainly to create Python bindings of existing \
1f644d
C++ code.
1f644d
1f644d
%description
1f644d
%{base_description}
1f644d
1f644d
%package devel
1f644d
Summary:  Development headers for pybind11
1f644d
1f644d
# This package does not have namespaced file locations, so if we build the
1f644d
# pybind11-devel subpackage in any other stack as well, the files from these
1f644d
# packages will conflict. The package name is namespaced so that customers can
1f644d
# decide which to install, but the packages will conflict with each other.
1f644d
Provides:   %{modname}-devel = %{version}-%{release}
1f644d
Conflicts:  %{modname}-devel < %{version}-%{release} 
1f644d
1f644d
# https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_Header_Only_Libraries
1f644d
Provides: %{modname}-static = %{version}-%{release}
1f644d
Provides: %{name}-static = %{version}-%{release}
1f644d
# For dir ownership
1f644d
Requires: cmake
1f644d
1f644d
%description devel
1f644d
%{base_description}
1f644d
1f644d
This package contains the development headers for pybind11.
1f644d
1f644d
%prep
1f644d
%autosetup -p1 -n %{modname}-%{version}
1f644d
1f644d
%build
1f644d
py=python3
1f644d
mkdir $py
1f644d
# When -DCMAKE_BUILD_TYPE is set to Release, the tests in %%check might segfault.
1f644d
# However, we do not ship any binaries, and therefore Debug
1f644d
# build type does not affect the results.
1f644d
# https://bugzilla.redhat.com/show_bug.cgi?id=1921199
1f644d
%if 0%{?rhel} < 9
1f644d
cd $py
1f644d
%cmake .. -DCMAKE_BUILD_TYPE=Debug -DPYTHON_EXECUTABLE=%{__python3} -DPYBIND11_INSTALL=TRUE -DUSE_PYTHON_INCLUDE_DIR=FALSE %{!?with_tests:-DPYBIND11_TEST=OFF}
1f644d
%make_build
1f644d
cd ..
1f644d
%else
1f644d
%cmake -B $py -DCMAKE_BUILD_TYPE=Debug -DPYTHON_EXECUTABLE=%{__python3} -DPYBIND11_INSTALL=TRUE -DUSE_PYTHON_INCLUDE_DIR=FALSE %{!?with_tests:-DPYBIND11_TEST=OFF}
1f644d
%make_build -C $py
1f644d
%endif
1f644d
1f644d
%py3_build
1f644d
1f644d
%if %{with tests}
1f644d
%check
1f644d
make -C python3 check %{?_smp_mflags}
1f644d
%endif
1f644d
1f644d
%install
1f644d
%make_install -C python3
1f644d
# Force install to arch-ful directories instead.
1f644d
PYBIND11_USE_CMAKE=true %py3_install "--install-purelib" "%{python3_sitearch}"
1f644d
1f644d
%files devel
1f644d
%license LICENSE
1f644d
%doc README.rst
1f644d
%{_includedir}/pybind11/
1f644d
%{_datadir}/cmake/pybind11/
1f644d
%{_bindir}/pybind11-config
1f644d
%{_datadir}/pkgconfig/%{modname}.pc
1f644d
1f644d
%files
1f644d
%{python3_sitearch}/%{modname}/
1f644d
%{python3_sitearch}/%{modname}-%{version}-py%{python3_version}.egg-info
1f644d
1f644d
%changelog
1f644d
* Mon Feb 20 2023 Charalampos Stratakis <cstratak@redhat.com> - 2.10.3-2
1f644d
- Enable tests
1f644d
1f644d
* Thu Dec 01 2022 Charalampos Stratakis <cstratak@redhat.com> - 2.10.3-1
1f644d
- Initial package
1f644d
- Fedora contributions by:
1f644d
      Elliott Sales de Andrade <quantum.analyst@gmail.com>
1f644d
      Jonathan <jonathan@knownhost.com>
1f644d
      jonathanspw <jonathan@almalinux.org>
1f644d
      Merlin Mathesius <mmathesi@redhat.com>
1f644d
      Miro HronĨok <miro@hroncok.cz>
1f644d
      Susi Lehtola <jussilehtola@fedoraproject.org>
1f644d
      Tom Stellard <tstellar@redhat.com>