Github messages for voidlinux
 help / color / mirror / Atom feed
From: ahesford <ahesford@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] opencv4: allow python subpackage to cross build
Date: Fri, 03 Jul 2020 19:53:46 +0200	[thread overview]
Message-ID: <20200703175346.do-EPG2yQPUNH8jTSpjjE4XXpSB8CBDJONDoiAnnwSc@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-23371@inbox.vuxu.org>

[-- 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
+}

           reply	other threads:[~2020-07-03 17:53 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-23371@inbox.vuxu.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200703175346.do-EPG2yQPUNH8jTSpjjE4XXpSB8CBDJONDoiAnnwSc@z \
    --to=ahesford@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).