summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szuba <marecki@gentoo.org>2021-05-17 14:57:07 +0200
committerMarek Szuba <marecki@gentoo.org>2021-05-17 14:58:44 +0200
commit5c80fe109a9f39146e37ad4fa4bbfd809d72e4ce (patch)
tree0dc33d43694906f6b31b03ecb79c1d3f4d87bd90 /sys-apps
parentnet-mail/rss2email: 3.13.1 (diff)
downloadgentoo-5c80fe109a9f39146e37ad4fa4bbfd809d72e4ce.tar.gz
gentoo-5c80fe109a9f39146e37ad4fa4bbfd809d72e4ce.tar.bz2
gentoo-5c80fe109a9f39146e37ad4fa4bbfd809d72e4ce.zip
sys-apps/flashrom: migrate the live ebuild to Meson
Signed-off-by: Marek Szuba <marecki@gentoo.org>
Diffstat (limited to 'sys-apps')
-rw-r--r--sys-apps/flashrom/files/flashrom-9999_meson-fixes.patch263
-rw-r--r--sys-apps/flashrom/flashrom-9999.ebuild119
2 files changed, 322 insertions, 60 deletions
diff --git a/sys-apps/flashrom/files/flashrom-9999_meson-fixes.patch b/sys-apps/flashrom/files/flashrom-9999_meson-fixes.patch
new file mode 100644
index 000000000000..64d2cebff546
--- /dev/null
+++ b/sys-apps/flashrom/files/flashrom-9999_meson-fixes.patch
@@ -0,0 +1,263 @@
+--- a/meson.build
++++ b/meson.build
+@@ -2,7 +2,7 @@ project('flashromutils', 'c',
+ version : run_command('util/getversion.sh', '-v').stdout().strip(),
+ license : 'GPL-2.0',
+ meson_version : '>=0.50.0',
+- default_options : ['warning_level=2', 'c_std=c99'],
++ default_options : ['warning_level=2', 'c_std=gnu99'],
+ )
+
+ # libtool versioning
+@@ -74,6 +74,10 @@ cargs = []
+ deps = []
+ srcs = []
+
++config_bitbang_spi = false
++need_libftdi = false
++need_libpci = false
++need_libusb = false
+ need_raw_access = false
+ need_serial = false
+
+@@ -88,27 +92,25 @@ if cc.check_header('sys/utsname.h')
+ add_project_arguments('-DHAVE_UTSNAME=1', language : 'c')
+ endif
+
+-# some programmers require libusb
+-if get_option('usb')
+- srcs += 'usbdev.c'
+- srcs += 'usb_device.c'
+- deps += dependency('libusb-1.0')
+-else
++if get_option('no_libftdi_programmers')
++ message('Disabling ALL libftdi-based programmers')
++ config_ft2232_spi = false
++ config_usbblaster_spi = false
++endif
++
++if get_option('no_libusb_programmers')
++ message('Disabling ALL libusb-based programmers')
+ config_ch341a_spi = false
+ config_dediprog = false
+ config_digilent_spi = false
+ config_developerbox_spi = false
+ config_pickit2_spi = false
+ config_raiden_debug_spi = false
++ config_stlinkv3_spi = false
+ endif
+
+-# some programmers require libpci
+-if get_option('pciutils')
+- srcs += 'pcidev.c'
+- deps += dependency('libpci')
+- need_raw_access = true
+- cargs += '-DNEED_PCI=1'
+-else
++if get_option('no_libpci_programmers')
++ message('Disabling ALL libpci-based programmers')
+ config_atahpt = false
+ config_atapromise = false
+ config_atavia = false
+@@ -130,14 +132,17 @@ endif
+ # set defines for configured programmers
+ if config_atahpt
+ srcs += 'atahpt.c'
++ need_libpci = true
+ cargs += '-DCONFIG_ATAHPT=1'
+ endif
+ if config_atapromise
+ srcs += 'atapromise.c'
++ need_libpci = true
+ cargs += '-DCONFIG_ATAPROMISE=1'
+ endif
+ if config_atavia
+ srcs += 'atavia.c'
++ need_libpci = true
+ cargs += '-DCONFIG_ATAVIA=1'
+ endif
+ if config_buspirate_spi
+@@ -147,18 +152,22 @@ if config_buspirate_spi
+ endif
+ if config_ch341a_spi
+ srcs += 'ch341a_spi.c'
++ need_libusb = true
+ cargs += '-DCONFIG_CH341A_SPI=1'
+ endif
+ if config_dediprog
+ srcs += 'dediprog.c'
++ need_libusb = true
+ cargs += '-DCONFIG_DEDIPROG=1'
+ endif
+ if config_developerbox_spi
+ srcs += 'developerbox_spi.c'
++ need_libusb = true
+ cargs += '-DCONFIG_DEVELOPERBOX_SPI=1'
+ endif
+ if config_digilent_spi
+ srcs += 'digilent_spi.c'
++ need_libusb = true
+ cargs += '-DCONFIG_DIGILENT_SPI=1'
+ endif
+ if config_jlink_spi
+@@ -168,6 +177,7 @@ if config_jlink_spi
+ endif
+ if config_drkaiser
+ srcs += 'drkaiser.c'
++ need_libpci = true
+ cargs += '-DCONFIG_DRKAISER=1'
+ endif
+ if config_dummy
+@@ -176,16 +186,18 @@ if config_dummy
+ endif
+ if config_ft2232_spi
+ srcs += 'ft2232_spi.c'
++ need_libftdi = true
+ cargs += '-DCONFIG_FT2232_SPI=1'
+- deps += dependency('libftdi1')
+ cargs += '-DHAVE_FT232H=1'
+ endif
+ if config_gfxnvidia
+ srcs += 'gfxnvidia.c'
++ need_libpci = true
+ cargs += '-DCONFIG_GFXNVIDIA=1'
+ endif
+ if config_raiden_debug_spi
+ srcs += 'raiden_debug_spi.c'
++ need_libusb = true
+ cargs += '-DCONFIG_RAIDEN_DEBUG_SPI=1'
+ endif
+ if config_internal
+@@ -204,6 +216,7 @@ if config_internal
+ srcs += 'sb600spi.c'
+ srcs += 'wbsio_spi.c'
+ endif
++ need_libpci = true
+ config_bitbang_spi = true
+ cargs += '-DCONFIG_INTERNAL=1'
+ if get_option('config_internal_dmi')
+@@ -217,6 +230,7 @@ if config_ene_lpc
+ endif
+ if config_it8212
+ srcs += 'it8212.c'
++ need_libpci = true
+ cargs += '-DCONFIG_IT8212=1'
+ endif
+ if config_linux_mtd
+@@ -237,36 +251,44 @@ if config_mstarddc_spi
+ endif
+ if config_nic3com
+ srcs += 'nic3com.c'
++ need_libpci = true
+ cargs += '-DCONFIG_NIC3COM=1'
+ endif
+ if config_nicintel
+ srcs += 'nicintel.c'
++ need_libpci = true
+ cargs += '-DCONFIG_NICINTEL=1'
+ endif
+ if config_nicintel_eeprom
+ srcs += 'nicintel_eeprom.c'
++ need_libpci = true
+ cargs += '-DCONFIG_NICINTEL_EEPROM=1'
+ endif
+ if config_nicintel_spi
+ srcs += 'nicintel_spi.c'
++ need_libpci = true
+ config_bitbang_spi = true
+ cargs += '-DCONFIG_NICINTEL_SPI=1'
+ endif
+ if config_nicnatsemi
+ srcs += 'nicnatsemi.c'
++ need_libpci = true
+ cargs += '-DCONFIG_NICNATSEMI=1'
+ endif
+ if config_nicrealtek
+ srcs += 'nicrealtek.c'
++ need_libpci = true
+ cargs += '-DCONFIG_NICREALTEK=1'
+ endif
+ if config_ogp_spi
+ config_bitbang_spi = true
+ srcs += 'ogp_spi.c'
++ need_libpci = true
+ cargs += '-DCONFIG_OGP_SPI=1'
+ endif
+ if config_pickit2_spi
+ srcs += 'pickit2_spi.c'
++ need_libusb = true
+ cargs += '-DCONFIG_PICKIT2_SPI=1'
+ endif
+ if config_pony_spi
+@@ -283,10 +305,12 @@ if config_rayer_spi
+ endif
+ if config_satamv
+ srcs += 'satamv.c'
++ need_libpci = true
+ cargs += '-DCONFIG_SATAMV=1'
+ endif
+ if config_satasii
+ srcs += 'satasii.c'
++ need_libpci = true
+ cargs += '-DCONFIG_SATASII=1'
+ endif
+ if config_serprog
+@@ -296,10 +320,12 @@ if config_serprog
+ endif
+ if config_usbblaster_spi
+ srcs += 'usbblaster_spi.c'
++ need_libftdi = true
+ cargs += '-DCONFIG_USBBLASTER_SPI=1'
+ endif
+ if config_stlinkv3_spi
+ srcs += 'stlinkv3_spi.c'
++ need_libusb = true
+ cargs += '-DCONFIG_STLINKV3_SPI=1'
+ endif
+ if config_lspcon_i2c_spi
+@@ -322,6 +348,26 @@ if host_machine.system() == 'linux'
+ cargs += '-DCONFIG_I2C_SUPPORT=1'
+ endif
+
++# some programmers require libftdi
++if need_libftdi
++ deps += dependency('libftdi1')
++endif
++
++# some programmers require libpci
++if need_libpci
++ srcs += 'pcidev.c'
++ deps += dependency('libpci')
++ need_raw_access = true
++ cargs += '-DNEED_PCI=1'
++endif
++
++# some programmers require libusb
++if need_libusb
++ srcs += 'usbdev.c'
++ srcs += 'usb_device.c'
++ deps += dependency('libusb-1.0')
++endif
++
+ # raw memory, MSR or PCI port I/O access
+ if need_raw_access
+ srcs += 'hwaccess.c'
+@@ -335,6 +381,7 @@ if need_serial
+ srcs += 'serial.c'
+ endif
+
++
+ prefix = get_option('prefix')
+ sbindir = join_paths(prefix, get_option('sbindir'))
+ libdir = join_paths(prefix, get_option('libdir'))
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -1,5 +1,6 @@
+-option('pciutils', type : 'boolean', value : true, description : 'use pciutils')
+-option('usb', type : 'boolean', value : true, description : 'use libusb1')
++option('no_libftdi_programmers', type : 'boolean', value : false, description : 'disable all programmers depending on libftdi')
++option('no_libpci_programmers', type : 'boolean', value : false, description : 'disable all programmers depending on libpci')
++option('no_libusb_programmers', type : 'boolean', value : false, description : 'disable all programmers depending on libusb')
+ option('print_wiki', type : 'boolean', value : true, description : 'Print Wiki')
+
+ option('config_atahpt', type : 'boolean', value : false, description : 'Highpoint (HPT) ATA/RAID controllers')
diff --git a/sys-apps/flashrom/flashrom-9999.ebuild b/sys-apps/flashrom/flashrom-9999.ebuild
index fe588c7916e0..293b7023f216 100644
--- a/sys-apps/flashrom/flashrom-9999.ebuild
+++ b/sys-apps/flashrom/flashrom-9999.ebuild
@@ -3,7 +3,8 @@
EAPI=7
-inherit toolchain-funcs
+inherit meson
+
if [[ ${PV} == "9999" ]] ; then
EGIT_REPO_URI="https://review.coreboot.org/flashrom.git"
inherit git-r3
@@ -19,12 +20,11 @@ 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.
+
+# The defaults match the upstream meson_options.txt.
IUSE_PROGRAMMERS="
atahpt
- +atapromise
+ atapromise
+atavia
+buspirate-spi
+ch341a-spi
@@ -59,11 +59,10 @@ IUSE_PROGRAMMERS="
+satamv
+satasii
+serprog
- stlinkv3-spi
+ +stlinkv3-spi
+usbblaster-spi
"
-
-IUSE="${IUSE_PROGRAMMERS} +internal-dmi static tools +wiki"
+IUSE="${IUSE_PROGRAMMERS} +internal-dmi tools +wiki"
LIB_DEPEND="
atahpt? ( sys-apps/pciutils[static-libs(+)] )
@@ -87,74 +86,74 @@ LIB_DEPEND="
nicrealtek? ( sys-apps/pciutils[static-libs(+)] )
ogp-spi? ( sys-apps/pciutils[static-libs(+)] )
pickit2-spi? ( virtual/libusb:0[static-libs(+)] )
+ raiden-debug-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:1=[static-libs(+)] )
"
-RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )"
+RDEPEND="${LIB_DEPEND//\[static-libs(+)]}"
DEPEND="${RDEPEND}
- static? ( ${LIB_DEPEND} )
sys-apps/diffutils"
-BDEPEND="virtual/pkgconfig"
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
-}
+DOCS=( README Documentation/ )
-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
+PATCHES=(
+ "${FILESDIR}"/${PN}-9999_meson-fixes.patch
+)
- tc-export AR CC PKG_CONFIG RANLIB
- emake WARNERROR=no "${args[@]}" all libflashrom.a
+src_configure() {
+ local emesonargs=(
+ $(meson_use atahpt config_atahpt)
+ $(meson_use atapromise config_atapromise)
+ $(meson_use atavia config_atavia)
+ $(meson_use buspirate-spi config_buspirate_spi)
+ $(meson_use ch341a-spi config_ch341a_spi)
+ $(meson_use dediprog config_dediprog)
+ $(meson_use developerbox-spi config_developerbox_spi)
+ $(meson_use digilent-spi config_digilent_spi)
+ $(meson_use drkaiser config_drkaiser)
+ $(meson_use dummy config_dummy)
+ $(meson_use ene-lpc config_ene_lpc)
+ $(meson_use ft2232-spi config_ft2232_spi)
+ $(meson_use gfxnvidia config_gfxnvidia)
+ $(meson_use internal config_internal)
+ $(meson_use internal-dmi config_internal_dmi)
+ $(meson_use it8212 config_it8212)
+ $(meson_use jlink-spi config_jlink_spi)
+ $(meson_use linux-mtd config_linux_mtd)
+ $(meson_use linux-spi config_linux_spi)
+ $(meson_use lspcon-i2c-spi config_lspcon_i2c_spi)
+ $(meson_use mec1308 config_mec1308)
+ $(meson_use mstarddc-spi config_mstarddc_spi)
+ $(meson_use nic3com config_nic3com)
+ $(meson_use nicintel-eeprom config_nicintel_eeprom)
+ $(meson_use nicintel-spi config_nicintel_spi)
+ $(meson_use nicintel config_nicintel)
+ $(meson_use nicnatsemi config_nicnatsemi)
+ $(meson_use nicrealtek config_nicrealtek)
+ $(meson_use ogp-spi config_ogp_spi)
+ $(meson_use pickit2-spi config_pickit2_spi)
+ $(meson_use pony-spi config_pony_spi)
+ $(meson_use raiden-debug-spi config_raiden_debug_spi)
+ $(meson_use rayer-spi config_rayer_spi)
+ $(meson_use realtek-mst-i2c-spi config_realtek_mst_i2c_spi)
+ $(meson_use satamv config_satamv)
+ $(meson_use satasii config_satasii)
+ $(meson_use stlinkv3-spi config_stlinkv3_spi)
+ $(meson_use serprog config_serprog)
+ $(meson_use usbblaster-spi config_usbblaster_spi)
+ $(meson_use wiki print_wiki)
+ )
+ meson_src_configure
}
src_install() {
- dosbin flashrom
- doman flashrom.8
- dodoc README Documentation/*.txt
- dolib.a libflashrom.a
- doheader libflashrom.h
+ meson_src_install
if use tools; then
- dosbin util/ich_descriptors_tool/ich_descriptors_tool
+ dosbin "${BUILD_DIR}"/util/ich_descriptors_tool/ich_descriptors_tool
fi
}