summaryrefslogtreecommitdiff
blob: 610cc6b8718d96cbc99ffcec91920b9ced826eae (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
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit toolchain-funcs

DESCRIPTION="zstd fast compression library"
HOMEPAGE="https://facebook.github.io/zstd/"
SRC_URI="https://github.com/facebook/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="|| ( BSD GPL-2 )"
SLOT="0/1"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
IUSE="legacy lz4 static-libs"

RDEPEND="app-arch/xz-utils
	lz4? ( app-arch/lz4 )"
DEPEND="${RDEPEND}"

src_compile() {
	local emake_args=(
		CC="$(tc-getCC)"
		CXX="$(tc-getCXX)" \
		AR="$(tc-getAR)"
		PREFIX="${EPREFIX}/usr"
		LIBDIR="${EPREFIX}/usr/$(get_libdir)"
	)
	use legacy || emake_args+=(ZSTD_LEGACY_SUPPORT=8)
	emake "${emake_args[@]}" HAVE_LZ4=$(usex lz4 1 0) zstd

	emake -C lib  "${emake_args[@]}" libzstd

	emake -C contrib/pzstd "${emake_args[@]}"
}

src_install() {
	local emake_args=(
		DESTDIR="${D}"
		PREFIX="${EPREFIX}/usr"
		LIBDIR="${EPREFIX}/usr/$(get_libdir)"
	)
	use legacy || emake_args+=(ZSTD_LEGACY_SUPPORT=8)
	emake "${emake_args[@]}" install

	emake -C contrib/pzstd "${emake_args[@]}" install

	einstalldocs

	if ! use static-libs; then
		rm "${ED}"/usr/$(get_libdir)/libzstd.a || die
	fi
}