aboutsummaryrefslogtreecommitdiffstats
path: root/community/xxhash/APKBUILD
blob: 825f1c3ebbe94eb5c44ae2dfbdf6c94abc8aa42f (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
59
60
61
62
63
64
65
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=xxhash
_pkgname=xxHash
pkgver=0.8.1
_pypkg=python-xxhash
_pyver=1.4.4
pkgrel=0
pkgdesc="Extremely fast non-cryptographic hash algorithm"
url="https://cyan4973.github.io/xxHash/"
arch="all"
license="BSD-2-Clause GPL-2.0-or-later"
makedepends="python3-dev py3-setuptools"
subpackages="$pkgname-dev $pkgname-doc py3-$pkgname:_py3 lib$pkgname:libs"
source="$_pkgname-$pkgver.tar.gz::https://github.com/Cyan4973/$_pkgname/archive/v$pkgver.tar.gz
	$_pypkg-$_pyver.tar.gz::https://github.com/ifduyue/$_pypkg/archive/v$_pyver.tar.gz
	"
builddir="$srcdir/"$_pkgname-$pkgver
_pybuilddir="$srcdir/"$_pypkg-$_pyver

build() {
	export CFLAGS="$CFLAGS -DXXH_FORCE_MEMORY_ACCESS=1"
	sed -i 's|--leak-check=yes|-v --leak-check=full --show-leak-kinds=all|' Makefile
	make

	cd "$_pybuilddir"
	ln -s "$srcdir"/$_pkgname-$pkgver/xxhash.c ./deps/xxhash/xxhash.c
	ln -s "$srcdir"/$_pkgname-$pkgver/xxhash.h ./deps/xxhash/xxhash.h
	ln -s "$srcdir"/$_pkgname-$pkgver/xxh3.h ./deps/xxhash/xxh3.h
	python3 setup.py build
}

check() {
	case "$CARCH" in
		armhf) return 0;; # due to "Bus error"
		*)
			make check
			cd "$_pybuilddir"
			PYTHONPATH="$PWD/$(ls -d build/lib*)" python3 tests/test.py
			;;
	esac
}

package() {
	make DESTDIR="$pkgdir" PREFIX=/usr install
	rm -rf "$pkgdir"/usr/lib/libxxhash.a
}

_py3() {
	local python="$1"
	pkgdesc="$pkgdesc (for python3)"
	depends="python3 xxhash"

	replaces="py-xxhash"
	provides="py-xxhash=$pkgver-r$pkgrel"

	cd "$_pybuilddir"
	python3 setup.py install --prefix=/usr --root="$subpkgdir"
}

sha512sums="
12feedd6a1859ef55e27218dbd6dcceccbb5a4da34cd80240d2f7d44cd246c7afdeb59830c2d5b90189bb5159293532208bf5bb622250102e12d6e1bad14a193  xxHash-0.8.1.tar.gz
60e6cb2f8c1bdfa01ac6cad8f3950bf36da317fb6fb2b94a44ce5b855d45f5385fd70e3ac9e5e9b9870823c255e23d02738b8c6f82ba4bce5bf16dbadf92345c  python-xxhash-1.4.4.tar.gz
"