diff --git a/testing/brotli/APKBUILD b/testing/brotli/APKBUILD
index 821d54d94f16ad4417c4c17424b51b0f1f1a2747..bad68ba3c314983493c7a8e3365a4c93e9b431e2 100644
--- a/testing/brotli/APKBUILD
+++ b/testing/brotli/APKBUILD
@@ -9,7 +9,7 @@ arch="all"
 license="MIT"
 makedepends="cmake"
 subpackages="$pkgname-doc $pkgname-dev"
-source="$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz"
+source="$pkgname-$pkgver.tar.gz::https://github.com/google/brotli/archive/v$pkgver.tar.gz"
 builddir="$srcdir/$pkgname-$pkgver"
 
 prepare() {
@@ -18,12 +18,17 @@ prepare() {
 }
 
 build() {
-	mkdir "$builddir"/build
-	cd "$builddir"/build
-	cmake .. \
-		-DCMAKE_BUILD_TYPE=Release \
+	cd "$builddir"
+	if [ "$CBUILD" != "$CHOST" ]; then
+		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
+	fi
+	cmake \
 		-DCMAKE_INSTALL_PREFIX=/usr \
-		-DCMAKE_INSTALL_LIBDIR=/usr/lib
+		-DCMAKE_INSTALL_LIBDIR=lib \
+		-DBUILD_SHARED_LIBS=True \
+		-DCMAKE_BUILD_TYPE=Release \
+		-DCMAKE_C_FLAGS="$CFLAGS" \
+		${CMAKE_CROSSOPTS}
 	make
 }
 
@@ -34,10 +39,9 @@ check() {
  
 package() {
 	cd "$builddir"
-	make DESTDIR="$pkgdir" -C build install
+	make DESTDIR="$pkgdir" install
 	
-	local man
-	for man in docs/*.?; do
+	local man; for man in docs/*.?; do
 		install -D -m644 $man "$pkgdir"/usr/share/man/man${man##*.}/${man##*/}
 	done
 }