Github messages for voidlinux
 help / color / mirror / Atom feed
* Re: [PR PATCH] [Updated] opencv4: allow python subpackage to cross build
       [not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-23371@inbox.vuxu.org>
@ 2020-07-03 17:53 ` ahesford
  0 siblings, 0 replies; only message in thread
From: ahesford @ 2020-07-03 17:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

There is an updated pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages opencv4
https://github.com/void-linux/void-packages/pull/23371

opencv4: allow python subpackage to cross build
Split from #23370 to avoid CI timeouts.

A patch file from https://github.com/void-linux/void-packages/pull/23371.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-opencv4-23371.patch --]
[-- Type: text/x-diff, Size: 3111 bytes --]

From c9faf8d98d3d929070bff6d77ee14de45fb7f2c0 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Thu, 2 Jul 2020 21:22:40 -0400
Subject: [PATCH] opencv4: allow python module to cross build

[ci skip]
---
 srcpkgs/opencv4/template | 51 +++++++++++++++++++++++-----------------
 1 file changed, 30 insertions(+), 21 deletions(-)

diff --git a/srcpkgs/opencv4/template b/srcpkgs/opencv4/template
index c6a21b58cac..cdeffdf991e 100644
--- a/srcpkgs/opencv4/template
+++ b/srcpkgs/opencv4/template
@@ -1,7 +1,7 @@
 # Template file for 'opencv4'
 pkgname=opencv4
 version=4.3.0
-revision=2
+revision=3
 wrksrc=opencv-${version}
 build_style=cmake
 configure_args="-DENABLE_PRECOMPILED_HEADERS=OFF -DWITH_OPENMP=ON -DWITH_OPENCL=ON
@@ -11,10 +11,11 @@ configure_args="-DENABLE_PRECOMPILED_HEADERS=OFF -DWITH_OPENMP=ON -DWITH_OPENCL=
  -DOPENCV_PYTHON_INSTALL_PATH=/${py2_sitelib}
  -DOPENCV_EXTRA_MODULES_PATH=${XBPS_BUILDDIR}/opencv_contrib-${version}/modules
  -DBUILD_opencv_rgbd=OFF"
-hostmakedepends="pkg-config eigen"
+hostmakedepends="pkg-config eigen python-numpy python3-numpy"
 makedepends="ffmpeg-devel libpng-devel libjpeg-turbo-devel tiff-devel
  jasper-devel ocl-icd-devel libgomp-devel libopenexr-devel gtk+3-devel
- libgphoto2-devel gst-plugins-base1-devel openblas-devel"
+ libgphoto2-devel gst-plugins-base1-devel openblas-devel
+ python-numpy python3-numpy python-devel python3-devel"
 short_desc="Computer vision and machine learning software library, version 4.x"
 maintainer="Hazel Levine <me@qtp2t.club>"
 license="BSD-3-Clause"
@@ -28,6 +29,20 @@ if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
 	makedepends+=" libatomic-devel"
 fi
 
+if [ -z "$XBPS_CHECK_PKGS" ]; then
+	# opencv by default builds tests that only seem to be used in make check
+	configure_args+=" -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF"
+fi
+
+if [ "$CROSS_BUILD" ]; then
+	# Tell opencv where to find python and numpy
+	_npincdir="numpy/core/include"
+	configure_args+=" -DPYTHON2_INCLUDE_PATH=${XBPS_CROSS_BASE}/${py2_inc}
+	 -DPYTHON2_NUMPY_INCLUDE_DIRS=${XBPS_CROSS_BASE}/${py2_sitelib}/${_npincdir}
+	 -DPYTHON3_INCLUDE_PATH=${XBPS_CROSS_BASE}/${py3_inc}
+	 -DPYTHON3_NUMPY_INCLUDE_DIRS=${XBPS_CROSS_BASE}/${py3_sitelib}/${_npincdir}"
+fi
+
 post_install() {
 	vlicense LICENSE
 }
@@ -51,24 +66,18 @@ libopencv4-devel_package() {
 	}
 }
 
-if [ -z "$CROSS_BUILD" ]; then
-	# because python-numpy cannot be cross compiled
-	hostmakedepends+=" python-devel python3-devel"
-	makedepends+=" python-numpy python3-numpy"
-
-	libopencv4-python_package() {
-		short_desc+=" - Python2 bindings"
-		depends="python-numpy"
-		pkg_install() {
-			vmove usr/lib/python2.7
-		}
+libopencv4-python_package() {
+	short_desc+=" - Python2 bindings"
+	depends="python-numpy"
+	pkg_install() {
+		vmove ${py2_sitelib}
 	}
+}
 
-	libopencv4-python3_package() {
-		short_desc+=" - Python3 bindings"
-		depends="python3-numpy"
-		pkg_install() {
-			vmove usr/lib/python3*
-		}
+libopencv4-python3_package() {
+	short_desc+=" - Python3 bindings"
+	depends="python3-numpy"
+	pkg_install() {
+		vmove ${py3_sitelib}
 	}
-fi
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-03 17:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-23371@inbox.vuxu.org>
2020-07-03 17:53 ` [PR PATCH] [Updated] opencv4: allow python subpackage to cross build ahesford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).