summaryrefslogtreecommitdiff
blob: 49b45b38c9abbbf2c26719653ff5be4d0adbeed2 (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

DESCRIPTION="Scanner Access Now Easy"
HOMEPAGE="http://www.sane-project.org"
SRC_URI="https://salsa.debian.org/debian/sane-frontends/-/archive/upstream/${PV}/${PN}-upstream-${PV}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 ~arm64 ppc ppc64 sparc x86"
IUSE="gimp gtk"

REQUIRED_USE="gimp? ( gtk )"

DEPEND="
	media-gfx/sane-backends
	gimp? ( media-gfx/gimp:0/2 )
	gtk? (
		dev-libs/glib:2
		x11-libs/gtk+:2
	)
"
RDEPEND="${DEPEND}"

DOCS=( AUTHORS Changelog NEWS PROBLEMS README )

PATCHES=( "${FILESDIR}/MissingCapsFlag.patch" )

S="${WORKDIR}"/"${PN}"-upstream-"${PV}"

src_configure() {
	local myeconfargs=(
		--datadir=/usr/share/misc
		$(use_enable gimp)
		$(use_enable gtk gtk2)
		$(use_enable gtk guis)
	)
	econf "${myeconfargs[@]}"
}

src_install() {
	emake DESTDIR="${D}" install

	# link xscanimage so it is seen as a plugin in gimp
	if use gimp; then
		local plugindir
		if type gimptool &>/dev/null; then
			plugindir="$(gimptool --gimpplugindir)/plug-ins"
		elif type gimptool-2.0 &>/dev/null; then
			plugindir="$(gimptool-2.0 --gimpplugindir)/plug-ins"
		elif type gimptool-2.99 &>/dev/null; then
			plugindir="$(gimptool-2.99 --gimpplugindir)/plug-ins"
		else
			die "Can't find GIMP plugin directory."
		fi
		dodir "${plugindir#${EPREFIX}}"
		dosym ../../../../bin/xscanimage "${plugindir#${EPREFIX}}"/xscanimage
	fi

	einstalldocs
}