From 89ab44820f42f473a3c4c44d32607eb4586c1ec4e7857814aa3614b16f7f943a Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Wed, 4 Dec 2024 12:40:59 +0100 Subject: [PATCH] Specfile modernization * pkgconfig(), %ldconfig, no %defattr, revise inconsistent groups * use SRPM base name for subpackages (libhalide18-devel > halide-devel), can only have one devel installed at a time anyway due to libHalide.so * compact filelists (`%dir a`,`a/*` is the same as `a/`) --- halide.spec | 138 +++++++++++++++++++++++++--------------------------- 1 file changed, 66 insertions(+), 72 deletions(-) diff --git a/halide.spec b/halide.spec index ed5bc41..69e3c45 100644 --- a/halide.spec +++ b/halide.spec @@ -1,7 +1,7 @@ # # spec file for package halide # -# Copyright (c) 2021 SUSE LINUX Products GmbH, Nuernberg, Germany. +# 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 @@ -27,29 +27,29 @@ %global __builder ninja -Name: halide%{HALIDE_VERSION} +Name: halide Version: 18.0.0 Release: 0 License: MIT -Group: Libraries -Summary: a language for fast, portable data-parallel computation +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: Mesa-libGL-devel +BuildRequires: pkgconfig(gl) BuildRequires: clang-devel BuildRequires: cmake BuildRequires: doxygen -BuildRequires: eigen3-devel +BuildRequires: pkgconfig(eigen3) BuildRequires: fdupes %if %{with serialization} BuildRequires: flatbuffers-devel %endif -BuildRequires: libjpeg-devel +BuildRequires: pkgconfig(libjpeg) BuildRequires: libomp-devel BuildRequires: libpng-devel -BuildRequires: libxml2-devel +BuildRequires: pkgconfig(libxml-2.0) BuildRequires: lld BuildRequires: llvm >= 16 BuildRequires: llvm-devel >= 16 @@ -62,57 +62,63 @@ BuildRequires: python3-pybind11-devel %endif BuildRequires: openblas-devel %if %{with vulkan} -BuildRequires: vulkan-devel +BuildRequires: pkgconfig(vulkan) %endif -BuildRequires: zlib-devel +BuildRequires: pkgconfig(zlib) %description -Halide is a programming language designed to make it easier -to write high-performance image and array processing code -on modern machines. Halide currently targets: -* CPU architectures: X86, ARM, Hexagon, PowerPC, RISC-V -* Operating systems: Linux, Windows, macOS, Android, iOS, Qualcomm QuRT -* GPU Compute APIs: CUDA, OpenCL, Apple Metal, Microsoft Direct X 12, Vulkan +Halide is a domain-specific programming language for writing image and +array processing code, targeting the GPU compute APIs of CUDA, OpenCL +and Vulkan. -Rather than being a standalone programming language, Halide -is embedded in C++. This means you write C++ code that builds +%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 full support for +also provides a Python binding that provides support for writing Halide embedded in Python without C++. Halide requires C++17 (or later) to use. -%package -n python3-halide -Summary: Python binding for Halide -Group: System/Libraries - -%description -n python3-halide -This package contains the python bindings for Halide. - -%package -n libhalide%{HALIDE_VERSION} -Summary: Libraries for Halide -Group: System/Libraries -Requires: llvm - -%description -n libhalide%{HALIDE_VERSION} -This package contains the shared libraries needed for Halide. - -%package -n libhalide%{HALIDE_VERSION}-devel -Summary: Header Files for Halide -Group: Devel/System/Libraries -Requires: libhalide%{HALIDE_VERSION} = %{version} - -%description -n libhalide%{HALIDE_VERSION}-devel This package contains the headers needed to develop against Halide. -%package -n libhalide%{HALIDE_VERSION}-doc +# https://youtu.be/1ir_nEfKQ7A?t=1238 + +%package doc Summary: Documentation for Halide Group: Documentation/HTML BuildArch: noarch -%description -n libhalide%{HALIDE_VERSION}-doc +%description doc This package contains documentation for the Halide. %prep @@ -154,13 +160,13 @@ export LDFLAGS="$LDFLAGS -fuse-ld=lld" %if %{with vulkan} -DTARGET_VULKAN=ON \ %endif - -DHalide_INSTALL_PLUGINDIR=%{_lib}/halide%{HALIDE_VERSION}/ \ - -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir}/halide%{HALIDE_VERSION}/ \ - -DHalide_INSTALL_CMAKEDIR=%{_lib}/cmake/Halide%{HALIDE_VERSION}/ \ - -DHalide_INSTALL_HELPERSDIR=%{_lib}/cmake/HalideHelpers%{HALIDE_VERSION}/ \ - -DCMAKE_INSTALL_BINDIR=%{_lib}/halide%{HALIDE_VERSION}/ \ - -DHalide_INSTALL_TOOLSDIR=%{_usrsrc}/halide%{HALIDE_VERSION}/ \ - -DCMAKE_INSTALL_DOCDIR=%{_defaultdocdir}/halide%{HALIDE_VERSION}/ \ + -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 @@ -169,10 +175,7 @@ export LDFLAGS="$LDFLAGS -fuse-ld=lld" %cmake_install %fdupes %{buildroot}%{_prefix} -%post -n libhalide%{HALIDE_VERSION} -p /sbin/ldconfig -%postun -n libhalide%{HALIDE_VERSION} -p /sbin/ldconfig -%post -n libhalide%{HALIDE_VERSION}-devel -p /sbin/ldconfig -%postun -n libhalide%{HALIDE_VERSION}-devel -p /sbin/ldconfig +%ldconfig_scriptlets -n libHalide%{HALIDE_VERSION} %check %if %{with tests} @@ -187,30 +190,21 @@ TEST_GROUPS_FLAKY="${TEST_GROUPS_FLAKY}|tutorial_lesson_23_serialization" %files -n python3-halide %{_libdir}/libHalidePyStubs.a -%dir %{python3_sitearch}/halide/ -%{python3_sitearch}/halide/* +%{python3_sitearch}/halide/ -%files -n libhalide%{HALIDE_VERSION} -%defattr(-,root,root,-) +%files -n libHalide%{HALIDE_VERSION} %{_libdir}/libHalide.so.* -%files -n libhalide%{HALIDE_VERSION}-devel +%files devel %{_libdir}/libHalide.so -%dir %{_libdir}/halide%{HALIDE_VERSION} -%{_libdir}/halide%{HALIDE_VERSION}/* -%dir %{_includedir}/halide%{HALIDE_VERSION} -%{_includedir}/halide%{HALIDE_VERSION}/* -%dir %{_libdir}/cmake/Halide%{HALIDE_VERSION} -%{_libdir}/cmake/Halide%{HALIDE_VERSION}/* -%dir %{_libdir}/cmake/HalideHelpers%{HALIDE_VERSION} -%{_libdir}/cmake/HalideHelpers%{HALIDE_VERSION}/* -%dir %{_usrsrc}/halide%{HALIDE_VERSION} -%{_usrsrc}/halide%{HALIDE_VERSION}/* +%{_libdir}/halide/ +%{_includedir}/halide/ +%{_libdir}/cmake/Halide/ +%{_libdir}/cmake/HalideHelpers/ +%{_usrsrc}/halide/ -%files -n libhalide%{HALIDE_VERSION}-doc -%dir %{_defaultdocdir}/halide%{HALIDE_VERSION} -%docdir %{_defaultdocdir}/halide%{HALIDE_VERSION} -%{_defaultdocdir}/halide%{HALIDE_VERSION}/* +%files doc +%{_defaultdocdir}/halide/ %license LICENSE.txt %changelog