aboutsummaryrefslogtreecommitdiffstats
path: root/main/cmocka/APKBUILD
blob: c1eb47aceca7b71b5575837339e337fceee37057 (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=cmocka
pkgver=1.1.1
pkgrel=1
pkgdesc="An elegant unit testing framework for C with support for mock objects"
url="https://cmocka.org/"
arch="all"
license="Apache-2.0"
depends=""
makedepends="cmake"
subpackages="$pkgname-dev"
source="https://cmocka.org/files/${pkgver%.*}/$pkgname-$pkgver.tar.xz
	wordsize.patch
	musl_uintptr.patch"
builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	default_prepare

	# 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
}

build() {
	mkdir -p "$builddir"/build
	cd "$builddir"/build

	cmake .. \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DUNIT_TESTING=ON
	make
}

check() {
	cd "$builddir"/build

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

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

sha512sums="801c4a3e1bb9047241b1cb5a90c1cbdee1b0aff5e3d0a84ec8b2dbaee79274618c24fbe5e9fedbf0b3ee18c6c98b55d93e135d037ac33ab872edc7665af41577  cmocka-1.1.1.tar.xz
16dfd8e6e2b21bda549a31cae0e60405039ff3559c879bc35811b55b06d64dcc75402d6a0cb89d029d69faeaa6484329ce03788feb9e69c1a844e63ac8d21f69  wordsize.patch
b20b5c0d172a9df756ec093a3df4bf5bdf2a0c06a3d3ad39ec001248ccb86e6fd3dcedfc9ce42e8309cc01ea34fadffd4ebcc0fb3af9f5e795e7fe40c461ac60  musl_uintptr.patch"