%global pkgvers 0 %global scdate0 20241213 %global sctags0 v20.0.0.dev0 %global source0 https://github.com/halide/Halide.git Name: halide Version: 20.0.0 Release: %{scdate0}.%{pkgvers}%{?dist} Summary: A language for image processing and computational photography License: MIT URL: https://halide-lang.org Patch0: halide-sover.patch Patch1: halide-gcc11.patch BuildRequires: git cmake doxygen python3-devel pybind11-devel libffi-devel ncurses-devel BuildRequires: llvm-devel lld-devel clang-devel libglvnd-devel zlib-devel libpng-devel BuildRequires: eigen3-devel openblas-devel openblas-openmp libjpeg-turbo-devel libffi-devel %if 0%{?rhel} %ifarch ppc64le BuildRequires: git %endif %endif %ifarch ppc64le %global toolchain clang %else %global toolchain gcc %endif %if "%{toolchain}" == "gcc" BuildRequires: gcc-c++ %else BuildRequires: clang %endif %global __cmake_in_source_build 1 %description Halide is a programming language designed to make it easier to write high-performance image processing code on modern machines. Halide currently targets X86, ARM, CUDA, OpenCL, and OpenGL on OS X, Linux, and Windows. %package devel Summary: Development files for Halide Requires: %{name} = %{version}-%{release} Requires: %{name}-python3 = %{version}-%{release} %description devel This package contains development files for Halide. %package python3 Summary: Python bindings for Halide Requires: %{name} = %{version}-%{release} %description python3 This package contains python bindings for Halide. %prep %setup -T -c -n %{name} git clone --depth 1 -n -b %{sctags0} %{source0} . git reset --hard %{sctags0} git log --format=fuller # fixes find . -regex '.*\.\(cmake\|txt\|py\)' -exec sed -i -e 's|VERSION 3.22|VERSION 3.20|' {} + sed -i -e '/set(dummy_file/,/Copy/d' python_bindings/src/halide/CMakeLists.txt sed -i -e 's|-Wcast-qual|-Wcast-qual -fPIC|g' CMakeLists.txt sed -i -e 's|-Wcast-qual|-Wcast-qual -fPIC|g' src/CMakeLists.txt sed -i -e 's|--system-libs --link-static|--libs|' CMakeLists.txt sed -i -e 's|-Wall -Werror||g' src/CMakeLists.txt sed -i -e 's|CLANG)|CLANG_DUMMY)|' CMakeLists.txt sed -i -e 's|PUBLIC Halide::LanguageOptions|PUBLIC Halide::LanguageOptions LLVM|' src/CMakeLists.txt sed -i -e 's|llvm_map_components_to_libnames|#llvm_map_components_to_libnames|' dependencies/llvm/CMakeLists.txt sed -i -e 's|FATAL_ERROR "LLVM version must|WARNING "LLVM version must|g' dependencies/llvm/CMakeLists.txt sed -i -e 's|Eigen3::Eigen||g' apps/linear_algebra/benchmarks/CMakeLists.txt sed -i -e 's|Halide_PyStubs STATIC|Halide_PyStubs SHARED|' python_bindings/stub/CMakeLists.txt sed -i -e 's|FATAL_ERROR "Halide requires Python|WARNING "Halide requires Python|g' python_bindings/CMakeLists.txt echo "" >> util/CMakeLists.txt echo "target_link_libraries(HalideTraceViz PRIVATE LLVM)" >> util/CMakeLists.txt echo "target_link_libraries(HalideTraceDump PRIVATE LLVM)" >> util/CMakeLists.txt echo "" >> apps/interpolate/CMakeLists.txt echo "target_link_libraries(interpolate PRIVATE LLVM)" >> apps/interpolate/CMakeLists.txt %ifarch ppc64le sed -i 's|internal_error << "Warning: module|user_warning << "Warning: module|' src/LLVM_Output.cpp %endif # pybind11 pinned version sed -i -e 's|${PYBIND11_VER} REQUIRED||' python_bindings/CMakeLists.txt %build mkdir build pushd build %global optflags %(echo "%{optflags} -I/usr/include/eigen3 -fPIC") export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{_builddir}/halide/build/src/ %cmake .. \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DPython3_EXECUTABLE=%{python3} \ -DWARNINGS_AS_ERRORS=OFF \ -DCMAKE_LD_FLAGS="-fPIC -lopenblaso -lLLVM" \ -DHalide_SHARED_LLVM=ON \ -DWITH_WABT=OFF \ -DWITH_WASM_SHELL=OFF \ -DTARGET_WEBASSEMBLY=OFF \ -DWITH_PYTHON_BINDINGS=ON \ -DPYBIND11_USE_FETCHCONTENT=OFF \ -DWITH_DOCS=ON \ -DWITH_TESTS=OFF \ -DWITH_TUTORIALS=OFF \ -DWITH_UTILS=ON make %{?_smp_mflags} popd %install pushd build export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{_builddir}/halide/build/src/ make install DESTDIR=%{buildroot} popd # python mkdir -p %{buildroot}/%{python3_sitearch}/%{name} install -D -pm 755 $f build/python_bindings/src/%{name}/RelWithDebInfo/%{name}/*.so \ %{buildroot}/%{python3_sitearch}/%{name}/ sed -i 's|${_IMPORT_PREFIX}/lib64/python.*/site-packages|%{python3_sitearch}|g' \ %{buildroot}/%{_libdir}/cmake/Halide/*.cmake # fix paths echo "set(Halide_LIBRARIES \"Halide\")" >> %{buildroot}%{_libdir}/cmake/Halide/HalideConfig.cmake echo "set(Halide_INCLUDE_DIRS \"/usr/include\")" >> %{buildroot}%{_libdir}/cmake/Halide/HalideConfig.cmake # clean junks rm -rf %{buildroot}%{_datadir}/* rm -rf %{buildroot}%{_libdir}/*.a # relocate path rm -rf %{buildroot}/%{_libdir}/python3 %ldconfig_scriptlets %files %defattr(-,root,root,-) %doc LICENSE.txt %doc tutorial %doc build/doc %{_bindir}/* %{_libdir}/*.so.* %files devel %{_includedir}/* %{_libdir}/*.so %{_libdir}/cmake/* %files python3 %{python3_sitearch}/* %changelog * Sun Mar 19 2017 Balint Cristian - github upstream releases