summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--user/opencv/APKBUILD14
-rw-r--r--user/opencv/pmmx.patch27
2 files changed, 36 insertions, 5 deletions
diff --git a/user/opencv/APKBUILD b/user/opencv/APKBUILD
index 7d403770e..3f4c9e58c 100644
--- a/user/opencv/APKBUILD
+++ b/user/opencv/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer:
pkgname=opencv
pkgver=3.4.1
-pkgrel=1
+pkgrel=2
pkgdesc="Computer vision and machine learning software library"
url="https://opencv.org"
arch="all"
@@ -13,7 +13,9 @@ makedepends="cmake doxygen ffmpeg-dev gst-plugins-base-dev gtk+2.0-dev
gtk+3.0-dev jasper-dev libdc1394-dev libgomp libgphoto2-dev
libjpeg-turbo-dev libpng-dev libwebp-dev tiff-dev v4l-utils-dev"
subpackages="$pkgname-dev $pkgname-libs"
-source="opencv-$pkgver.tar.gz::https://github.com/opencv/opencv/archive/$pkgver.tar.gz"
+source="opencv-$pkgver.tar.gz::https://github.com/opencv/opencv/archive/$pkgver.tar.gz
+ pmmx.patch
+ "
prepare() {
cd "$builddir"
@@ -23,6 +25,7 @@ prepare() {
case $i in
*/carotene*) continue;;
*/protobuf*) continue;;
+ */ittnotify) continue;; # Else FTBFS on x86_64
esac
rm -rf "$i"
done
@@ -39,8 +42,8 @@ build() {
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=True \
-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
- -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
- -DCMAKE_C_FLAGS="$CFLAGS" \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS -U_FORTIFY_SOURCE" \
+ -DCMAKE_C_FLAGS="$CFLAGS -U_FORTIFY_SOURCE" \
-DENABLE_PRECOMPILED_HEADERS=OFF \
-DWITH_OPENMP=ON \
-DWITH_OPENCL=ON \
@@ -61,4 +64,5 @@ package() {
make DESTDIR="$pkgdir" install
}
-sha512sums="e1fc14285090c6fe9e26e721f2d67d7096650c523147e925567426ef76aa7f4c6f12035d6f6ce3ec7991a75a6828a810fd4f9b75f78ed5fcccecefbadd79944b opencv-3.4.1.tar.gz"
+sha512sums="e1fc14285090c6fe9e26e721f2d67d7096650c523147e925567426ef76aa7f4c6f12035d6f6ce3ec7991a75a6828a810fd4f9b75f78ed5fcccecefbadd79944b opencv-3.4.1.tar.gz
+8ebf573e3f02b78b5769eaf828215698073096a1dade9214af0382cfbbe2353307df836a6af8c4e86246ad33fefe1f64a1087d0ff7a6dc7c5f3e231592c20b4c pmmx.patch"
diff --git a/user/opencv/pmmx.patch b/user/opencv/pmmx.patch
new file mode 100644
index 000000000..f36d643cf
--- /dev/null
+++ b/user/opencv/pmmx.patch
@@ -0,0 +1,27 @@
+From 7dc162cb4252ccf461f1c63650abde3c8807b79c Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.alekhin@intel.com>
+Date: Mon, 9 Apr 2018 18:25:51 +0300
+Subject: [PATCH] core: fix mm_pause() for non-SSE i386 builds
+
+replaced to safe binary compatible 'rep; nop' asm instruction
+---
+ modules/core/src/parallel_impl.cpp | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/modules/core/src/parallel_impl.cpp b/modules/core/src/parallel_impl.cpp
+index 78d9eb63694..bc64fce7a81 100644
+--- a/modules/core/src/parallel_impl.cpp
++++ b/modules/core/src/parallel_impl.cpp
+@@ -49,7 +49,11 @@ DECLARE_CV_YIELD
+ DECLARE_CV_PAUSE
+ #endif
+ #ifndef CV_PAUSE
+-#if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
++# if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
++# if !defined(__SSE__)
++ static inline void cv_non_sse_mm_pause() { __asm__ __volatile__ ("rep; nop"); }
++# define _mm_pause cv_non_sse_mm_pause
++# endif
+ # define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { _mm_pause(); } } while (0)
+ # elif defined __GNUC__ && defined __aarch64__
+ # define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { asm volatile("yield" ::: "memory"); } } while (0)