summaryrefslogtreecommitdiff
path: root/x11-misc/clipmenu/clipmenu-9999.ebuild
blob: 8b2d019babe62123f88dab4935f6a92596b16014 (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
# Copyright 2020-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit git-r3 systemd

DESCRIPTION="Clipboard management"
HOMEPAGE="https://github.com/cdown/clipmenu"

if [[ ${PV} == "9999" ]] ; then
	EGIT_REPO_URI="https://github.com/cdown/clipmenu"
	EGIT_BRANCH="develop"
else
	SRC_URI="https://github.com/cdown/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
	KEYWORDS="amd64 x86"
fi

LICENSE="MIT"
SLOT="0"
IUSE="+dmenu fzf rofi test"
REQUIRED_USE="?? ( dmenu fzf rofi )"
RESTRICT="!test? ( test )"

DEPEND="
	x11-libs/libX11
	x11-libs/libXfixes
"

RDEPEND="
	${DEPEND}
	dmenu? ( x11-misc/dmenu )
	fzf? ( app-shells/fzf )
	rofi? ( x11-misc/rofi )
"

src_prepare() {
	default

	if use rofi ; then
		sed -i 's|"dmenu"|"rofi"|g' src/config.c || die "sed failed"
	elif use fzf ; then
		sed -i 's|"dmenu"|"fzf"|g'  src/config.c || die "sed failed"
	fi
}

src_compile() {
	emake CFLAGS="${CFLAGS}"
	use test && emake CFLAGS="${CFLAGS}" tests/test_store
}

src_install() {
	emake install DESTDIR="${D}" PREFIX="${EPREFIX}"/usr \
		systemd_user_dir="${D}/$(systemd_get_userunitdir)"

	einstalldocs
}

src_test() {
	# NOTE(NRK): the "x_integration_tests" are not enabled as they would
	# require additional setup and dependencies
	emake tests
}

pkg_postinst() {
	if systemd_is_booted || has_version sys-apps/systemd; then
		einfo ""
		einfo "Make sure to import \$DISPLAY when using the systemd unit for clipmenud."
		einfo "Please see the README for more details."
	fi

	if ! use dmenu && ! use fzf && ! use rofi ; then
		ewarn ""
		ewarn "Clipmenu has been installed without a launcher."
		ewarn "You will need to set \$CM_LAUNCHER to a dmenu-compatible app for clipmenu to work."
		ewarn "Please refer to the documents for more info."
	fi
}