Blame SPECS/python3.11-pybind11.spec

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