aboutsummaryrefslogtreecommitdiff
blob: d7eeab069abbaa312a7363fdfb3f06680eecd48f (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
77
78
79
80
81
82
83
84
85
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit autotools flag-o-matic

DESCRIPTION="A text-based widget toolkit"
HOMEPAGE="https://github.com/gansm/finalcut/"

if [[ "${PV}" = 9999 ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/gansm/finalcut.git"
else
	SRC_URI="https://github.com/gansm/finalcut/archive/${PV}.tar.gz -> ${P}.tar.gz"
	KEYWORDS="~amd64"
fi

LICENSE="LGPL-3+"
SLOT="0/${PV}"
IUSE="doc examples +gpm static-libs test"
REQUIRED_USE="test? ( !examples )"
RESTRICT="!test? ( test )"

DEPEND="
	sys-libs/ncurses:=[tinfo]
	gpm? ( sys-libs/gpm )
"

BDEPEND="
	virtual/pkgconfig
	test? ( >=dev-util/cppunit-1.12.0 )
"

RDEPEND="${DEPEND}"

src_prepare() {
	default

	[[ "${PV}" = 9999 ]] || eapply "${FILESDIR}/${P}-fix-tests.ebuild"

	sed -i "/AM_CPPFLAGS/ s/-Werror//" {examples,final,test}/Makefile.am \
		|| die 'Failed to remove `-Werror` from `CPPFLAGS`'

	for component in doc examples test; do
		if ! use "${component}"; then
			sed -i "/SUBDIRS/ s/${component}//" Makefile.am \
				|| die "Failed to remove ${component} from the building process"
		fi
	done

	eautoreconf
}

src_configure() {
	use test && append-cxxflags -O0 -DDEBUG -DUNIT_TEST

	econf \
		$(use_enable static-libs static) \
		$(use_with gpm) \
		$(use_with test unit-test)
}

src_install() {
	emake DESTDIR="${ED}" PACKAGE="${PF}" install
	dodoc CODE_OF_CONDUCT.md Contributing.md SECURITY.md

	if use examples; then
			local examples="/usr/share/doc/${PF}/examples"
			docompress -x "${examples}"

			for example in examples/.libs/*; do
					example="${example#examples/.libs/}"

					local install_dir="${examples}/${example}"

					insinto "${install_dir}"
					doins "examples/${example}.cpp"
					exeinto "${install_dir}"
					doexe "examples/${example}"
			done
	fi

	find "${ED}" -name "*.la" -delete || die
}