summaryrefslogtreecommitdiff
path: root/app-misc/blink1/blink1-1.98-r3.ebuild
blob: 418691a46207e530c3477907501139d63dfc782b (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
86
87
88
89
90
91
92
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit linux-info toolchain-funcs

DESCRIPTION="blink(1) USB RGB LED status light control suite"
HOMEPAGE="https://blink1.thingm.com/"
SRC_URI="https://github.com/todbot/blink1/archive/v${PV}.tar.gz -> ${P}.tar.gz"
S=${WORKDIR}/${P}

LICENSE="CC-BY-SA-3.0"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc examples +tool mini-tool server"
REQUIRED_USE="|| ( tool mini-tool server )"

RDEPEND="
	dev-libs/hidapi
	sys-apps/attr
	sys-libs/libcap
	virtual/libudev
	virtual/libusb:1
	mini-tool? ( virtual/libusb:0 )
"
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig"

PATCHES=(
	"${FILESDIR}/${P}-ldflags.patch"
)

pkg_setup() {
	local CONFIG_CHECK="USB_HID"
	linux-info_pkg_setup
}

src_compile() {
	tc-export CC
	if use tool; then
		pushd commandline &>/dev/null
		# USBLIB_TYPE=HIDAPI
		# USBLIB_TYPE=HIDAPI_HIDRAW
		# USBLIB_TYPE=HIDDATA
		emake OS=linux USBLIB_TYPE=HIDAPI blink1-tool
		popd &>/dev/null
	fi

	if use mini-tool; then
		pushd commandline/blink1-mini-tool &>/dev/null
		emake OS=linux blink1-mini-tool
		popd &>/dev/null
	fi

	if use server; then
		pushd commandline &>/dev/null
		emake OS=linux blink1-tiny-server
		popd &>/dev/null
	fi
}

src_install() {
	if use doc; then
		dodoc docs/README.md
	fi

	if use server; then
		if use doc; then
			dodoc docs/{app-url-api.md,app-url-api-examples.md}
		fi

		dobin commandline/blink1-tiny-server
	fi

	if use tool; then
		if use doc; then
			dodoc docs/{blink1-tool.md,blink1-tool-tips.md,blink1-hid-commands.md,blink1-mk2-tricks.md}
		fi

		if use examples; then
			docinto examples
			dodoc commandline/scripts/{README.md,blink1-*.sh}
		fi

		dobin commandline/blink1-tool
	fi

	if use mini-tool; then
		dobin commandline/blink1-mini-tool/blink1-mini-tool
	fi
}