5 Star 0 Fork 9

OpenCloudOS Stream/opencv

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
opencv.spec 12.22 KB
一键复制 编辑 原始数据 按行查看 历史
dpd 提交于 2024-07-25 17:03 . add loongarch64 to ExcludeArch
%undefine __cmake_in_source_build
%bcond_without tests
%bcond_without extras_tests
%bcond_with vtk
%bcond_with gdcm
%bcond_without gstreamer
%bcond_without ffmpeg
%ifarch x86_64
%bcond_without libmfx
%bcond_without va
%else
%bcond_with libmfx
%endif
%ifarch %{java_arches}
%bcond_without java
%else
%bcond_with java
%endif
%define _lto_cflags %{nil}
%global javaver %%(foo=%{version}; echo ${foo//./})
%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})
Summary: Collection of algorithms for computer vision
Name: opencv
Version: 4.8.1
Release: 5%{?dist}
License: BSD
URL: https://opencv.org
Source0: https://github.com/opencv/opencv/archive/%{version}/opencv-%{version}.tar.gz
Source1: https://github.com/opencv/opencv_contrib/archive/%{version}/opencv_contrib-%{version}.tar.gz
Source2: https://github.com/opencv/opencv_extra/archive/%{version}/opencv_extra-%{version}.tar.gz
# https://github.com/opencv/ade/archive/v0.1.2a.zip
# mv v0.1.2a.zip {md5sum of zip}-v0.1.2a.zip
# md5sum is required for ade cache.
Source3: fa4b3e25167319cb0fa9432ef8281945-v0.1.2a.zip
Source4: xorg.conf
Patch3000: opencv-4.1.0-install_3rdparty_licenses.patch
Patch3001: opencv.python.patch
Patch5000: support-protobuf-24.2.patch
BuildRequires: openblas-devel blas-devel lapack-devel vulkan-headers
BuildRequires: freetype-devel harfbuzz-devel
BuildRequires: gflags-devel qt5-qtbase-devel libGL-devel libGLU-devel hdf5-devel openjpeg2-devel
BuildRequires: libwebp-devel tesseract-devel protobuf-devel gdal-devel glog-devel python3-beautifulsoup4
BuildRequires: opencl-headers libgphoto2-devel
BuildRequires: python3-devel python3-numpy swig >= 1.3.24
BuildRequires: libGL-devel libv4l-devel OpenEXR-devel tbb-devel zlib-devel pkgconfig
BuildRequires: libtheora-devel libvorbis-devel jasper-devel libjpeg-devel libpng-devel libtiff-devel
BuildRequires: gcc-c++ cmake >= 2.6.3 chrpath eigen3-devel
%if %{with ffmpeg}
BuildRequires: ffmpeg-devel >= 0.4.9
%endif
%if %{with gstreamer}
BuildRequires: gstreamer1-devel gstreamer1-plugins-base-devel
%endif
%if %{with vtk}
BuildRequires: vtk-devel
%if %{with java}
BuildRequires: vtk-java
%endif
%endif
%if %{with java}
BuildRequires: ant
BuildRequires: java-devel
%endif
%if %{with gdcm}
BuildRequires: gdcm-devel
%endif
%if %{with tests}
BuildRequires: xorg-x11-drv-dummy
BuildRequires: mesa-dri-drivers
%endif
%if %{with va}
BuildRequires: libva-devel
%endif
Requires: opencv-core = %{version}-%{release}
ExcludeArch: loongarch64
%description
OpenCV (Open Source Computer Vision Library) is an open source computer vision and
machine learning software library. OpenCV was built to provide a common infrastructure
for computer vision applications and to accelerate the use of machine perception in the
commercial products. Being an Apache 2 licensed product, OpenCV makes it easy for
businesses to utilize and modify the code.
%package core
Summary: OpenCV core libraries
Provides: bundled(quirc) = 1.0
%description core
This package provides the OpenCV C/C++ core libraries.
%package devel
Summary: Development files for using the OpenCV library
Requires: %{name} = %{version}-%{release}
Requires: %{name}-contrib = %{version}-%{release}
%description devel
This package provides the OpenCV C/C++ library, header files and documentations.
%package -n python3-opencv
Summary: Python3 bindings for apps which use OpenCV
Requires: opencv = %{version}-%{release}
Requires: python3-numpy
%description -n python3-opencv
This package provides Python3 bindings for the OpenCV library.
%if %{with java}
%package java
Summary: Java bindings for apps which use OpenCV
Requires: java-headless
Requires: javapackages-filesystem
Requires: %{name}-core = %{version}-%{release}
%description java
This package provides Java bindings for the OpenCV library.
%endif
%package contrib
Summary: OpenCV contributed functionality
%description contrib
This package provides so-called "extra" modules, contributed functionality.
New modules quite often do not have stable API, and they are not well-tested.
%prep
%setup -q -a1 %{?with_extras_tests:-a2}
find ./ -iname "*lena*" | xargs rm -f
find ./ -iname "*lenna*" | xargs rm -f
find ./ -name "xfeatures2d" | xargs rm -rf
pushd 3rdparty
shopt -s extglob
rm -r !(openvx|quirc|flatbuffers)
shopt -u extglob
popd &>/dev/null
%autopatch -p1
mkdir -p .cache/ade
install -pm 0644 %{SOURCE3} .cache/ade/
%build
%cmake \
-DCMAKE_CXX_STANDARD=17 \
-DCV_TRACE=OFF \
-DWITH_IPP=OFF \
-DWITH_ITT=OFF \
-DWITH_QT=ON \
-DWITH_OPENGL=ON \
%if %{without tests}
-DBUILD_TESTS=OFF \
%endif
-DOpenGL_GL_PREFERENCE=GLVND \
-DWITH_GDAL=ON \
-DWITH_OPENEXR=ON \
-DCMAKE_SKIP_RPATH=ON \
-DWITH_CAROTENE=OFF \
%ifarch x86_64
-DCPU_BASELINE=SSE2 \
%endif
-DCMAKE_BUILD_TYPE=ReleaseWithDebInfo \
%{?with_java: -DBUILD_opencv_java=ON \
-DOPENCV_JAR_INSTALL_PATH=%{_jnidir} } \
%{!?with_java: -DBUILD_opencv_java=OFF } \
-DWITH_TBB=ON \
-DWITH_OPENNI=ON \
-DWITH_XINE=OFF \
-DBUILD_DOCS=ON \
-DBUILD_EXAMPLES=ON \
%{!?with_ffmpeg: -DWITH_FFMPEG=OFF } \
%{!?with_gstreamer: -DWITH_GSTREAMER=OFF } \
-DBUILD_opencv_python2=OFF \
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
-DPYTHON3_EXECUTABLE=%{__python3} \
-DPYTHON3_PACKAGES_PATH=%{python3_sitearch} \
-DOPENCV_GENERATE_SETUPVARS=OFF \
-DENABLE_PYLINT=OFF \
-DENABLE_FLAKE8=OFF \
-DBUILD_PROTOBUF=OFF \
-DPROTOBUF_UPDATE_FILES=ON \
-DOPENCL_INCLUDE_DIR=%{_includedir}/CL \
-DOPENCV_EXTRA_MODULES_PATH=opencv_contrib-%{version}/modules \
-DWITH_LIBV4L=ON \
-DWITH_OPENMP=ON \
-DOPENCV_CONFIG_INSTALL_PATH=%{_lib}/cmake/OpenCV \
-DOPENCV_GENERATE_PKGCONFIG=ON \
%{?with_va: -DWITH_VA=ON } \
%{?with_extras_tests: -DOPENCV_TEST_DATA_PATH=opencv_extra-%{version}/testdata} \
%{?with_gdcm: -DWITH_GDCM=ON } \
%{?with_libmfx: -DWITH_MFX=ON } \
%{!?with_vtk: -DWITH_VTK=OFF} \
-DWITH_VULKAN=ON -DVULKAN_INCLUDE_DIRS=%{_includedir}/vulkan
%cmake_build
%install
%cmake_install
rm -rf %{buildroot}%{_datadir}/OpenCV/licenses/
%if %{with java}
ln -s -r %{buildroot}%{_jnidir}/libopencv_java%{javaver}.so %{buildroot}%{_jnidir}/libopencv_java.so
ln -s -r %{buildroot}%{_jnidir}/opencv-%{javaver}.jar %{buildroot}%{_jnidir}/opencv.jar
%endif
ln -s opencv4.pc %{buildroot}%{_libdir}/pkgconfig/opencv.pc
%check
%if %{with tests}
cp %SOURCE4 %{__cmake_builddir}
if [ -x /usr/libexec/Xorg ]; then
Xorg=/usr/libexec/Xorg
else
Xorg=/usr/libexec/Xorg.bin
fi
$Xorg -noreset +extension GLX +extension RANDR +extension RENDER -logfile ./xorg.log -config ./xorg.conf -configdir . :99 &
export DISPLAY=:99
export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/%{__cmake_builddir}/lib:$LD_LIBARY_PATH
%ctest || :
%endif
%files
%doc README.md
%{_bindir}/opencv_*
%dir %{_datadir}/opencv4
%{_datadir}/opencv4/haarcascades
%{_datadir}/opencv4/lbpcascades
%{_datadir}/opencv4/valgrind*
%{_datadir}/opencv4/quality
%files core
%license LICENSE
%{_datadir}/licenses/opencv4/
%{_libdir}/libopencv_calib3d.so.{%{abiver},%{version}}
%{_libdir}/libopencv_core.so.{%{abiver},%{version}}
%{_libdir}/libopencv_dnn.so.{%{abiver},%{version}}
%{_libdir}/libopencv_features2d.so.{%{abiver},%{version}}
%{_libdir}/libopencv_flann.so.{%{abiver},%{version}}
%{_libdir}/libopencv_gapi.so.{%{abiver},%{version}}
%{_libdir}/libopencv_highgui.so.{%{abiver},%{version}}
%{_libdir}/libopencv_imgcodecs.so.{%{abiver},%{version}}
%{_libdir}/libopencv_imgproc.so.{%{abiver},%{version}}
%{_libdir}/libopencv_ml.so.{%{abiver},%{version}}
%{_libdir}/libopencv_objdetect.so.{%{abiver},%{version}}
%{_libdir}/libopencv_photo.so.{%{abiver},%{version}}
%{_libdir}/libopencv_stitching.so.{%{abiver},%{version}}
%{_libdir}/libopencv_video.so.{%{abiver},%{version}}
%{_libdir}/libopencv_videoio.so.{%{abiver},%{version}}
%files devel
%dir %{_includedir}/opencv4
%{_includedir}/opencv4/opencv2
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/opencv.pc
%{_libdir}/pkgconfig/opencv4.pc
%{_libdir}/cmake/OpenCV/*.cmake
%{_datadir}/opencv4/samples
%files -n python3-opencv
%{python3_sitearch}/cv2
%if %{with java}
%files java
%{_jnidir}/libopencv_java%{javaver}.so
%{_jnidir}/opencv-%{javaver}.jar
%{_jnidir}/libopencv_java.so
%{_jnidir}/opencv.jar
%endif
%files contrib
%{_libdir}/libopencv_alphamat.so.{%{abiver},%{version}}
%{_libdir}/libopencv_aruco.so.{%{abiver},%{version}}
%{_libdir}/libopencv_bgsegm.so.{%{abiver},%{version}}
%{_libdir}/libopencv_bioinspired.so.{%{abiver},%{version}}
%{_libdir}/libopencv_ccalib.so.{%{abiver},%{version}}
%{_libdir}/libopencv_cvv.so.{%{abiver},%{version}}
%{_libdir}/libopencv_datasets.so.{%{abiver},%{version}}
%{_libdir}/libopencv_dnn_objdetect.so.{%{abiver},%{version}}
%{_libdir}/libopencv_dnn_superres.so.{%{abiver},%{version}}
%{_libdir}/libopencv_dpm.so.{%{abiver},%{version}}
%{_libdir}/libopencv_face.so.{%{abiver},%{version}}
%{_libdir}/libopencv_freetype.so.{%{abiver},%{version}}
%{_libdir}/libopencv_fuzzy.so.{%{abiver},%{version}}
%{_libdir}/libopencv_hdf.so.{%{abiver},%{version}}
%{_libdir}/libopencv_hfs.so.{%{abiver},%{version}}
%{_libdir}/libopencv_img_hash.so.{%{abiver},%{version}}
%{_libdir}/libopencv_intensity_transform.so.{%{abiver},%{version}}
%{_libdir}/libopencv_line_descriptor.so.{%{abiver},%{version}}
%{_libdir}/libopencv_mcc.so.{%{abiver},%{version}}
%{_libdir}/libopencv_optflow.so.{%{abiver},%{version}}
%{_libdir}/libopencv_phase_unwrapping.so.{%{abiver},%{version}}
%{_libdir}/libopencv_plot.so.{%{abiver},%{version}}
%{_libdir}/libopencv_quality.so.{%{abiver},%{version}}
%{_libdir}/libopencv_rapid.so.{%{abiver},%{version}}
%{_libdir}/libopencv_reg.so.{%{abiver},%{version}}
%{_libdir}/libopencv_rgbd.so.{%{abiver},%{version}}
%{_libdir}/libopencv_saliency.so.{%{abiver},%{version}}
%{_libdir}/libopencv_shape.so.{%{abiver},%{version}}
%{_libdir}/libopencv_stereo.so.{%{abiver},%{version}}
%{_libdir}/libopencv_structured_light.so.{%{abiver},%{version}}
%{_libdir}/libopencv_superres.so.{%{abiver},%{version}}
%{_libdir}/libopencv_surface_matching.so.{%{abiver},%{version}}
%{_libdir}/libopencv_text.so.{%{abiver},%{version}}
%{_libdir}/libopencv_tracking.so.{%{abiver},%{version}}
%{_libdir}/libopencv_videostab.so.{%{abiver},%{version}}
%if %{with vtk}
%{_libdir}/libopencv_viz.so.{%{abiver},%{version}}
%endif
%{_libdir}/libopencv_wechat_qrcode.so.{%{abiver},%{version}}
%{_libdir}/libopencv_ximgproc.so.{%{abiver},%{version}}
%{_libdir}/libopencv_xobjdetect.so.{%{abiver},%{version}}
%{_libdir}/libopencv_xphoto.so.{%{abiver},%{version}}
%changelog
* Thu Jul 25 2024 Pengda Dou <doupengda@loongson.cn> - 4.8.1-5
- [Type] other
- [DESC] add loongarch64 to ExcludeArch
* Mon May 20 2024 Rebuild Robot <rebot@opencloudos.org> - 4.8.1-4
- [Type] other
- [DESC] Rebuilt for hdf5
* Sat May 11 2024 Rebuild Robot <rebot@opencloudos.org> - 4.8.1-3
- [Type] other
- [DESC] Rebuilt for ffmpeg
* Tue Dec 12 2023 cunshunxia@tencent.com - 4.8.1-2
- Rebuilt for ffmpeg 6.1
* Fri Nov 10 2023 Jack Minjie HUANG <jackmjhuang@tencent.com> - 4.8.1-1
- Upgrade to 4.8.1
* Tue Sep 19 2023 Miaojun Dong <zoedong@tencent.com> - 4.7.0-11
- Rebuilt for protobuf 24.2
* Tue Sep 19 2023 OpenCloudOS Release Engineering <releng@opencloudos.tech> - 4.7.0-10
- Rebuilt for python 3.11
* Fri Sep 08 2023 OpenCloudOS Release Engineering <releng@opencloudos.tech> - 4.7.0-9
- Rebuilt for OpenCloudOS Stream 23.09
* Wed Aug 23 2023 kianli <kianli@tencent.com> - 4.7.0-8
- Rebuilt for v4l-utils 1.24.1
* Tue Aug 22 2023 Wang Guodong <gordonwwang@tencent.com> - 4.7.0-7
- Rebuilt for libva 2.19.0
* Fri Aug 18 2023 cunshunxia <cunshunxia@tencent.com> - 4.7.0-6
- Rebuilt for jasper-libs 4.0.0
* Thu Aug 17 2023 kianli@tencent.com - 4.7.0-5
- Rebuilt for openjpeg2 2.5.0
* Wed Aug 02 2023 kianli <kianli@tencent.com> - 4.7.0-4
- Rebuilt for libtiff 4.5.1
* Mon Jul 17 2023 Xiaojie Chen <jackxjchen@tencent.com> - 4.7.0-3
- Rebuilt for gstreamer1-plugins-base 1.22.4
* Tue May 09 2023 cunshunxia <cunshunxia@tencent.com> - 4.7.0-2
- remove unnessary modules.
* Fri Apr 28 2023 cunshunxia <cunshunxia@tencent.com> - 4.7.0-1
- initial build
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/opencloudos-stream/opencv.git
git@gitee.com:opencloudos-stream/opencv.git
opencloudos-stream
opencv
opencv
master

搜索帮助

Cb406eda 1850385 E526c682 1850385