blob: ae710e470315b9b7f2f5b7f2c28392abb1b12bdd (
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit flag-o-matic toolchain-funcs
if [[ ${PV} == "9999" ]] ; then
EGIT_REPO_URI="https://review.coreboot.org/flashrom.git"
inherit git-r3
else
MY_P="${PN}-v${PV}"
SRC_URI="https://download.flashrom.org/releases/${MY_P}.tar.bz2"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86"
S="${WORKDIR}/${MY_P}"
fi
DESCRIPTION="Utility for reading, writing, erasing and verifying flash ROM chips"
HOMEPAGE="https://flashrom.org/"
LICENSE="GPL-2"
SLOT="0"
# The defaults match the upstream Makefile.
# Note: Do not list bitbang_spi as it is not a programmer; it's a backend used
# by some other spi programmers.
IUSE_PROGRAMMERS="
atahpt
+atapromise
+atavia
+buspirate-spi
+ch341a-spi
+dediprog
+developerbox-spi
+digilent-spi
+drkaiser
+dummy
+ft2232-spi
+gfxnvidia
+internal
+it8212
jlink-spi
+linux-mtd
+linux-spi
mstarddc-spi
+nic3com
+nicintel
+nicintel-eeprom
+nicintel-spi
nicnatsemi
+nicrealtek
+ogp-spi
+pickit2-spi
+pony-spi
+rayer-spi
+satamv
+satasii
+serprog
stlinkv3-spi
+usbblaster-spi
"
IUSE="${IUSE_PROGRAMMERS} +internal-dmi static tools +wiki"
LIB_DEPEND="
atahpt? ( sys-apps/pciutils[static-libs(+)] )
atapromise? ( sys-apps/pciutils[static-libs(+)] )
atavia? ( sys-apps/pciutils[static-libs(+)] )
ch341a-spi? ( virtual/libusb:1[static-libs(+)] )
dediprog? ( virtual/libusb:1[static-libs(+)] )
developerbox-spi? ( virtual/libusb:1[static-libs(+)] )
digilent-spi? ( virtual/libusb:1[static-libs(+)] )
drkaiser? ( sys-apps/pciutils[static-libs(+)] )
ft2232-spi? ( dev-embedded/libftdi:=[static-libs(+)] )
gfxnvidia? ( sys-apps/pciutils[static-libs(+)] )
internal? ( sys-apps/pciutils[static-libs(+)] )
it8212? ( sys-apps/pciutils[static-libs(+)] )
jlink-spi? ( dev-embedded/libjaylink[static-libs(+)] )
nic3com? ( sys-apps/pciutils[static-libs(+)] )
nicintel-eeprom? ( sys-apps/pciutils[static-libs(+)] )
nicintel-spi? ( sys-apps/pciutils[static-libs(+)] )
nicintel? ( sys-apps/pciutils[static-libs(+)] )
nicnatsemi? ( sys-apps/pciutils[static-libs(+)] )
nicrealtek? ( sys-apps/pciutils[static-libs(+)] )
ogp-spi? ( sys-apps/pciutils[static-libs(+)] )
pickit2-spi? ( virtual/libusb:0[static-libs(+)] )
rayer-spi? ( sys-apps/pciutils[static-libs(+)] )
satamv? ( sys-apps/pciutils[static-libs(+)] )
satasii? ( sys-apps/pciutils[static-libs(+)] )
stlinkv3-spi? ( virtual/libusb:1[static-libs(+)] )
usbblaster-spi? ( dev-embedded/libftdi:=[static-libs(+)] )
"
RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )"
DEPEND="${RDEPEND}
static? ( ${LIB_DEPEND} )
sys-apps/diffutils"
RDEPEND+=" !internal-dmi? ( sys-apps/dmidecode )"
PATCHES=(
"${FILESDIR}"/${PN}-1.2_make-libflashrom-usable.patch
)
_flashrom_enable() {
local c="CONFIG_${2:-$(echo "$1" | tr '[:lower:]-' '[:upper:]_')}"
args+=( "${c}=$(usex $1 yes no)" )
}
flashrom_enable() {
local u
for u ; do _flashrom_enable "${u}" ; done
}
src_prepare() {
# To make libflashrom.a actually useful
append-flags -fPIC
default
}
src_compile() {
# Help keep things in sync.
local sprogs=$(echo $(
grep -o 'CONFIG_[A-Z0-9_]*' flashrom.c | \
LC_ALL=C sort -u | \
sed 's:^CONFIG_::' | \
tr '[:upper:]_' '[:lower:]-' | \
grep -v ni845x-spi))
local eprogs=$(echo ${IUSE_PROGRAMMERS} | sed -E 's/\B[-+]\b//g')
if [[ ${sprogs} != "${eprogs}" ]] ; then
eerror "The ebuild needs to be kept in sync."
eerror "IUSE set to: ${eprogs}"
eerror "flashrom.c : ${sprogs}"
die "sync IUSE to the list of source programmers"
fi
# Turn USE flags into CONFIG_xxx settings.
local args=()
flashrom_enable ${eprogs}
_flashrom_enable wiki PRINT_WIKI
_flashrom_enable static STATIC
# You have to specify at least one programmer, and if you specify more than
# one programmer you have to include either dummy or internal in the list.
# We pick dummy as the default because internal requires libpci.
if ! use internal && ! use dummy ; then
if [[ ${#args[@]} -ne 1 ]] ; then
ewarn "You have to specify at least one programmer, and if you specify"
ewarn "more than one programmer, you have to enable either dummy or"
ewarn "internal as well. 'dummy' will be the default now."
args+=( CONFIG_DUMMY=yes )
fi
fi
tc-export AR CC PKG_CONFIG RANLIB
# PREFIX, INCLUDEDIR and LIBDIR are injected into the libflashrom pkgconfig
# file, which is why we pass them here even though src_install() puts all
# files in correct locations without employing make.
# VERSION too goes into the pkgconfig file, and we override the upstream
# value to get rid of the prefix 'v'.
emake \
INCLUDEDIR="include" \
LIBDIR="$(get_libdir)" \
PREFIX="${EPREFIX}/usr" \
VERSION="${PV}" \
WARNERROR=no "${args[@]}" \
all libflashrom.a
}
src_install() {
dosbin flashrom
doman flashrom.8
dodoc README Documentation/*.txt
dolib.a libflashrom.a
doheader libflashrom.h
insinto /usr/$(get_libdir)/pkgconfig
doins ${PN}.pc
if use tools; then
dosbin util/ich_descriptors_tool/ich_descriptors_tool
fi
}
|