summaryrefslogtreecommitdiffstats
path: root/dev-libs/libr/libr-14.1.2.ebuild
blob: 6eac00539c3d6ed4f45b8373d97a14528dade036 (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
# Copyright 1999-2024 Gentoo Authors
# Copyright 2020-2024 The Trinity Desktop Project
# Distributed under the terms of the GNU General Public License v2

EAPI="8"

TRINITY_MODULE_TYPE="dependencies"
TRINITY_MODULE_NAME="libr"
inherit trinity-base-2

DESCRIPTION="ELF resource access and editing library"
HOMEPAGE="https://trinitydesktop.org/"

LICENSE="LGPL-2.1"
SLOT="0"
if [[ ${PV} != *9999* ]] ; then
	KEYWORDS="~amd64 ~arm64 ~x86"
fi
IUSE="+bfd elf gtk man"
REQUIRED_USE="?? ( bfd elf )"

RDEPEND="
	sys-libs/zlib:=
	bfd? ( sys-libs/binutils-libs:= )
	elf? ( virtual/libelf:= )
"
DEPEND="${RDEPEND}
	gtk? ( x11-libs/gtk+:2 )
"
# NOTE: gtk uses weak linkage, so it's not necessary during runtime
BDEPEND="man? ( app-text/doxygen )"

pkg_setup() {
	if ! use bfd && ! use elf; then
		ewarn "You haven't selected nor \"bfd\" nor \"elf\" as a backend"
		ewarn "a fallback read-only implementation will be used to"
		ewarn "access elf resources, but modification of elf files will"
		ewarn "be unavailable."
	fi
}

src_prepare() {
	trinity-base-2_src_prepare

	if ! use man; then
		rm -rf man || die
	fi
}

src_configure() {
	local mycmakeargs=(
		-DWITH_BACKEND_LIBBFD=$(usex bfd)
		-DWITH_BACKEND_LIBELF=$(usex elf)
		-DWITH_BACKEND_READONLY=$( (! use bfd && ! use elf) && echo yes || echo no )
		-DWITH_GTK=$(usex gtk)
	)

	cmake_src_configure
}