mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-10 15:04:36 +08:00
93 lines
2.8 KiB
Bash
93 lines
2.8 KiB
Bash
pkgbase=opencv
|
|
pkgname=('opencv' 'opencv-samples')
|
|
pkgver=3.4.1
|
|
pkgrel=1
|
|
pkgdesc="Open Source Computer Vision Library"
|
|
arch=('x86_64')
|
|
license=('BSD')
|
|
url="http://opencv.org"
|
|
depends=('gst-plugins-base' 'intel-tbb' 'libcl' 'libgphoto2' 'openblas' 'lapack'
|
|
'xine-lib' 'libdc1394' 'openexr' 'v4l-utils' 'ffmpeg' 'qt5-base' 'glu' 'python3' 'libgphoto2')
|
|
makedepends=('pkgconfig' 'cmake' 'python2-numpy' 'mesa' 'python3-numpy' 'eigen3' 'hdf5')
|
|
optdepends=('python2-numpy: Python 2.x interface'
|
|
'python3-numpy: Python 3.x interface'
|
|
'eigen3'
|
|
'hdf5: For hdf5 plugin to work')
|
|
source=("opencv-$pkgver.zip::https://github.com/Itseez/opencv/archive/${pkgver}.zip"
|
|
"opencv_contrib-$pkgver.zip::https://github.com/Itseez/opencv_contrib/archive/${pkgver}.zip")
|
|
sha1sums=('1e2a04746eaeee520e58f81002c556c435ef0dce'
|
|
'4190f17296b92d39235274c4305106387236d2cd')
|
|
|
|
_cmakeopts=('-D WITH_OPENCL=ON'
|
|
'-D WITH_OPENGL=ON'
|
|
'-D WITH_TBB=ON'
|
|
'-D WITH_XINE=ON'
|
|
'-D WITH_GSTREAMER=ON'
|
|
'-D BUILD_WITH_DEBUG_INFO=OFF'
|
|
'-D BUILD_TESTS=OFF'
|
|
'-D BUILD_PERF_TESTS=OFF'
|
|
'-D BUILD_EXAMPLES=ON'
|
|
'-D INSTALL_C_EXAMPLES=ON'
|
|
'-D INSTALL_PYTHON_EXAMPLES=ON'
|
|
'-D CMAKE_BUILD_TYPE=Release'
|
|
'-D CMAKE_INSTALL_PREFIX=/usr'
|
|
'-D CMAKE_INSTALL_LIBDIR=lib'
|
|
'-D CMAKE_SKIP_RPATH=ON'
|
|
'-D WITH_QT=5'
|
|
'-D WITH_GTK=OFF'
|
|
'-D CPU_BASELINE_DISABLE=SSE3 -D CPU_BASELINE_REQUIRE=SSE2'
|
|
)
|
|
|
|
prepare() {
|
|
mkdir build
|
|
|
|
}
|
|
|
|
build() {
|
|
cd build
|
|
|
|
cmake ${_cmakeopts[@]} ../$pkgbase-$pkgver -DOPENCV_EXTRA_MODULES_PATH="$srcdir/opencv_contrib-${pkgver}/modules"
|
|
|
|
make
|
|
}
|
|
|
|
package_opencv() {
|
|
provides=('opencv-qt5')
|
|
conflicts=('opencv-qt5')
|
|
replaces=('opencv-qt5')
|
|
cd build
|
|
|
|
make DESTDIR="$pkgdir" install
|
|
|
|
# install license file
|
|
install -Dm644 "$srcdir/$pkgbase-$pkgver/LICENSE" \
|
|
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
|
|
|
# fix -lippicv not found
|
|
cd "$pkgdir/usr/share"
|
|
ln -s /usr/share/opencv/3rdparty/lib/libippicv.a "$pkgdir/usr/lib"
|
|
|
|
# separate samples package; also be -R friendly
|
|
if [[ -d OpenCV/samples ]]; then
|
|
mv OpenCV/samples "$srcdir/$pkgname-samples"
|
|
mv OpenCV $pkgname # otherwise folder naming is inconsistent
|
|
elif [[ ! -d OpenCV ]]; then
|
|
warning "Directory naming issue; samples package may not be built!"
|
|
fi
|
|
}
|
|
|
|
package_opencv-samples() {
|
|
pkgdesc+=" (samples)"
|
|
depends=("opencv=$pkgver")
|
|
unset optdepends
|
|
|
|
mkdir -p "$pkgdir/usr/share/opencv"
|
|
cp -r "$srcdir/opencv-samples" "$pkgdir/usr/share/opencv/samples"
|
|
# fix permissions
|
|
chmod 755 "$pkgdir"/usr/share/opencv/samples/*
|
|
|
|
# install license file
|
|
install -Dm644 "$srcdir/opencv-$pkgver/LICENSE" \
|
|
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
|
}
|