%global pypi_name executorch Name: python-%{pypi_name} Version: 1.3.1 Release: 0%{?dist} Summary: On-device AI across mobile, embedded and edge for PyTorch License: BSD-3-Clause URL: https://pytorch.org/executorch/ Source0: https://github.com/pytorch/executorch/archive/%{version}.tar.gz#/%{pypi_name}-%{version}.tar.gz # Patches to use various systems libraries, the intention # is to work to get these upstream (if possible) Patch1: executorch-toplevel-system-libs.patch Patch2: executorch-use-system-libs.patch Patch3: executorch-xnnpack-dependencies.patch Patch4: executorch-xnnpack-cmakelists.patch Patch5: executorch-toplevel-tokenizers.patch Patch6: executorch-toplevel-pybind-python-embed.patch Patch7: executorch-use-system-flatcc.patch Patch8: executorch-eigenblas-system.patch Patch9: executorch-pybind11-python-dev-fix.patch Patch10: executorch-coreml-pybind-python-embed.patch ExclusiveArch: x86_64 aarch64 BuildRequires: git-core BuildRequires: gcc gcc-c++ BuildRequires: cpuinfo-devel BuildRequires: flatbuffers-devel BuildRequires: flatbuffers-compiler BuildRequires: flatcc-devel BuildRequires: flexiblas-devel BuildRequires: fxdiv-devel BuildRequires: gflags-devel BuildRequires: json-devel BuildRequires: pthreadpool-devel BuildRequires: pybind11-devel BuildRequires: python3-cmake BuildRequires: python3-devel BuildRequires: python3-pip BuildRequires: python3-setuptools BuildRequires: python3-torch BuildRequires: python3-pytorch-tokenizers-devel BuildRequires: xnnpack-devel %global _description %{expand: ExecuTorch is PyTorch's unified solution for deploying AI models on-device—from smartphones to microcontrollers—built for privacy, performance, and portability. It powers Meta's on-device AI across Instagram, WhatsApp, Quest 3, Ray-Ban Meta Smart Glasses, and more. Deploy LLMs, vision, speech, and multimodal models with the same PyTorch APIs you already know—accelerating research to production with seamless model export, optimization, and deployment. No manual C++ rewrites. No format conversions. No vendor lock-in. } %description %_description %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %_description %prep %autosetup -p1 -n %{pypi_name}-%{version} # Allow for versioned executorch directories sed -i 's/STREQUAL "executorch"/MATCHES "^executorch(-.*)?$"/' CMakeLists.txt # Adjust for Fedora python version minimums sed -i 's/>=3.10,<3.14/>=3.10/' pyproject.toml # Adjust for Fedora cmake versions sed -i 's/,<4.0.0//g' pyproject.toml sed -i 's/, <4.0.0//g' requirements-dev.txt # Fedora has 1.4.x sed -i 's/mpmath==1.3.0/mpmath>=1.3.0/' pyproject.toml # Fedora has 1.8 sed -i 's/scikit-learn==1.7.1/scikit-learn>=1.7.1/' pyproject.toml # Fedora has 9.x sed -i 's/pytest<9.0/pytest/' pyproject.toml # Fedora has 15.0 sed -i 's/pytest-rerunfailures==15.1/pytest-rerunfailures==15.0/' pyproject.toml # Complements patch8 needs a better fix sed -i '/pybind11_add_module(selective_build SHARED/i find_package(Python3 COMPONENTS Interpreter Development.Embed REQUIRED)' codegen/tools/CMakeLists.txt sed -i '/pybind11_add_module($/i \ find_package(Python3 COMPONENTS Interpreter Development.Embed REQUIRED)' extension/training/CMakeLists.txt sed -i '/pybind11_add_module($/i \ find_package(Python3 COMPONENTS Interpreter Development.Embed REQUIRED)' extension/llm/runner/CMakeLists.txt %generate_buildrequires %pyproject_buildrequires %build export CMAKE_ARGS="-DEXECUTORCH_USE_SYSTEM_LIBS=ON -DEXECUTORCH_XNNPACK_USE_SYSTEM_LIBS=ON \ -DEXECUTORCH_BUILD_OPENVINO=OFF -DEXECUTORCH_BUILD_DEVTOOLS=OFF \ -DEXECUTORCH_ENABLE_EVENT_TRACER=OFF -DEXECUTORCH_BUILD_SHARED=ON \ -DEXECUTORCH_BUILD_EXTENSION_LLM=OFF -DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=OFF \ -DEXECUTORCH_BUILD_COREML=OFF" %pyproject_wheel %install %pyproject_install %pyproject_save_files -l %{pypi_name} %files -n python3-%{pypi_name} -f %{pyproject_files} %doc README.md %changelog * Sun Oct 19 2025 Peter Robinson - 1.0.0-1 - Initial package