summaryrefslogtreecommitdiff
path: root/main/libkcapi/APKBUILD
blob: 605fde41d59de0eb3b516cfe02133e31e8fba7f5 (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
# Maintainer: psykose <alice@ayaya.dev>
pkgname=libkcapi
pkgver=1.4.0
pkgrel=0
pkgdesc="Linux Kernel Crypto API User Space Interface Library"
url="https://www.chronox.de/libkcapi.html"
arch="all"
license="BSD-3-Clause OR GPL-2.0-or-later"
makedepends="
	autoconf
	automake
	libtool
	linux-headers
	"
checkdepends="bash openssl"
subpackages="$pkgname-dev $pkgname-tools $pkgname-doc"
source="https://www.chronox.de/libkcapi/libkcapi-$pkgver.tar.xz
	no-werror.patch
	"
# requires AF_ALG support and enablement of ktls on running kernel
options="!check"

prepare() {
	default_prepare

	autoreconf -fvi
}

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	./configure \
		--prefix=/usr \
		--build=$CBUILD \
		--host=$CHOST \
		--enable-kcapi-hasher \
		--enable-kcapi-speed \
		--enable-kcapi-rngapp \
		--enable-kcapi-encapp \
		--enable-kcapi-dgstapp \
		--enable-kcapi-test \
		--disable-static
	make
}

check() {
	local tests="
		hasher-test.sh
		kcapi-convenience.sh
		kcapi-dgst-test.sh
		kcapi-enc-test-large.sh
		kcapi-enc-test.sh
		kcapi-fuzz-test.sh
		"
	for test in $tests; do
		msg "testing $test"
		./test/$test
	done
}

package() {
	make DESTDIR="$pkgdir" install

	rm "$pkgdir"/usr/lib/.[!.]*
	rm "$pkgdir"/usr/bin/.[!.]*
	rm "$pkgdir"/usr/bin/fips*
	rm -r "$pkgdir"/usr/libexec/

	cd "$pkgdir"/usr/bin

	# rename generic utils to not conflict with generic names. the options
	# aren't guaranteed to be compatible
	for tool in sha* md5* sm3*; do
		mv $tool kcapi-$tool
	done
}

tools() {
	pkgdesc="$pkgdesc (commandline utilities)"

	amove usr/bin
}

sha512sums="
fa3df1fe22eba32585de5df044f907d3ad189c33f5704fe29b0fdeda92e772ef077055b80e17bc1646a8cdedaf4f195aadf0b133f493597f0f7657b04ea93a99  libkcapi-1.4.0.tar.xz
a5b38f49a7bb07eb57523566e065bad702999d8be21fa6cd8a01af1b60e9bd8fbb6fd9cf71f70dca7d616aa381475273d995841b8580f91418fb0094263e6402  no-werror.patch
"