summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 75dc068dfb7da26bd451f6c59b88d364209a89a9 (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
# Maintainer of this PKGBUILD file: Martino Pilia <martino.pilia@gmail.com>
_name=pptk
pkgname=python-$_name-git
pkgver=r49.697c09a
pkgrel=5
pkgdesc="Python package for visualizing and processing 2-d/3-d point clouds"
arch=('x86_64')
url="https://github.com/heremaps/pptk.git"
license=('MIT')
depends=(
	'eigen'
	'intel-tbb'
	'python-numpy'
	'qt5-base'
)
makedepends=(
	'cmake'
	'git'
	'patchelf'
	'python-pip'
	'python-setuptools'
	'python-wheel'
)
provides=('python-pptk')
source=(
	git+https://github.com/heremaps/pptk.git
)
sha256sums=(
	'SKIP'
)

pkgver() {
	cd "$srcdir/$_name"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
	cd "$srcdir/$_name"
	sed -i 's,.*,,g' pptk/libs/CMakeLists.txt
	sed -i 's,PythonLibs 2.7 REQUIRED,PythonLibs 3.5 REQUIRED,' CMakeLists.txt
	sed -i 's,../libs/qt_plugins,/usr/lib/qt/plugins,' pptk/viewer/qt.conf

    # Patch broken usage of internal pip components
    sed -i -e 's,from pip._internal.*,from pip._internal.pep425tags import get_supported,' \
           -e 's,wheel.pep425tags.*,get_supported()[0],g' \
           -e 's,wheel_tags\[0\],wheel_tags._interpreter,g' \
           -e 's,wheel_tags\[2\],wheel_tags._platform,g' \
           setup.py

	cmake . \
		-DEigen_INCLUDE_DIR:FILEPATH="/usr/include/eigen3" \
		-DNumpy_INCLUDE_DIR="$(python -c 'import numpy; print("%s/numpy" % numpy.get_include())')" \
		-DPPTK_PATCHELF:FILEPATH="/usr/bin/patchelf" \
		-DTBB_INCLUDE_DIR:FILEPATH="/usr/include/tbb" \
		-DTBB_tbb_LIBRARY:FILEPATH="/usr/lib/libtbb.so" \
		-DTBB_tbb_RUNTIME:FILEPATH="/usr/lib/libtbb.so" \
		-DTBB_tbbmalloc_LIBRARY:FILEPATH="/usr/lib/libtbbmalloc.so" \
		-DTBB_tbbmalloc_RUNTIME:FILEPATH="/usr/lib/libtbbmalloc.so"
}

build() {
	cd "$srcdir/$_name"
	make
	python setup.py bdist_wheel
}

package() {
	cd "$srcdir/$_name"
	_py_version=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
	PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps ./dist/*.whl
	python -O -m compileall "${pkgdir}/usr/lib/python${_py_version}/site-packages/$_name"
}