opencv: rename package with python bindings. (#13034)

* opencv: rename package with python bindings.

Includes other minor cleanups.

This is "the other half" of #12949.

* opencv, build fix for cmake >= 4.0

* Update media-libs/opencv/opencv-4.8.0.recipe

Co-authored-by: OscarL <oscar.lesta@gmail.com>

---------

Co-authored-by: Luc Schrijvers <begasus@gmail.com>
This commit is contained in:
OscarL
2025-10-06 04:22:35 -03:00
committed by GitHub
parent 9ccf4c7425
commit 8c49d684f4
2 changed files with 55 additions and 18 deletions

View File

@@ -10,15 +10,16 @@ COPYRIGHT="2000-2020, Intel Corporation
2015-2016, Itseez Inc.
2019-2020, Xperience AI"
LICENSE="BSD (3-clause)"
REVISION="2"
REVISION="3"
SOURCE_URI="https://github.com/opencv/opencv/archive/$portVersion.tar.gz"
SOURCE_FILENAME="opencv-$portVersion.tar.gz"
CHECKSUM_SHA256="cbf47ecc336d2bff36b0dcd7d6c179a9bb59e805136af6b9670ca944aef889bd"
SOURCE_URI_2="https://github.com/opencv/opencv_contrib/archive/refs/tags/$portVersion.tar.gz"
SOURCE_FILENAME_2="opencv_contrib-$portVersion.tar.gz"
CHECKSUM_SHA256_2="b4aef0f25a22edcd7305df830fa926ca304ea9db65de6ccd02f6cfa5f3357dbb"
PATCHES="opencv-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2 ?x86"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
@@ -192,13 +193,29 @@ REQUIRES_devel="
opencv$secondaryArchSuffix == $portVersion base
"
PROVIDES_python="
opencv${secondaryArchSuffix}_python = $portVersionCompat
"
REQUIRES_python="
pythonVersion=3.10
pythonPackage=python${pythonVersion//.}
# Allows using dot in sub-package names (eg: "_python3.10" vs "_python310"):
eval "PACKAGE_NAME_$pythonPackage=\"${portName}_python$pythonVersion\""
eval "PROVIDES_$pythonPackage=\"
${portName}_python$pythonVersion = $portVersionCompat
\""
if [ -n "$secondaryArchSuffix" ]; then
eval "PROVIDES_${pythonPackage}+=\"
${portBaseName}_python$pythonVersion= $portVersionCompat
\""
fi
eval "REQUIRES_$pythonPackage=\"
haiku$secondaryArchSuffix
opencv$secondaryArchSuffix == $portVersion base
"
cmd:python$pythonVersion
\""
eval "REPLACES_$pythonPackage=\"${portName}_python\""
PROVIDES_tools="
opencv${secondaryArchSuffix}_tools = $portVersionCompat
@@ -213,8 +230,8 @@ PROVIDES_tools="
REQUIRES_tools="
haiku$secondaryArchSuffix
opencv$secondaryArchSuffix == $portVersion base
numpy${secondaryArchSuffix}_python310
cmd:python3
numpy_$pythonPackage
cmd:python$pythonVersion
"
BUILD_REQUIRES="
@@ -268,7 +285,7 @@ BUILD_PREREQUIRES="
# cmd:ant
cmd:cmake
cmd:doxygen
numpy${secondaryArchSuffix}_python310
numpy_$pythonPackage
cmd:gcc$secondaryArchSuffix
# cmd:javac
# cmd:jni
@@ -276,7 +293,7 @@ BUILD_PREREQUIRES="
cmd:make
# cmd:matlab # maybe later
cmd:pkg_config$secondaryArchSuffix
cmd:python3
cmd:python$pythonVersion
"
defineDebugInfoPackage opencv$secondaryArchSuffix \
@@ -345,10 +362,8 @@ BUILD()
ARCH_SUBDIR="$secondaryArchSuffix/"
fi
pythonVersion=$(python3 --version 2>&1 | sed 's/Python //' | head -c4)
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
$cmakeDirArgs \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
@@ -361,7 +376,6 @@ BUILD()
-DWITH_EIGEN=ON \
-DWITH_OPENEXR=ON \
-DWITH_FFMPEG=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=ON \
-DENABLE_PIC=OFF \
-DOPENCV_GENERATE_PKGCONFIG=YES \
@@ -370,9 +384,10 @@ BUILD()
-DOpenBLAS_INCLUDE_DIR="$portPackageLinksDir/openblas${secondaryArchSuffix}_devel/develop/headers/$ARCH_SUBDIR" \
-DOpenBLAS_LIB="$portPackageLinksDir/openblas${secondaryArchSuffix}_devel/develop/lib/$ARCH_SUBDIR" \
-DOPENCV_PYTHON3_INSTALL_PATH="$prefix/lib/python$pythonVersion/vendor-packages" \
-DPYTHON3_NUMPY_INCLUDE_DIRS:PATH="`finddir B_SYSTEM_LIB_DIRECTORY`/python${pythonVersion}/vendor-packages/numpy/core/include" \
-DPYTHON3_NUMPY_INCLUDE_DIRS:PATH="`finddir B_SYSTEM_LIB_DIRECTORY`/python$pythonVersion/vendor-packages/numpy/_core/include" \
-DOPENCV_EXTRA_MODULES_PATH="$sourceDir2/opencv_contrib-$portVersion/modules" \
-DEigen3_DIR=`finddir B_SYSTEM_DATA_DIRECTORY`/eigen3/cmake
-DEigen3_DIR=`finddir B_SYSTEM_DATA_DIRECTORY`/eigen3/cmake \
-Wno-dev
make $jobArgs
}
@@ -460,7 +475,7 @@ INSTALL()
$libDir/cmake
# python package
packageEntries python \
packageEntries $pythonPackage \
$prefix/lib/python*
# tools package

View File

@@ -0,0 +1,22 @@
From 4858c29c68060fce787dd7456eedf2303c0329a2 Mon Sep 17 00:00:00 2001
From: Luc Schrijvers <begasus@gmail.com>
Date: Mon, 6 Oct 2025 08:01:12 +0200
Subject: Build fix for cmake >= 4.0
diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake
index 8d36b74..2718b8b 100644
--- a/cmake/OpenCVGenPkgconfig.cmake
+++ b/cmake/OpenCVGenPkgconfig.cmake
@@ -110,7 +110,7 @@ endif()
# =============================================================================
else() # DEFINED CMAKE_HELPER_SCRIPT
-cmake_minimum_required(VERSION 2.8.12.2)
+cmake_minimum_required(VERSION 3.5)
cmake_policy(SET CMP0012 NEW)
include("${CMAKE_HELPER_SCRIPT}")
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVUtils.cmake")
--
2.50.1