aboutsummaryrefslogtreecommitdiffstats
path: root/community/olm/APKBUILD
blob: c44f99ada50f31177d2d3f37cee30d33ce62b17a (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
# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=olm
pkgver=3.2.1
pkgrel=0
pkgdesc="Implementation of the olm and megolm cryptographic ratchets"
arch="all !mips64" # pytest-benchmark unavailable
url="https://gitlab.matrix.org/matrix-org/olm"
license="Apache-2.0"
makedepends="
	cmake
	python3-dev
	py3-cffi
	py3-setuptools
	"
checkdepends="
	py3-pytest
	py3-pytest-cov
	py3-pytest-benchmark
	py3-future
	py3-aspectlib
	"
source="https://gitlab.matrix.org/matrix-org/olm/-/archive/$pkgver/olm-$pkgver.tar.gz"
subpackages="$pkgname-dev py3-olm:py3"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build

	# hack to make the python build work
	ln -s lib/libolm.so build/libolm.so
	make -C python olm-python3
}

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

	cd "$builddir"/python
	# the tests also have trouble with lib path
	# give the ffi it just built with a link,
	# and the C libolm with the ld environment variable
	ln build/lib.linux-*/_libolm*.so tests/_libolm.so
	LD_LIBRARY_PATH="$builddir/build/lib" PYTHONPATH="$PWD" pytest
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

py3() {
	depends="python3 py3-future py3-cffi"
	DESTDIR="$subpkgdir" make -C "$builddir"/python install-python3
}
sha512sums="0c24e397a02e430487639494997c7d6cf47cce229b36114db818f14173e79c5ef7d25598c25f2778da4a1647e72fdd67e8b3c6272b980132f308d5fd1b17e189  olm-3.2.1.tar.gz"