Blame SPECS/python3.11-pybind11.spec

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