summaryrefslogtreecommitdiff
blob: 54727cd8b9ec472966459b4d846c0f4184d13835 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/flashrom/flashrom-0.9.1.ebuild,v 1.1 2010/01/28 20:04:28 idl0r Exp $

EAPI="2"

inherit flag-o-matic toolchain-funcs

DESCRIPTION="Utility for reading, writing, erasing and verifying flash ROM chips"
HOMEPAGE="http://flashrom.org"
SRC_URI="http://qa.coreboot.org/releases/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="ftdi serprog"

RDEPEND="sys-apps/pciutils
	ftdi? ( dev-embedded/libftdi )"
DEPEND="${RDEPEND}
	sys-apps/sed"

src_prepare() {
	# We don't need zlib here
	# Disable auto-deps
	sed -i -e 's:^LIBS +=.*:LIBS += -lpci:' \
		-e 's/^all:.*/all: dep $(PROGRAM)/' \
		-e 's/^\.features:.*/\.features:/' \
		Makefile || die
}

src_compile() {
	if use ftdi;
	then
		append-cflags "-DFT2232_SPI_SUPPORT=1"
		export LIBS="-lftdi"
	fi
	if use serprog;
	then
		append-cflags "-DSERPROG_SUPPORT=1"
	fi

	# Get a rid of "grep: .features: No such file or directory" warnings
	touch .features

	emake CC="$(tc-getCC)" STRIP="" || die "emake failed"
}

src_install() {
	dosbin flashrom || die
	doman flashrom.8 || die
	dodoc ChangeLog README
}