diff mbox series

[4/4] build: add libbsd to pkg-config file if enabled

Message ID 20190423220644.54589-5-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Headers show
Series add testing of libdpdk pkg-config file | expand


Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Bruce Richardson April 23, 2019, 10:06 p.m. UTC
If libbsd is enabled in DPDK, the strlcpy and strlcat functions in
rte_string_fns.h redirect to the varients in libbsd, only using the
fallbacks if it is not enabled. Therefore, if libbsd is enabled, it needs
to be called out as a DPDK dependency in the pkgconfig file.

To ensure that we don't have undefined variables on non-Linux platforms, we
can remove the linux condition around the libbsd check - no harm comes in
looking for it on other OS, since it's an optional dependency.

To verify this builds correctly, the cmdline sample app is added to the
list of examples compiled by test-meson-builds. Without this change
compilation fails if libbsd is present on the system

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
 config/meson.build            | 10 ++++------
 devtools/test-meson-builds.sh |  2 +-
 meson.build                   |  2 ++
 3 files changed, 7 insertions(+), 7 deletions(-)
diff mbox series


diff --git a/config/meson.build b/config/meson.build
index f8aded6ed..64e2315dd 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -125,12 +125,10 @@  if numa_dep.found() and cc.has_header('numaif.h')
 	dpdk_extra_ldflags += '-lnuma'
-# check for strlcpy
-if is_linux
-	libbsd = dependency('libbsd', required: false)
-	if libbsd.found()
-		dpdk_conf.set('RTE_USE_LIBBSD', 1)
-	endif
+# check for libbsd
+libbsd = dependency('libbsd', required: false)
+if libbsd.found()
+	dpdk_conf.set('RTE_USE_LIBBSD', 1)
 # add -include rte_config to cflags
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index dfba2a782..41080353b 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -103,7 +103,7 @@  $ninja_cmd -C $build_path install
 # rather than hacking our environment, just edit the .pc file prefix value
 sed -i "s|prefix=|prefix=$DESTDIR|" $PKG_CONFIG_PATH/libdpdk.pc
-for example in helloworld l2fwd l3fwd skeleton timer; do
+for example in cmdline helloworld l2fwd l3fwd skeleton timer; do
 	echo "## Building $example"
 	make -C $DESTDIR/usr/local/share/dpdk/examples/$example
diff --git a/meson.build b/meson.build
index a96486597..3c173a587 100644
--- a/meson.build
+++ b/meson.build
@@ -77,6 +77,8 @@  pkg.generate(name: meson.project_name(),
 	libraries: dpdk_libraries,
 	libraries_private: dpdk_drivers + dpdk_static_libraries +
 			['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
+	requires: libbsd, # apps using rte_string_fns.h may need this if enabled
+	                  # if libbsd is not enabled, then this is blank
 	description: '''The Data Plane Development Kit (DPDK).
 Note that CFLAGS might contain an -march flag higher than typical baseline.
 This is required for a number of static inline functions in the public headers.''',