summaryrefslogtreecommitdiff
path: root/user/opencv/APKBUILD
blob: 3f4c9e58cca3c17e8f2c8bf0fd748c11266b4a8a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=opencv
pkgver=3.4.1
pkgrel=2
pkgdesc="Computer vision and machine learning software library"
url="https://opencv.org"
arch="all"
options="!check"  # an hour on the talos is madness
license="BSD-3-Clause"
depends=""
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
	pmmx.patch
	"

prepare() {
	cd "$builddir"
	default_prepare
	# purge 3rd party except carotene
	for i in 3rdparty/*; do
		case $i in
		*/carotene*) continue;;
		*/protobuf*) continue;;
		*/ittnotify) continue;;  # Else FTBFS on x86_64
		esac
		rm -rf "$i"
	done
	mkdir -p build
}

build() {
	cd "$builddir"/build
	if [ "$CARCH" != "x86_64" ]; then
		local _sse="-DENABLE_SSE=OFF -DENABLE_SSE2=OFF"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS -U_FORTIFY_SOURCE" \
		-DCMAKE_C_FLAGS="$CFLAGS -U_FORTIFY_SOURCE" \
		-DENABLE_PRECOMPILED_HEADERS=OFF \
		-DWITH_OPENMP=ON \
		-DWITH_OPENCL=ON \
		-DWITH_OPENEXR=OFF \
		-DWITH_IPP=OFF \
		$_sse \
		..
	make
}

check() {
	cd "$builddir"/build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	cd "$builddir"/build
	make DESTDIR="$pkgdir" install
}

sha512sums="e1fc14285090c6fe9e26e721f2d67d7096650c523147e925567426ef76aa7f4c6f12035d6f6ce3ec7991a75a6828a810fd4f9b75f78ed5fcccecefbadd79944b  opencv-3.4.1.tar.gz
8ebf573e3f02b78b5769eaf828215698073096a1dade9214af0382cfbbe2353307df836a6af8c4e86246ad33fefe1f64a1087d0ff7a6dc7c5f3e231592c20b4c  pmmx.patch"