summaryrefslogtreecommitdiff
blob: a1703c043d39ddddfe203eed8ce7974801032896 (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
71
72
73
74
75
76
# Copyright 2020-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit cmake gnome2-utils

DESCRIPTION="Library for encoding and decoding .avif files"
HOMEPAGE="https://github.com/AOMediaCodec/libavif"
SRC_URI="https://github.com/AOMediaCodec/libavif/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="BSD-2"
# See bug #822336 re subslot
SLOT="0/${PV}"
KEYWORDS="amd64 ~arm arm64 ~ppc64 x86"
IUSE="+aom dav1d examples extras gdk-pixbuf rav1e"

DEPEND="media-libs/libpng
	sys-libs/zlib
	virtual/jpeg
	aom? ( >=media-libs/libaom-2.0.0 )
	dav1d? ( media-libs/dav1d )
	gdk-pixbuf? ( x11-libs/gdk-pixbuf:2 )
	rav1e? ( media-video/rav1e[capi] )"
RDEPEND="${DEPEND}"
BDEPEND="virtual/pkgconfig"

REQUIRED_USE="|| ( aom dav1d )"

src_configure() {
	local mycmakeargs=(
		-DBUILD_SHARED_LIBS=ON
		-DAVIF_CODEC_AOM=$(usex aom ON OFF)
		-DAVIF_CODEC_DAV1D=$(usex dav1d ON OFF)
		-DAVIF_CODEC_LIBGAV1=OFF
		-DAVIF_CODEC_RAV1E=$(usex rav1e ON OFF)

		# Use system libraries.
		-DAVIF_LOCAL_ZLIBPNG=OFF
		-DAVIF_LOCAL_JPEG=OFF

		-DAVIF_BUILD_EXAMPLES=$(usex examples ON OFF)
		-DAVIF_BUILD_APPS=$(usex extras ON OFF)
		-DAVIF_BUILD_TESTS=$(usex extras ON OFF)

		-DAVIF_BUILD_GDK_PIXBUF=$(usex gdk-pixbuf ON OFF)

		-DAVIF_ENABLE_WERROR=OFF
	)

	cmake_src_configure
}

pkg_preinst() {
	if use gdk-pixbuf ; then
		gnome2_gdk_pixbuf_savelist
	fi
}

pkg_postinst() {
	if ! use aom && ! use rav1e ; then
		ewarn "aom and rav1e flags are not set,"
		ewarn "libavif will work in read-only mode."
		ewarn "Enable aom or rav1e flag if you want to save .AVIF files."
	fi

	if use gdk-pixbuf ; then
		gnome2_gdk_pixbuf_update
	fi
}

pkg_postrm() {
	if use gdk-pixbuf ; then
		gnome2_gdk_pixbuf_update
	fi
}