# Description: Open Source Computer Vision Library # URL: https://opencv.org # Maintainer: CRUX KDE Ports, kde-ports at crux dot nu # Depends on: eigen ffmpeg flatbuffers jasper libgphoto2 libva libwebp mathjax openexr openjpeg2 protobuf python3-numpy # Optional: cuda gphoto2 gst-plugins-bad gtk3 onetbb qt6-5compat v4l-utils wayland name=opencv version=4.10.0 release=1 source=(https://github.com/$name/$name/archive/$version/$name-$version.tar.gz https://github.com/opencv/opencv_contrib/archive/$version/opencv_contrib-$version.tar.gz opencv-4.8.1-use-system-flatbuffers.patch) build() { prt-get isinst gphoto2 && PKGMK_OPENCV+=' -D WITH_GPHOTO2=ON' prt-get isinst gst-plugins-bad && PKGMK_OPENCV+=' -D WITH_GSTREAMER=ON' prt-get isinst gtk3 && PKGMK_OPENCV+=' -D WITH_GTK=ON' prt-get isinst openmp && PKGMK_OPENCV+=' -D WITH_OPENMP=ON' prt-get isinst qt6-5compat && PKGMK_OPENCV+=' -D WITH_QT=ON' #prt-get isinst onetbb && PKGMK_OPENCV+=' -D WITH_TBB=ON' prt-get isinst v4l-utils && PKGMK_OPENCV+=' -D WITH_V4L=ON' prt-get isinst wayland && PKGMK_OPENCV+=' -D WITH_WAYLAND=ON' rm -r $name-$version/3rdparty sed -e '/add_subdirectory(.*3rdparty.*)/ d' \ -i $name-$version/CMakeLists.txt $name-$version/cmake/*cmake sed -e '/LICENSE.txt/ d' \ -i $name-$version/cmake/OpenCVDetectOpenCL.cmake patch -Np1 -d $name-$version -i $SRC/opencv-4.8.1-use-system-flatbuffers.patch cmake -S $name-$version -B build -G Ninja $PKGMK_OPENCV \ -D CMAKE_INSTALL_PREFIX=/usr \ -D CMAKE_INSTALL_LIBDIR=lib \ -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS" \ -D CMAKE_C_FLAGS_RELEASE="$CFLAGS" \ -D CMAKE_POLICY_DEFAULT_CMP0148="OLD" \ -D CMAKE_CXX_STANDARD=17 \ -D CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON \ -D ENABLE_LTO=OFF \ -D OPENCV_EXTRA_MODULES_PATH=$SRC/${name}_contrib-$version/modules \ -D WITH_OPENGL=ON \ -D OpenGL_GL_PREFERENCE=GLVND \ -D OPENCV_GENERATE_PKGCONFIG=ON \ -D PROTOBUF_UPDATE_FILES=ON \ -D protobuf_MODULE_COMPATIBLE=ON \ -D OPENCV_MATHJAX_RELPATH=/usr/share/mathjax \ -D OPENCV_SKIP_PYTHON_LOADER=OFF \ -D BUILD_TESTS=OFF \ -D BUILD_TESTING=OFF \ -D BUILD_PERF_TESTS=OFF \ -D BUILD_WITH_DEBUG_INFO=OFF \ -D BUILD_EXAMPLES=OFF \ -D INSTALL_C_EXAMPLES=OFF \ -D INSTALL_PYTHON_EXAMPLES=OFF \ -D PYTHON3_EXECUTABLE=/usr/bin/python3 \ -D BUILD_PROTOBUF=OFF \ -D WITH_IPP=OFF \ -D WITH_ITT=OFF \ -Wno-dev cmake --build build DESTDIR=$PKG cmake --install build # python3 bindings cd build/python_loader python3 setup.py install --root=$PKG rm -rf $PKG/usr/python rm -rf $PKG/usr/share/licenses } # vim: set ts=4 et: