Blame SPECS/python3.11-pybind11.spec

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