summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f6371261b09af715644c9cde0d4e9c584c453469 (plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Script generated with import_catkin_packages.py
# For more information: https://github.com/bchretien/arch-ros-stacks
pkgdesc="ROS - OpenCV 3.x. for melodic distro"

pkgname='ros-melodic-opencv3'
pkgver='3.4.5'
_pkgver_patch=1
arch=('x86_64')
pkgrel=2
license=('BSD')
url='https://github.com/ros-gbp/opencv3-release'
url="http://opencv.org/"

ros_makedepends=()
makedepends=(
  'cmake'
  'ros-build-tools'
  ${ros_makedepends[@]}
  'eigen'
  'ffmpeg'
  'glew'
  'gtk3'
  'hdf5'
  'jasper'
  'lapacke'
  'libjpeg-turbo'
  'libpng'
  'libtiff'
  'libwebp'
  'mesa'
  'openblas'
  'protobuf'
  'python-setuptools'
  'python'
  'python-numpy'
  'v4l-utils'
  'vtk')

ros_depends=('ros-melodic-catkin')
depends=(
  ${ros_depends[@]}
  'ffmpeg'
  'gst-plugins-base'
  'intel-tbb'
  'jasper'
  'lapack'
  'libdc1394'
  'libgphoto2'
  'libjpeg-turbo'
  'libwebp'
  'openblas'
  'openexr'
  'protobuf'
  'python'
  'v4l-utils'
  'zlib')

source=(opencv-${pkgver}.tar.gz::https://github.com/opencv/opencv/archive/${pkgver}.tar.gz
        opencv_contrib-${pkgver}.tar.gz::https://github.com/opencv/opencv_contrib/archive/${pkgver}.tar.gz)
sha256sums=('0c57d9dd6d30cbffe68a09b03f4bebe773ee44dc8ff5cd6eaeb7f4d5ef3b428e'
            '8f73d029887c726fed89c69a2b0fcb1d098099fcd81c1070e1af3b452669fbe2')

_dir="opencv-${pkgver}"

build() {
  # Use ROS environment variables
  source /usr/share/ros-build-tools/clear-ros-env.sh
  [ -f /opt/ros/melodic/setup.bash ] && source /opt/ros/melodic/setup.bash

  # Create build directory
  [ -d ${srcdir}/build ] || mkdir ${srcdir}/build
  cd ${srcdir}/build

  # Fix Python2/Python3 conflicts
  /usr/share/ros-build-tools/fix-python-scripts.sh -v 3 ${srcdir}/${_dir}

  # Build project
  cmake ${srcdir}/${_dir} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCATKIN_BUILD_BINARY_PACKAGE=ON \
    -DCMAKE_INSTALL_PREFIX=/opt/ros/melodic \
    -DPYTHON_EXECUTABLE=/usr/bin/python3 \
    -DPYTHON_INCLUDE_DIR=/usr/include/python3.7m \
    -DPYTHON_LIBRARY=/usr/lib/libpython3.7m.so \
    -DPYTHON_BASENAME=.cpython3.7m \
    -DSETUPTOOLS_DEB_LAYOUT=OFF \
    -DWITH_V4L=ON \
    -DWITH_LIBV4L=ON \
    -DWITH_FFMPEG=ON \
    -DOPENCV_EXTRA_MODULES_PATH=${srcdir}/opencv_contrib-${pkgver}/modules \
    -DWITH_OPENCL=ON \
    -DWITH_OPENGL=ON \
    -DWITH_TBB=ON \
    -DOpenGL_GL_PREFERENCE=GLVND \
    -DBUILD_WITH_DEBUG_INFO=OFF \
    -DBUILD_TESTS=OFF \
    -DBUILD_PERF_TESTS=OFF \
    -DBUILD_EXAMPLES=OFF \
    -DINSTALL_C_EXAMPLES=ON \
    -DINSTALL_PYTHON_EXAMPLES=ON \
    -DCPU_BASELINE_DISABLE=SSE3 \
    -DCPU_BASELINE_REQUIRE=SSE2 \
    -DLAPACK_LIBRARIES="/usr/lib/liblapack.so;/usr/lib/libblas.so;/usr/lib/libcblas.so" \
    -DLAPACK_CBLAS_H="/usr/include/cblas.h" \
    -DLAPACK_LAPACKE_H="/usr/include/lapacke.h"

  make -j$(nproc)
}

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