summaryrefslogtreecommitdiff
path: root/media-gfx/optipng/optipng-7.9.1.ebuild
blob: 15c29cf64572fe4264aa420e7b5da25b53ac8d95 (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
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake

DESCRIPTION="Recompress PNG files to a smaller size without loss of information"
HOMEPAGE="https://optipng.sourceforge.net/"
SRC_URI="https://downloads.sourceforge.net/${PN}/${P}.tar.gz"

LICENSE="ZLIB"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
IUSE="test"
RESTRICT="!test? ( test )"

RDEPEND="virtual/zlib:=
	media-libs/libpng:0="
DEPEND="${RDEPEND}"

DOCS=( AUTHORS.txt )

src_prepare() {
	rm -R third_party/{libpng,zlib} || die
	sed -i \
		-e 's/^#if defined AT_FDCWD/#if (defined(AT_FDCWD) \&\& !(defined(__SVR4) \&\& defined(__sun)))/' \
		src/optipng/ioutil.c || die
	cmake_src_prepare
}

src_configure() {
	local mycmakeargs=(
		-DOPTIPNG_USE_SYSTEM_LIBS=ON
		-DOPTIPNG_BUILD_TESTS=$(usex test ON OFF)
	)
	cmake_src_configure
}

src_install() {
	cmake_src_install
	dodoc doc/* || die

	# This is https://sourceforge.net/p/optipng/bugs/93/ upstream
	fperms a+x /usr/bin/optipng
}