aboutsummaryrefslogtreecommitdiffstats
path: root/community/olm/APKBUILD
blob: c3849164b6a9bc2cf6717b1407d1ee3188715465 (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.1.5
pkgrel=2
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="2adb55cbed27f15db78a5ebd86ed78183a6d093e41b57d18cd8d046ceeb114993cf0b1c4f1a0e363aa9701cea580ec80797251db5f812fe088e3ea107f453563  olm-3.1.5.tar.gz"