APKBUILD 1.57 KB
Newer Older
1 2 3
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=cmocka
4 5
pkgver=1.1.5
pkgrel=0
6 7
pkgdesc="An elegant unit testing framework for C with support for mock objects"
url="https://cmocka.org/"
8
arch="all"
9
license="Apache-2.0"
10 11
depends=""
makedepends="cmake"
12
subpackages="$pkgname-dev"
13
source="https://cmocka.org/files/${pkgver%.*}/$pkgname-$pkgver.tar.xz
14
	wordsize.patch
15
	musl_uintptr.patch"
16 17
builddir="$srcdir/$pkgname-$pkgver"

18
prepare() {
tmpfile's avatar
tmpfile committed
19
	default_prepare
20 21 22 23 24 25 26

	# Just one single test (customer_database_test) is breaking on ppc64le.
	if [ "$CARCH" = "ppc64le" ]; then
		sed -i '/customer_database_test/d' "$builddir"/example/CMakeLists.txt
	fi
}

27
build() {
tmpfile's avatar
tmpfile committed
28
	mkdir -p "$builddir"/build
29
	cd "$builddir"/build
30 31 32

	cmake .. \
		-DCMAKE_INSTALL_PREFIX=/usr \
33
		-DCMAKE_INSTALL_LIBDIR=lib \
34 35 36
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_C_FLAGS="$CFLAGS" \
tmpfile's avatar
tmpfile committed
37
		-DUNIT_TESTING=ON
38
	make
39 40
}

41
check() {
42 43 44 45
	cd "$builddir"/build

	# If some tests fail, run them again in verbose mode.
	make test || ctest --rerun-failed --extra-verbose
46
}
47

48 49
package() {
	make -C "$builddir"/build DESTDIR="$pkgdir" install
50 51
}

52 53
sha512sums="cad7f04757183d004f6eaad39036fc0e24c5e0e987f80e85bc43bc66dba22389cb02b08e25531cc28a541d0a24a86b29be134a2d6fc339128e87d66952f502bd  cmocka-1.1.5.tar.xz
773b8675f38eda0ca4df919c23646f029390892dd8f8675ce67c2f736f112d243d4e03aff4f013983bbefc2657cfa6c7563416b7b6dd15dd7aa4015228bb6ad1  wordsize.patch
54
b20b5c0d172a9df756ec093a3df4bf5bdf2a0c06a3d3ad39ec001248ccb86e6fd3dcedfc9ce42e8309cc01ea34fadffd4ebcc0fb3af9f5e795e7fe40c461ac60  musl_uintptr.patch"