# ProxSuite is a CMake project (header-only C++ core + nanobind Python bindings).
# Upstream also ships a pyproject.toml using the cmeel build backend, which is a
# pip/conda-only packaging shim for the very same CMake build. openEuler builds
# the project with its native CMake build system (same as the ROS buildfarm,
# see package.xml cmake), so no cmeel/cmeel-eigen/
# cmeel-simde RPMs are needed.
#
# Source layout (ground truth, verified with `tar tzf`):
# topdir: proxsuite-0.7.3
# The tarball is generated from the upstream git checkout (tag v0.7.3) with the
# two mandatory submodules already populated: cmake-module (jrl-cmakemodules),
# bindings/python/external/nanobind and external/cereal. VCS metadata (.git) is
# not shipped, hence PROJECT_VERSION is passed explicitly to CMake below.
%global pypi_name proxsuite
Name: python-%{pypi_name}
Version: 0.7.3
Release: 1%{?dist}
Summary: The Advanced Proximal Optimization Toolbox (QP/LP solvers)
License: BSD-2-Clause
URL: https://github.com/Simple-Robotics/proxsuite
Source0: https://github.com/Simple-Robotics/proxsuite/archive/refs/tags/v%{version}/%{pypi_name}-%{version}.tar.gz
# The CMake configure step must not create directories inside the system-wide
# site-packages: the RPM build runs as an unprivileged user (mockbuild) and the
# root-owned /usr/lib64/python3.11/site-packages is not writable there, so
# `file(MAKE_DIRECTORY .../site-packages/proxsuite/torch)` aborts the configure.
# The directory is created by the install rules anyway (they honour DESTDIR).
Patch0: proxsuite-0.7.3-no-configure-time-mkdir.patch
BuildRequires: cmake
BuildRequires: make
BuildRequires: gcc-c++
BuildRequires: git
BuildRequires: pkgconfig
BuildRequires: eigen3-devel
BuildRequires: simde-devel
BuildRequires: python3-devel
%description
ProxSuite is a collection of open-source, numerically robust, precise and
efficient numerical solvers (LP, QP, ...) rooted in revisited primal-dual
proximal algorithms. It offers a header-only C++14/17/20 library together with
Python bindings, and supports dense, sparse and matrix-free problem structures.
This package provides the Python bindings of ProxSuite.
%package -n python3-%{pypi_name}
Summary: Python bindings for ProxSuite
Requires: python3-numpy
Requires: python3-scipy
Provides: python-%{pypi_name} = %{version}-%{release}
Provides: python3dist(proxsuite) = %{version}
%description -n python3-%{pypi_name}
ProxSuite is a collection of open-source, numerically robust, precise and
efficient numerical solvers (LP, QP, ...) rooted in revisited primal-dual
proximal algorithms.
This package provides the ProxSuite Python module (proxsuite), including the
ProxQP dense/sparse solvers and the proxsuite.torch helpers.
%package -n %{pypi_name}-devel
Summary: C++ headers and CMake configuration for ProxSuite
Requires: eigen3-devel
Requires: simde-devel
Provides: %{pypi_name}-static = %{version}-%{release}
%description -n %{pypi_name}-devel
ProxSuite is a collection of open-source, numerically robust, precise and
efficient numerical solvers (LP, QP, ...) rooted in revisited primal-dual
proximal algorithms.
This package provides the header-only C++ library, the CMake package
configuration (proxsuiteConfig.cmake) and the pkg-config file.
%prep
%autosetup -p1 -n %{pypi_name}-%{version}
%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
mkdir -p %{_target_platform}
cd %{_target_platform}
cmake .. \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DCMAKE_INSTALL_LIBDIR=%{_lib} \
-DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \
-DCMAKE_INSTALL_BINDIR=%{_bindir} \
-DCMAKE_BUILD_TYPE=Release \
-DPROJECT_VERSION=%{version} \
-DPYTHON_SITELIB=%{python3_sitearch} \
-DPython_EXECUTABLE=%{__python3} \
-DBUILD_TESTING=OFF \
-DBUILD_DOCUMENTATION=OFF \
-DINSTALL_DOCUMENTATION=OFF \
-DBUILD_BENCHMARK=OFF \
-DBUILD_PYTHON_INTERFACE=ON \
-DBUILD_WITH_OPENMP_SUPPORT=OFF \
-DBUILD_WITH_VECTORIZATION_SUPPORT=ON
make %{?_smp_mflags}
%install
cd %{_target_platform}
make install DESTDIR=%{buildroot}
%files -n python3-%{pypi_name}
%license LICENSE
%doc README.md
%{python3_sitearch}/%{pypi_name}/
# AMENT (ROS 2) metadata installed by jrl-cmakemodules' SETUP_PROJECT_FINALIZE
# (_install_project_ros2_ament_files): without these entries rpmbuild aborts
# with "Installed (but unpackaged) file(s) found".
%{_datadir}/ament_index/resource_index/packages/%{pypi_name}
%{_datadir}/%{pypi_name}/
%files -n %{pypi_name}-devel
%license LICENSE
%{_includedir}/%{pypi_name}/
%{_libdir}/cmake/%{pypi_name}/
%{_libdir}/pkgconfig/%{pypi_name}.pc
%changelog
* Mon Sep 21 2026 Python_Bot - 0.7.3-1
- Initial package