Edward O'Callaghan submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved Anastasia Klimchuk: Looks good to me, but someone else must approve
meson.build: Fix cmocka to be optional at configure-time

While building with meson, however without libcmocka
available, attempts are made to fetch a copy to build via
the wrap mechanism. However in hermetic build enviroments
this causes hard failure as the dependency declaration of
cmocka is not optional. Fix this to ensure flashrom can build
hermetically in images without libcmocka available.

BUG=none
BRANCH=none
TEST=`
$ mkdir build && cd build/
$ meson --wrap-mode=nodownload --wrap-mode=nofallback ../
$ ninja test # validate configs, builds and no tests are run.
--
$ sudo apt install libcmocka-dev
$ mkdir build && cd build/
$ meson --wrap-mode=nodownload --wrap-mode=nofallback ../
$ ninja test # validate configs, builds and tests are run.
`

Change-Id: Ib59f4dacc14be9b02334ca59b348c19e22963367
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/54368
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M meson.build
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 368820c..81d63a9 100644
--- a/meson.build
+++ b/meson.build
@@ -462,7 +462,8 @@
# unit-test framework
cmocka_dep = dependency(
'cmocka',
- fallback: ['cmocka', 'cmocka_dep']
+ fallback: ['cmocka', 'cmocka_dep'],
+ required: false
)
flashrom_test_dep = declare_dependency(
include_directories : include_directories('.'),
@@ -481,4 +482,6 @@
],
)

-subdir('tests')
+if cmocka_dep.found()
+ subdir('tests')
+endif

To view, visit change 54368. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ib59f4dacc14be9b02334ca59b348c19e22963367
Gerrit-Change-Number: 54368
Gerrit-PatchSet: 3
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Sam McNally <sammc@google.com>
Gerrit-MessageType: merged