Name: opencv5 Version: 5.0.0 Release: 1%{?dist} Summary: Collection of algorithms for computer vision License: Apache-2.0 URL: https://opencv.org Source0: %{name}-%{version}.tar.gz # NOTE: these must come AFTER the Version: tag so the version is defined when # the shell snippets are evaluated. %global majorver %(foo=%{version}; a=(${foo//./ }); echo ${a[0]} ) %global minorver %(foo=%{version}; a=(${foo//./ }); echo ${a[1]} ) %global padding %(digits=00; num=%{minorver}; echo ${digits:${#num}:${#digits}} ) %global abiver %(echo %{majorver}%{padding}%{minorver} ) BuildRequires: gcc-c++ BuildRequires: cmake >= 3.10 BuildRequires: ninja-build BuildRequires: chrpath BuildRequires: zlib-ng-compat-devel BuildRequires: eigen3-devel BuildRequires: tbb-devel BuildRequires: flexiblas-devel BuildRequires: libjpeg-turbo-devel BuildRequires: libpng-devel BuildRequires: libtiff-devel BuildRequires: libwebp-devel BuildRequires: jasper-devel BuildRequires: openexr-devel BuildRequires: libavif-devel BuildRequires: openjpeg-devel BuildRequires: giflib-devel BuildRequires: libv4l-devel BuildRequires: libdc1394-devel BuildRequires: gstreamer1-devel BuildRequires: gstreamer1-plugins-base-devel BuildRequires: qt6-qtbase-devel BuildRequires: mesa-libGL-devel BuildRequires: mesa-libGLU-devel BuildRequires: opencl-headers BuildRequires: python3-devel BuildRequires: python3-numpy BuildRequires: pkgconfig Requires: opencv5-core%{_isa} = %{version}-%{release} Requires: opencv5-calib%{_isa} = %{version}-%{release} Requires: opencv5-dnn%{_isa} = %{version}-%{release} Requires: opencv5-features%{_isa} = %{version}-%{release} Requires: opencv5-flann%{_isa} = %{version}-%{release} Requires: opencv5-geometry%{_isa} = %{version}-%{release} Requires: opencv5-highgui%{_isa} = %{version}-%{release} Requires: opencv5-imgcodecs%{_isa} = %{version}-%{release} Requires: opencv5-imgproc%{_isa} = %{version}-%{release} Requires: opencv5-objdetect%{_isa} = %{version}-%{release} Requires: opencv5-photo%{_isa} = %{version}-%{release} Requires: opencv5-ptcloud%{_isa} = %{version}-%{release} Requires: opencv5-stereo%{_isa} = %{version}-%{release} Requires: opencv5-stitching%{_isa} = %{version}-%{release} Requires: opencv5-video%{_isa} = %{version}-%{release} Requires: opencv5-videoio%{_isa} = %{version}-%{release} %description OpenCV 5 means IntelĀ® Open Source Computer Vision Library. It is a collection of C functions and a few C++ classes that implement some popular Image Processing and Computer Vision algorithms. This is an independent packaging of OpenCV 5.x that installs into versioned paths (include/opencv5, lib64/cmake/opencv5, libopencv_*.so.5xx) so it can co-exist with the distribution OpenCV 4.x. %package core Summary: OpenCV 5 core libraries %description core This package contains the OpenCV 5 C/C++ core libraries. %global opencv5_devel_requires opencv5-core%{_isa} = %{version}-%{release} %define opencv5_module_subpkg(m:d:) \ %global opencv5_devel_requires %{opencv5_devel_requires} opencv5-%{-m*}%{_isa} = %{version}-%{release}\ %define modulename %{-m:%{-m*}}%{!-m:%{error:Module name not defined}}\ %define moduledesc %{-d:%{-d*}}%{!-d:%{-m*}}\ %package %{modulename}\ Summary: OpenCV 5 module: %{moduledesc}\ Requires: opencv5-core%{_isa} = %{version}-%{release}\ \ %description %{modulename}\ This package contains the OpenCV 5 %{moduledesc} module runtime.\ \ %files %{modulename}\ %{_libdir}/libopencv_%{modulename}.so.{%{abiver},%{version}} %opencv5_module_subpkg -m calib -d %{quote:Camera Calibration} %opencv5_module_subpkg -m dnn -d %{quote:Deep Neural Network} %opencv5_module_subpkg -m features -d %{quote:2D Feature Detection} %opencv5_module_subpkg -m flann -d %{quote:Clustering and Search in Multi-dimensional Space} %opencv5_module_subpkg -m geometry -d %{quote:3D Geometry} %opencv5_module_subpkg -m highgui -d %{quote:High-level GUI} %opencv5_module_subpkg -m imgcodecs -d %{quote:Image Encoding/Decoding} %opencv5_module_subpkg -m imgproc -d %{quote:Image Processing} %opencv5_module_subpkg -m objdetect -d %{quote:Object Detection} %opencv5_module_subpkg -m photo -d %{quote:Computational Photography} %opencv5_module_subpkg -m ptcloud -d %{quote:3D Point Cloud Processing} %opencv5_module_subpkg -m stereo -d %{quote:Stereo Correspondence} %opencv5_module_subpkg -m stitching -d %{quote:Images stitching} %opencv5_module_subpkg -m video -d %{quote:Video Analysis} %opencv5_module_subpkg -m videoio -d %{quote:Video I/O} %package devel Summary: Development files for using the OpenCV 5 library Requires: %{name}%{_isa} = %{version}-%{release} Requires: %{opencv5_devel_requires} Conflicts: opencv-devel < 5.0.0 %description devel This package contains the OpenCV 5 C/C++ library and header files. It should be installed if you want to develop programs that will use the OpenCV 5 library. %package -n python3-opencv5 Summary: Python3 bindings for OpenCV 5 Requires: opencv5-core%{_isa} = %{version}-%{release} Requires: python3-numpy Conflicts: python3-opencv < 5.0.0 %description -n python3-opencv5 This package contains Python3 bindings for the OpenCV 5 library. The module is imported as "cv2". It conflicts with the distribution python3-opencv package, so only one of the two can be installed at a time. %prep %setup -q -n opencv-%{version} %build # The default linker on this machine is mold, which does not understand the # Fedora hardened-ld flags; force the GNU bfd linker while keeping the # hardened flags (which bfd supports). export LDFLAGS="-fuse-ld=bfd -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1" # This mirrors the flags used by the Fedora opencv spec, trimmed down to the # dependencies that are available in the Fedora repositories. # Disabled (not in Fedora repos / not needed): FFmpeg, VTK, GDAL, CUDA, OpenNI %cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_SKIP_RPATH=ON \ -DCV_TRACE=OFF \ -DWITH_IPP=OFF \ -DWITH_ITT=OFF \ -DWITH_QT=ON \ -DWITH_OPENGL=ON \ -DOpenGL_GL_PREFERENCE=GLVND \ -DWITH_OPENCL=ON \ -DWITH_EIGEN=ON \ -DWITH_TBB=ON \ -DWITH_OPENMP=ON \ -DWITH_GSTREAMER=ON \ -DWITH_FFMPEG=OFF \ -DWITH_LIBV4L=ON \ -DWITH_1394=ON \ -DWITH_OPENEXR=ON \ -DWITH_IMGCODEC_GIF=ON \ -DBUILD_TESTS=OFF \ -DBUILD_PERF_TESTS=OFF \ -DBUILD_EXAMPLES=OFF \ -DBUILD_DOCS=OFF \ -DBUILD_opencv_apps=OFF \ -DBUILD_JAVA=OFF \ -DBUILD_opencv_java=OFF \ -DBUILD_opencv_js=OFF \ -DBUILD_opencv_world=OFF \ -DBUILD_opencv_python2=OFF \ -DBUILD_opencv_python3=ON \ -DPYTHON3_EXECUTABLE=%{__python3} \ -DOPENCV_GENERATE_PKGCONFIG=ON \ -DOPENCV_CONFIG_INSTALL_PATH=%{_lib}/cmake/opencv5 \ %ifarch x86_64 -DCPU_BASELINE=SSE2 \ %endif . %cmake_build %install %cmake_install %files %doc README.md %license LICENSE COPYRIGHT %{_bindir}/setup_vars_opencv5.sh %{_datadir}/%{name}/ %{_datadir}/licenses/%{name}/ %files core %license LICENSE %{_libdir}/libopencv_core.so.{%{abiver},%{version}} %files devel %dir %{_includedir}/%{name} %{_includedir}/%{name}/opencv2 %{_libdir}/lib*.so %{_libdir}/pkgconfig/%{name}.pc %{_libdir}/cmake/%{name}/* %files -n python3-opencv5 %{python3_sitelib}/cv2 %changelog * Fri Sep 18 2026 OpenCV 5 RPM builder - 5.0.0-1 - Initial build of OpenCV 5.0.0 for Fedora