aboutsummaryrefslogtreecommitdiffstats
path: root/main/zstd/APKBUILD
blob: 6d14206fde3aaabfdfa0ae58d757504a76d729e4 (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
# Contributor: stef <l0ls0fo2i@ctrlc.hu>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=zstd
pkgver=1.4.9
pkgrel=0
pkgdesc="Zstandard - Fast real-time compression algorithm"
url="https://www.zstd.net"
arch="all"
license="BSD-3-Clause GPL-2.0-or-later"
checkdepends="file"
makedepends="grep"
subpackages="$pkgname-static $pkgname-libs $pkgname-dev $pkgname-doc"
source="zstd-$pkgver.tar.gz::https://github.com/facebook/zstd/archive/v$pkgver.tar.gz
	"

# secfixes:
#   1.4.9-r0:
#     - CVE-2021-24032
#   1.3.8-r0:
#     - CVE-2019-11922

unset CPPFLAGS
export CFLAGS="$CFLAGS -O2 -fno-strict-aliasing -fPIC"
case "$CARCH" in
        # avoid memory copy hack that violates C standard
        armhf) export CFLAGS="$CFLAGS -DMEM_FORCE_MEMORY_ACCESS=0" ;;
esac

case "$CARCH" in
	arm*) options="!check" ;;
esac

build() {
	unset CPPFLAGS
	local _moreflags="-O2"
	case "$CARCH" in
		# avoid memory copy hack that violates C standard
		armhf) _moreflags="$_moreflags -DMEM_FORCE_MEMORY_ACCESS=0" ;;
	esac
	make HAVE_PTHREAD=1 HAVE_ZLIB=0 HAVE_LZMA=0 HAVE_LZ4=0 MOREFLAGS="$_moreflags"
}

check() {
	case "$CARCH" in
		arm*) make check ;;
		*) make test ;;
	esac
}

package() {
	make PREFIX="/usr" DESTDIR="$pkgdir" install
}

static() {
	pkgdesc="zstd static library"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
}

sha512sums="
f529db9c094f9ae26428bf1fdfcc91c6d783d400980e0f0d802d2cf13c2be2931465ef568907e03841ff76a369a1447e7371f8799d8526edb9a513ba5c6db133  zstd-1.4.9.tar.gz
"