Subject: [PATCH] main/snappy-static: add package for static library

From: [email-masked]
Date: Tue, 11 Feb 2020 08:19:32 +0000

From: Sascha Brawer <[email-masked]>

https://gitlab.alpinelinux.org/alpine/aports/issues/11212
---
 main/snappy/APKBUILD | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/main/snappy/APKBUILD b/main/snappy/APKBUILD
index 3ad4a42437..54718c7ac1 100644
--- a/main/snappy/APKBUILD
+++ b/main/snappy/APKBUILD
@@ -2,18 +2,27 @@
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=snappy
 pkgver=1.1.8
-pkgrel=0
+pkgrel=1
 pkgdesc="Fast compression and decompression library"
 url="https://google.github.io/snappy/"
 arch="all"
 license="BSD-3-Clause"
 makedepends="cmake"
-subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc"
+subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-static"
 source="$pkgname-$pkgver.tar.gz::https://github.com/google/snappy/archive/$pkgver.tar.gz
 	optimize-mips-s390x.patch
 	"
 
 build() {
+	# Build static library
+	cmake . \
+		-DCMAKE_BUILD_TYPE=Release \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DCMAKE_INSTALL_LIBDIR=/usr/lib \
+		-DBUILD_SHARED_LIBS=OFF
+	cmake --build .
+
+	# Build shared library
 	cmake . \
 		-DCMAKE_BUILD_TYPE=Release \
 		-DCMAKE_INSTALL_PREFIX=/usr \
@@ -29,6 +38,9 @@ check() {
 package() {
 	make DESTDIR="$pkgdir" install
 
+	install -d "$pkgdir"/../snappy-static/usr/lib
+	install -m644 libsnappy.a "$pkgdir"/../snappy-static/usr/lib/libsnappy.a
+
 	local file; for file in AUTHORS CONTRIBUTING.md COPYING NEWS README.md \
 		format_description.txt framing_format.txt; do
 		install -m644 -D $file "$pkgdir"/usr/share/doc/$pkgname/$file
-- 
2.24.1