8570795e20bd3cbdc7638df4bbcb70b7d0c46a1e
[wtk-overlay.git] / dev-embedded / teensy-loader-cli / teensy-loader-cli-2.0.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="4"
6
7 inherit eutils
8
9 MY_PN="${PN//-/_}"
10 DESCRIPTION="Command line programmer for Teensy microcontrollers"
11 HOMEPAGE="http://pjrc.com/teensy/loader_cli.html"
12 SRC_URI="http://pjrc.com/teensy/${MY_PN}.${PV}.tar.gz"
13
14 LICENSE="GPL-3"
15 SLOT="0"
16 KEYWORDS="~amd64"
17 IUSE="-examples +udev"
18
19 DEPEND="dev-libs/libusb"
20 RDEPEND="$DEPEND"
21
22 S="${WORKDIR}/${MY_PN}"
23
24 pkg_setup() {
25         use udev && enewgroup teensy
26         #groupdel in pkg_postrm()?
27 }
28
29 src_unpack() {
30         unpack ${A}
31         cd "${S}"
32         # Don't strip the binary (remove -s flag)
33         sed -i 's/$(CFLAGS) -s /$(CFLAGS) /' Makefile
34 }
35
36 src_compile() {
37         emake OS=LINUX "CFLAGS=${CFLAGS}" "LDFLAGS=${LDFLAGS}"
38 }
39
40 src_install() {
41         dobin teensy_loader_cli
42         if use examples; then
43                 dodoc *.hex
44         fi
45         if use udev; then
46                 insinto /lib/udev/rules.d
47                 doins "${FILESDIR}/49-teensy.rules"
48         fi
49 }
50
51 pkg_postinst() {
52         if use udev; then
53                 elog "To be able to use Teensy devices, you need to be a"
54                 elog "member of the group 'teensy' which has just been added"
55                 elog "to your system. You can add your user to the group by"
56                 elog "running the following command as root:"
57                 elog
58                 elog "  usermod -a -G teensy youruser"
59                 elog
60                 elog "Please be aware that you need to either re-login or run"
61                 elog
62                 elog "  newgrp - teensy"
63                 elog
64                 elog "for the group membership to take effect."
65         fi
66 }