--- /dev/null
+diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake
+index 4ff02a77d3..c27fe7d316 100644
+--- a/cmake/OpenCVDetectPython.cmake
++++ b/cmake/OpenCVDetectPython.cmake
+@@ -186,7 +186,11 @@ if(NOT ${found})
+ else() #debian based assumed, install to the dist-packages.
+ set(_packages_path "python${_version_major_minor}/dist-packages")
+ endif()
+- set(_packages_path "lib/${_packages_path}")
++ if(EXISTS /usr/lib64)
++ set(_packages_path "lib64/${_packages_path}")
++ else()
++ set(_packages_path "lib/${_packages_path}")
++ endif()
+ elseif(CMAKE_HOST_WIN32)
+ get_filename_component(_path "${_executable}" PATH)
+ file(TO_CMAKE_PATH "${_path}" _path)
Name: opencv
Summary: OpenCV library
Version: 4.5.0
-Release: 0
+Release: 1
Group: Development/Libraries
License: Apache-2.0 and BSD-3-Clause
Source0: %{name}-%{version}.tar.gz
Source100: opencv-contrib-4.5.0.tar.gz
+# In cmake/OpenCVDetectPython.cmake, python packages are installed
+# in lib/ regardless of i586, armv7l, x86_64, aarch64
+# So, this patch installs the python packages in:
+# lib64/ if x86_64 or aarch64
+# lib/ if i586 or armv7l
+Source1001: 1001-TIZEN-OPENCV-PYTHON3-LIB64-PATH.patch
BuildRequires: cmake
BuildRequires: pkg-config
BuildRequires: libavcodec-devel
BuildRequires: libavformat-devel
BuildRequires: libswscale-devel
-
+#support python3
+BuildRequires: python3-devel
+BuildRequires: python3-numpy-devel
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
%description devel
The Open Computer Vision Library (Dev) includes various algorithms for computer vision problems.
+%package -n python3-opencv
+Summary: OpenCV Python3 Library
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description -n python3-opencv
+The Open Computer Vision Library (Python3) includes various algorithms for computre vision problems.
+
%prep
%setup -q
%setup -q -T -D -a 100
+cp %{SOURCE1001} .
+patch -p1 < %{SOURCE1001}
+
%build
%ifarch aarch64
ARCH=aarch64
-DBUILD_opencv_objdetect=ON \
-DBUILD_opencv_photo=ON \
-DBUILD_opencv_python2=OFF \
- -DBUILD_opencv_python3=OFF \
+ -DBUILD_opencv_python3=ON \
-DBUILD_opencv_shape=OFF \
-DBUILD_opencv_stitching=OFF \
-DBUILD_opencv_superres=OFF \
-DBUILD_opencv_videoio=ON \
-DBUILD_opencv_videostab=OFF \
-DBUILD_opencv_world=OFF \
- -DBUILD_opencv_python=OFF \
-DBUILD_opencv_viz=OFF \
-DOPENCV_EXTRA_MODULES_PATH=../opencv-contrib/modules \
-DBUILD_opencv_aruco=OFF \
%exclude /usr/share/opencv4/lbpcascades/*silverware*
%exclude /usr/share/opencv4/*.supp
+%files -n python3-opencv
+%{python3_sitearch}/cv2/*.py
+%{python3_sitearch}/cv2/*/*.so
+
%files devel
/usr/include/*
%{_libdir}/pkgconfig/*.pc