sys-apps/flashrom: bump to 1.2
authorMarek Szuba <marecki@gentoo.org>
Mon, 30 Mar 2020 22:31:59 +0000 (23:31 +0100)
committerMarek Szuba <marecki@gentoo.org>
Mon, 30 Mar 2020 22:40:10 +0000 (23:40 +0100)
Turns out the Meson scripts are incomplete for now (e.g. no libftdi
dependency for usbblaster-spi in spite of the source code referencing
the relevant header files, no jlink-spi support) so let us continue to
use the Makefiles.

Closes: https://bugs.gentoo.org/712500
Closes: https://bugs.gentoo.org/709986
Closes: https://bugs.gentoo.org/707304
Signed-off-by: Marek Szuba <marecki@gentoo.org>
sys-apps/flashrom/Manifest
sys-apps/flashrom/flashrom-1.2.ebuild [new file with mode: 0644]

index 446fed63d465b6c4cbc1dfadb7f9f15706cf3e7f..227d29704d854e363ab4265896de754ffb3b6780 100644 (file)
@@ -1,3 +1,4 @@
 DIST flashrom-0.9.8.tar.bz2 473902 BLAKE2B c127a41c2857ae2e1564777b49b1eff17e2e931c8a2417e738e8188871a6ce4e0fe6a0380c2139aaa906f299ca833563df895aa5fd1af333b24bf7467de0dc8f SHA512 1a1c4513bac7cdf91326ab68b822034101e688bfab0dc0b5698f664fc766027229128c55eed94f302cac05d949647cdec6a103a423c3861b047cf0ff7cc0b509
 DIST flashrom-1.0.tar.bz2 321693 BLAKE2B 7e3e021cdf639083717ca30d5268ac9e02eb8b68e54bbcd5caf9de4352f332ba0ab23cf22253f0627fa9c9a0472404fff44cda17e8c306fe4f93b2b1f0563718 SHA512 355ac1322421b2fd699deb0ceff8555c9e89062e639de674c62f1fdacad9ed9351fe89e4c14e22f07a6d4e2e2f070fd4d2ed1cd347a20069f2505966b5c29e0e
 DIST flashrom-v1.1.tar.bz2 348458 BLAKE2B cee1b8e4f680739e794239c3d777ef9cf0af1f734fe4d8f4b122d26316cdb8d45d53f92054937c7cde1737364ba8ed80410561bfbb7f304b0371942be144859b SHA512 8cb75a7223490fa9dbd65a85d24a87beab68ee03120891a3d8ebf4e8bc3d2a2ee640e254ccff657eaf5175e6c2477288337369fa1b1dac110a0903b0c95c1e56
+DIST flashrom-v1.2.tar.bz2 366995 BLAKE2B 091e01a91e12b486154ace334a5e74bccbb5f5311ad76e37f43a28167080757873d8c78b8f549d2e77eb984922c830895ba955b23eb6ee4fc24f1ffed259954b SHA512 8e01395a54d0d1344bc55e7e4975f43bb8e59ebe83fb5f2766d14f76756d718b487254ce9a19ef4093aed04fb9d40fff5fe8f709b18c512f6e6fad894f83d7b8
diff --git a/sys-apps/flashrom/flashrom-1.2.ebuild b/sys-apps/flashrom/flashrom-1.2.ebuild
new file mode 100644 (file)
index 0000000..b51635e
--- /dev/null
@@ -0,0 +1,154 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit 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 )"
+
+_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_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
+       emake WARNERROR=no "${args[@]}" all libflashrom.a
+}
+
+src_install() {
+       dosbin flashrom
+       doman flashrom.8
+       dodoc README Documentation/*.txt
+       dolib.a libflashrom.a
+       doheader libflashrom.h
+
+       if use tools; then
+               dosbin util/ich_descriptors_tool/ich_descriptors_tool
+       fi
+}