summaryrefslogtreecommitdiff
blob: 4522905dcf19b28eb1f3276167f685f4b24e57a4 (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
63
64
65
66
67
68
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{7,8} )
inherit cmake eutils flag-o-matic python-any-r1

DESCRIPTION="Lightweight library for extracting data from files archived in a single zip file"
HOMEPAGE="http://zziplib.sourceforge.net/"
SRC_URI="https://github.com/gdraheim/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="|| ( LGPL-2.1 MPL-1.1 )"
SLOT="0"
KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE="doc sdl static-libs test"

RESTRICT="!test? ( test )"

BDEPEND="
	doc? (
		${PYTHON_DEPS}
	)
	test? (
		${PYTHON_DEPS}
		app-arch/zip
	)
"
DEPEND="
	sys-libs/zlib
	sdl? ( >=media-libs/libsdl-1.2.6 )
"
RDEPEND="${DEPEND}"

PATCHES=(
	"${FILESDIR}"/zziplib-0.13.69-009-perror.patch
	"${FILESDIR}"/zziplib-0.13.71-join-paths-pc-zzipsdldir.patch
	"${FILESDIR}"/zziplib-0.13.71-find-bash.patch
	"${FILESDIR}"/zziplib-0.13.71-testbuilds-opensuse15-ninja-sdl2.patch
	"${FILESDIR}"/zziplib-0.13.71-shell-DESTDIR.patch
)

pkg_setup() {
	use test && python-any-r1_pkg_setup
}

src_prepare() {
	cmake_src_prepare

	(use test || use doc) && python_fix_shebang .
}

src_configure() {
	append-flags -fno-strict-aliasing # bug reported upstream

	append-cppflags -D_ZZIP_LARGEFILE
	local mycmakeargs=(
		-DZZIPCOMPAT=OFF
		-DZZIPSDL="$(usex sdl ON OFF)"
		-DBUILD_STATIC_LIBS="$(usex static-libs ON OFF)"
		-DBUILD_TESTS="$(usex test ON OFF)"
		-DZZIPTEST="$(usex test ON OFF)"
		-DZZIPDOCS="$(usex doc ON OFF)"
		-DZZIPWRAP=OFF
	)

	cmake_src_configure
}