summaryrefslogtreecommitdiff
blob: 9e0dfc8b4e5c9417eff8383063103165f0f48a45 (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
69
70
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{10..13} )
# Needed for docs, bug #8357553
PYTHON_REQ_USE="xml(+)"
inherit cmake flag-o-matic python-any-r1

TEST_PV="0.13.74"
DESCRIPTION="Lightweight library for extracting data from files archived in a single zip file"
HOMEPAGE="https://github.com/gdraheim/zziplib https://zziplib.sourceforge.net"
# Test data tarball generated with python ./zziptests.py -D -d /tmp/zziplib -v
SRC_URI="
	https://github.com/gdraheim/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
	test? ( https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${PN}-${TEST_PV}-testdata.tar.xz )
"

LICENSE="|| ( LGPL-2.1 MPL-1.1 )"
SLOT="0/13"
KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="sdl test"
RESTRICT="!test? ( test )"

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

src_prepare() {
	# This test assumes being built with automake (checks for .libs/x).
	sed -i -e 's/test_91000_zzshowme_check_sfx/skip_&/' test/zziptests.py || die
	cmake_src_prepare
}

src_configure() {
	# https://github.com/gdraheim/zziplib/commit/f3bfc0dd6663b7df272cc0cf17f48838ad724a2f#diff-b7b1e314614cf326c6e2b6eba1540682R100
	append-flags -fno-strict-aliasing

	local mycmakeargs=(
		-DZZIPSDL=$(usex sdl)
		-DBUILD_TESTS=$(usex test)
		-DZZIPTEST=$(usex test)
		-DZZIPDOCS=ON
		-DZZIPWRAP=OFF
	)

	cmake_src_configure
}

src_test() {
	cd "${S}" || die
	"${EPYTHON}" "${S}"/test/zziptests.py \
		--downloads=no \
		--verbose \
		--topsrcdir "${S}" \
		--bindir "$(realpath --relative-to="${S}" "${BUILD_DIR}"/bins)" \
		--downloaddir "${WORKDIR}"/${PN}-${TEST_PV}-testdata \
		--testdatadir "${T}"/testdata.d \
	|| die "Tests failed with ${EPYTHON}"
}