commit:     79dea382ce9cc55c44b2f9d8d256f1615112eb5c
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 16 15:05:46 2021 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Tue Nov 16 15:05:46 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79dea382

sys-apps/flashrom-9999: do not auto-build tests if cmocka is present

Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 .../flashrom/files/flashrom-9999_meson-fixes.patch | 54 ++++++++++++++++------
 sys-apps/flashrom/flashrom-9999.ebuild             |  2 +-
 2 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/sys-apps/flashrom/files/flashrom-9999_meson-fixes.patch 
b/sys-apps/flashrom/files/flashrom-9999_meson-fixes.patch
index 63c2e2ef7553..7651585f4f6a 100644
--- a/sys-apps/flashrom/files/flashrom-9999_meson-fixes.patch
+++ b/sys-apps/flashrom/files/flashrom-9999_meson-fixes.patch
@@ -9,7 +9,7 @@
  )
  
  # libtool versioning
-@@ -74,6 +74,10 @@ cargs = []
+@@ -105,6 +105,10 @@ cargs = []
  deps = []
  srcs = []
  
@@ -20,7 +20,7 @@
  need_raw_access = false
  need_serial = false
  
-@@ -88,27 +92,25 @@ if cc.check_header('sys/utsname.h')
+@@ -119,27 +123,25 @@ if cc.check_header('sys/utsname.h')
    add_project_arguments('-DHAVE_UTSNAME=1', language : 'c')
  endif
  
@@ -59,7 +59,7 @@
    config_atahpt = false
    config_atapromise = false
    config_atavia = false
-@@ -130,14 +132,17 @@ endif
+@@ -161,14 +163,17 @@ endif
  # set defines for configured programmers
  if config_atahpt
    srcs += 'atahpt.c'
@@ -77,7 +77,7 @@
    cargs += '-DCONFIG_ATAVIA=1'
  endif
  if config_buspirate_spi
-@@ -147,18 +152,22 @@ if config_buspirate_spi
+@@ -178,18 +183,22 @@ if config_buspirate_spi
  endif
  if config_ch341a_spi
    srcs += 'ch341a_spi.c'
@@ -100,7 +100,7 @@
    cargs += '-DCONFIG_DIGILENT_SPI=1'
  endif
  if config_jlink_spi
-@@ -168,6 +177,7 @@ if config_jlink_spi
+@@ -199,6 +208,7 @@ if config_jlink_spi
  endif
  if config_drkaiser
    srcs += 'drkaiser.c'
@@ -108,7 +108,7 @@
    cargs += '-DCONFIG_DRKAISER=1'
  endif
  if config_dummy
-@@ -176,16 +186,18 @@ if config_dummy
+@@ -207,16 +217,18 @@ if config_dummy
  endif
  if config_ft2232_spi
    srcs += 'ft2232_spi.c'
@@ -128,7 +128,7 @@
    cargs += '-DCONFIG_RAIDEN_DEBUG_SPI=1'
  endif
  if config_internal
-@@ -204,6 +216,7 @@ if config_internal
+@@ -235,6 +247,7 @@ if config_internal
      srcs += 'sb600spi.c'
      srcs += 'wbsio_spi.c'
    endif
@@ -136,7 +136,7 @@
    config_bitbang_spi = true
    cargs += '-DCONFIG_INTERNAL=1'
    if get_option('config_internal_dmi')
-@@ -217,6 +230,7 @@ if config_ene_lpc
+@@ -244,6 +257,7 @@ if config_internal
  endif
  if config_it8212
    srcs += 'it8212.c'
@@ -144,7 +144,7 @@
    cargs += '-DCONFIG_IT8212=1'
  endif
  if config_linux_mtd
-@@ -237,36 +251,44 @@ if config_mstarddc_spi
+@@ -260,36 +274,44 @@ if config_mstarddc_spi
  endif
  if config_nic3com
    srcs += 'nic3com.c'
@@ -189,7 +189,7 @@
    cargs += '-DCONFIG_PICKIT2_SPI=1'
  endif
  if config_pony_spi
-@@ -283,10 +305,12 @@ if config_rayer_spi
+@@ -306,10 +328,12 @@ if config_rayer_spi
  endif
  if config_satamv
    srcs += 'satamv.c'
@@ -202,7 +202,7 @@
    cargs += '-DCONFIG_SATASII=1'
  endif
  if config_serprog
-@@ -296,10 +320,12 @@ if config_serprog
+@@ -319,10 +343,12 @@ if config_serprog
  endif
  if config_usbblaster_spi
    srcs += 'usbblaster_spi.c'
@@ -215,8 +215,8 @@
    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'
+@@ -344,6 +370,26 @@ if host_machine.system() == 'linux'
+   srcs += 'i2c_helper_linux.c'
  endif
  
 +# some programmers require libftdi
@@ -242,14 +242,40 @@
  # raw memory, MSR or PCI port I/O access
  if need_raw_access
    srcs += 'hwaccess.c'
+@@ -493,10 +539,12 @@ executable(
+ subdir('util')
+ 
+ # unit-test framework
++if get_option('build_tests')
++
+ cmocka_dep = dependency(
+   'cmocka',
+   fallback: ['cmocka', 'cmocka_dep'],
+-  required: false
++  required: true
+ )
+ flashrom_test_dep = declare_dependency(
+   include_directories : include_directories('.'),
+@@ -519,3 +567,5 @@ flashrom_test_dep = declare_dependency(
+ if cmocka_dep.found()
+   subdir('tests')
+ endif
++
++endif
 --- a/meson_options.txt
 +++ b/meson_options.txt
-@@ -1,5 +1,6 @@
+@@ -1,9 +1,12 @@
 -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('default_programmer_name', type : 'string', description : 'default 
programmer')
+ option('default_programmer_args', type : 'string', description : 'default 
programmer arguments')
  
++option('build_tests', type : 'boolean', value : false, description : 'build 
the test suite')
++
  option('config_atahpt', type : 'boolean', value : false, description : 
'Highpoint (HPT) ATA/RAID controllers')
+ option('config_atapromise', type : 'boolean', value : false, description : 
'Promise ATA controller')
+ option('config_atavia', type : 'boolean', value : true, description : 'VIA 
VT6421A LPC memory')

diff --git a/sys-apps/flashrom/flashrom-9999.ebuild 
b/sys-apps/flashrom/flashrom-9999.ebuild
index 333373eb5f83..58c8150f039c 100644
--- a/sys-apps/flashrom/flashrom-9999.ebuild
+++ b/sys-apps/flashrom/flashrom-9999.ebuild
@@ -101,13 +101,13 @@ BDEPEND="test? ( dev-util/cmocka )"
 
 DOCS=( README Documentation/ )
 
-# TODO: cmocka automagic
 PATCHES=(
        "${FILESDIR}"/${PN}-9999_meson-fixes.patch
 )
 
 src_configure() {
        local emesonargs=(
+               $(meson_use test build_tests)
                $(meson_use atahpt config_atahpt)
                $(meson_use atapromise config_atapromise)
                $(meson_use atavia config_atavia)

Reply via email to