Commit 510f4c13 authored by Jonathan Davies's avatar Jonathan Davies Committed by Tomasz Zawadzki
Browse files

Make libvfio-user build reliable on ninja < 1.9

Sadly, before v1.9.0, ninja used per-second granularity timestamps.
This had the unfortunate consequence that a "meson configure"
immediately following a "meson setup" would not be picked up by ninja,
thinking that no regeneration of the build config was needed during
"meson compile". See https://github.com/mesonbuild/meson/issues/3992

 for
background and general dismay.

This means that VFIO_USER_CFG_OPTS are ignored 50% of the time,
depending on the wall clock. Unlucky builds would therefore end up with
libvfio-user being built as a shared object (rather than a static
archive) and for installation in /usr/local/lib64 (rather than
/usr/local/lib, as per VFIO_USER_LIB_PREFIX).

This is worked around by injecting a sleep between "meson setup" and
"meson configure" when ninja < 1.9 is in use.

Note that ninja v1.8.2 ships in el8, so suffers from this problem.

Signed-off-by: default avatarJonathan Davies <jonathan.davies@nutanix.com>
Change-Id: I4d555dcc5bc63df4475ec6fd6014e3502123e92b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14236


Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarJohn Levon <levon@movementarian.org>
Reviewed-by: default avatarThanos Makatos <thanos.makatos@nutanix.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 51a8f16e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@ all: scan-build
build:
	$(Q)test -d $(VFIO_USER_BUILD_DIR) || \
	     CC=$(SUB_CC) meson setup $(VFIO_USER_BUILD_DIR) $(VFIO_USER_SRC_DIR)
	# Work around pre-v1.9 versions of ninja ignoring new configuration.
	$(Q)[ $$((ninja --version; echo 1.9) | sort --version-sort | head -n 1) \
	     = 1.9 ] || sleep 0.5
	$(Q)meson configure $(VFIO_USER_BUILD_DIR) $(VFIO_USER_CFG_OPTS)
	$(Q)meson compile $(MESON_COMPILE_OPTS) -C $(VFIO_USER_BUILD_DIR)
	DESTDIR=$(VFIO_USER_INSTALL_DIR) meson install --quiet -C $(VFIO_USER_BUILD_DIR)