summaryrefslogtreecommitdiff
blob: d4dbbe979a81b7d88fdb40177f03bf8874e4358b (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
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

inherit flag-o-matic pax-utils toolchain-funcs

MY_P=${PN}${PV/./}
DESCRIPTION="Journaling incremental deduplicating archiving compressor"
HOMEPAGE="http://mattmahoney.net/dc/zpaq.html"
SRC_URI="http://mattmahoney.net/dc/${MY_P}.zip"

LICENSE="Unlicense"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="debug +jit"

# now 2in1!
RDEPEND="!app-arch/libzpaq"
# perl for pod2man
DEPEND="
	app-arch/unzip
	dev-lang/perl"

S=${WORKDIR}

src_prepare() {
	default
	sed -i -e '/^zpaq:/,+1s/libzpaq\.o/$(SONAME)/' Makefile || die
}

src_compile() {
	use debug || append-cppflags -DNDEBUG
	use jit || append-cppflags -DNOJIT
	emake CXX="$(tc-getCXX)" CXXFLAGS="${CXXFLAGS}"
}

src_test() {
	local -x LD_LIBRARY_PATH=".${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
	use jit && pax-mark m zpaq
	default
}

src_install() {
	emake install PREFIX="${ED%/}"/usr LIBDIR="\$(PREFIX)/$(get_libdir)"
	use jit && pax-mark m "${ED%/}"/usr/bin/zpaq
	einstalldocs
}

pkg_postinst() {
	if ! has_version app-arch/zpaq-extras; then
		elog "You may also want to install app-arch/zpaq-extras package which provides"
		elog "few additional configs and preprocessors for use with zpaq."
	fi
}