File halide.spec of Package halide
#
# spec file for package halide
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%global HALIDE_VERSION 18
%global HALIDE_SOVERSION 0
%bcond_without tests
# Build broken with latest flatbuffers
%bcond_with serialization
%bcond_without python
%bcond_without vulkan
%global __builder ninja
Name: halide
Version: 18.0.0
Release: 0
License: MIT
Group: Development/Libraries/C and C++
Summary: A language for portable data-parallel computation
Url: https://github.com/halide/Halide
Source: https://github.com/halide/Halide/archive/refs/tags/v%{version}.tar.gz#/halide-v%{version}.tar.gz
# PATCH-FIX-UPSTREAM - Numpy 2 support
Patch1: 8381.patch
BuildRequires: pkgconfig(gl)
BuildRequires: clang-devel
BuildRequires: cmake
BuildRequires: doxygen
BuildRequires: pkgconfig(eigen3)
BuildRequires: fdupes
%if %{with serialization}
BuildRequires: flatbuffers-devel
%endif
BuildRequires: pkgconfig(libjpeg)
BuildRequires: libomp-devel
BuildRequires: libpng-devel
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: lld
BuildRequires: llvm >= 16
BuildRequires: llvm-devel >= 16
BuildRequires: ninja
%if %{with python}
BuildRequires: python3-devel
BuildRequires: python3-imageio
BuildRequires: python3-numpy
BuildRequires: python3-pybind11-devel
%endif
BuildRequires: openblas-devel
%if %{with vulkan}
BuildRequires: pkgconfig(vulkan)
%endif
BuildRequires: pkgconfig(zlib)
%description
Halide is a domain-specific programming language for writing image and
array processing code, targeting the GPU compute APIs of CUDA, OpenCL
and Vulkan.
%package -n python3-halide
Summary: Python binding for Halide
Group: Development/Languages/Python
%description -n python3-halide
This package contains the Python bindings for Halide.
%package -n libHalide%{HALIDE_VERSION}
Summary: A language for portable data-parallel computation
Group: System/Libraries
Requires: llvm
%description -n libHalide%{HALIDE_VERSION}
Halide is a programming language designed for writing image and array
processing code, targeting the GPU compute APIs of CUDA, OpenCL and
Vulkan.
%package devel
Summary: Header files for Halide
Group: Development/Libraries/C and C++
Requires: libHalide%{HALIDE_VERSION} = %{version}
Requires: libpng-devel
Requires: pkgconfig(libjpeg)
%description devel
Halide is a domain-specific programming language for writing image and
array processing code, targeting the GPU compute APIs of CUDA, OpenCL
and Vulkan.
Halide reuses C++. This means you write C++ code that builds
an in-memory representation of a Halide pipeline using Halide's
C++ API. You can then compile this representation to an object
file, or JIT-compile it and run it in the same process. Halide
also provides a Python binding that provides support for
writing Halide embedded in Python without C++.
Halide requires C++17 (or later) to use.
This package contains the headers needed to develop against Halide.
# https://youtu.be/1ir_nEfKQ7A?t=1238
%package doc
Summary: Documentation for Halide
Group: Documentation/HTML
BuildArch: noarch
%description doc
This package contains documentation for the Halide.
%prep
%autosetup -p1 -n Halide-%{version}
%build
export CC=clang
export CXX=clang++
%if %{with lld}
export LDFLAGS="$LDFLAGS -fuse-ld=lld"
%endif
%cmake \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DHalide_ENABLE_RTTI=ON \
-DHalide_ENABLE_EXCEPTIONS=ON \
%if %{with python}
-DWITH_PYTHON_BINDINGS=ON \
%if %{without tests}
-DWITH_TEST_PYTHON=OFF \
%endif
%else
-DWITH_PYTHON_BINDINGS=OFF \
%endif
%if %{without serialization}
-DWITH_SERIALIZATION=OFF \
%endif
-DFLATBUFFERS_USE_FETCHCONTENT=OFF \
-DPYBIND11_USE_FETCHCONTENT=OFF \
-DHalide_SHARED_LLVM=ON \
-DTARGET_WEBASSEMBLY=OFF \
%if %{without tests}
-DWITH_TESTS=OFF \
%endif
-DWITH_TEST_FUZZ=OFF \
-DWITH_DOCS=ON \
%if %{with vulkan}
-DTARGET_VULKAN=ON \
%endif
-DHalide_INSTALL_PLUGINDIR=%{_lib}/halide/ \
-DCMAKE_INSTALL_INCLUDEDIR=%{_includedir}/halide/ \
-DHalide_INSTALL_CMAKEDIR=%{_lib}/cmake/Halide/ \
-DHalide_INSTALL_HELPERSDIR=%{_lib}/cmake/HalideHelpers/ \
-DCMAKE_INSTALL_BINDIR=%{_lib}/halide/ \
-DHalide_INSTALL_TOOLSDIR=%{_usrsrc}/halide/ \
-DCMAKE_INSTALL_DOCDIR=%{_defaultdocdir}/halide/ \
-DHalide_INSTALL_PYTHONDIR=%{python3_sitearch}/halide/
%cmake_build
%install
%cmake_install
%fdupes %{buildroot}%{_prefix}
%ldconfig_scriptlets -n libHalide%{HALIDE_VERSION}
%check
%if %{with tests}
TEST_GROUPS_FLAKY="performance|auto_schedule"
%if %{without serialization}
TEST_GROUPS_FLAKY="${TEST_GROUPS_FLAKY}|tutorial_lesson_23_serialization"
%endif
# WARNING: running multiple halide tests in parallel is unsupported!
%ctest --parallel 1 --exclude-regex "${TEST_GROUPS_FLAKY}"
%ctest --parallel 1 --label-regex "${TEST_GROUPS_FLAKY}" || :
%endif
%files -n python3-halide
%{_libdir}/libHalidePyStubs.a
%{python3_sitearch}/halide/
%files -n libHalide%{HALIDE_VERSION}
%{_libdir}/libHalide.so.*
%files devel
%{_libdir}/libHalide.so
%{_libdir}/halide/
%{_includedir}/halide/
%{_libdir}/cmake/Halide/
%{_libdir}/cmake/HalideHelpers/
%{_usrsrc}/halide/
%files doc
%{_defaultdocdir}/halide/
%license LICENSE.txt
%changelog