DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] support building ethtool example using meson
@ 2018-03-29 14:04 Bruce Richardson
  2018-03-29 14:04 ` [dpdk-dev] [PATCH 1/2] examples/ethtool: add to meson build Bruce Richardson
  2018-03-29 14:04 ` [dpdk-dev] [PATCH 2/2] examples/ethtool: enable build using pkg-config vars Bruce Richardson
  0 siblings, 2 replies; 5+ messages in thread
From: Bruce Richardson @ 2018-03-29 14:04 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

Add support for building the ethtool example as part of a meson build, or
separately using the pkgconfig file produced by meson.

Bruce Richardson (2):
  examples/ethtool: add to meson build
  examples/ethtool: enable build using pkg-config vars

 examples/ethtool/Makefile    | 50 ++++++++++++++++++++++++++++++++++++++++++++
 examples/ethtool/meson.build | 13 ++++++++++--
 2 files changed, 61 insertions(+), 2 deletions(-)

-- 
2.14.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 1/2] examples/ethtool: add to meson build
  2018-03-29 14:04 [dpdk-dev] [PATCH 0/2] support building ethtool example using meson Bruce Richardson
@ 2018-03-29 14:04 ` Bruce Richardson
  2018-07-12  7:54   ` Thomas Monjalon
  2018-03-29 14:04 ` [dpdk-dev] [PATCH 2/2] examples/ethtool: enable build using pkg-config vars Bruce Richardson
  1 sibling, 1 reply; 5+ messages in thread
From: Bruce Richardson @ 2018-03-29 14:04 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

Add the ethtool example to the meson build. This example is more
complicated than the previously added ones as it has files in two
subdirectories. An ethtool "wrapper lib" in one, used by the actual
example "ethtool app" in the other.

Rather than using recursive operation, like is done with the makefiles,
we instead can just special-case the building of the library from the
single .c file, and then use that as a dependency when building the app
proper.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/ethtool/meson.build | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/examples/ethtool/meson.build b/examples/ethtool/meson.build
index c370d7476..0ec2a2391 100644
--- a/examples/ethtool/meson.build
+++ b/examples/ethtool/meson.build
@@ -6,5 +6,14 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
-# Example app currently unsupported by meson build
-build = false
+# build the ethtool wrapper as a lib, which app uses as a dependency
+ethtool_inc = include_directories('lib')
+ethtool_lib = static_library('rte_ethtool', 'lib/rte_ethtool.c',
+		include_directories: ethtool_inc,
+		dependencies: [static_rte_ethdev, static_rte_pmd_ixgbe])
+ethtool_dep = declare_dependency(link_with: ethtool_lib,
+	include_directories: ethtool_inc)
+
+# sample app files are in the ethtool-app subdir
+sources = files('ethtool-app/ethapp.c', 'ethtool-app/main.c')
+ext_deps += ethtool_dep
-- 
2.14.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 2/2] examples/ethtool: enable build using pkg-config vars
  2018-03-29 14:04 [dpdk-dev] [PATCH 0/2] support building ethtool example using meson Bruce Richardson
  2018-03-29 14:04 ` [dpdk-dev] [PATCH 1/2] examples/ethtool: add to meson build Bruce Richardson
@ 2018-03-29 14:04 ` Bruce Richardson
  1 sibling, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2018-03-29 14:04 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

When provided as an example in a DPDK package, the build of the example
app should use the pkg-config-supplied values from the package. As with
other examples, set up makefile to allow compilation either using
pkg-config or old $RTE_SDK/$RTE_TARGET values.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/ethtool/Makefile | 50 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/examples/ethtool/Makefile b/examples/ethtool/Makefile
index 2b40b4b61..9ea7e0e07 100644
--- a/examples/ethtool/Makefile
+++ b/examples/ethtool/Makefile
@@ -1,6 +1,54 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2015 Intel Corporation
 
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+# sample app consists of two parts, an example library and app using it
+APP := ethtool
+SRCS-y := ethtool-app/main.c ethtool-app/ethapp.c
+
+LIB := rte_ethtool
+LIB-SRC := rte_ethtool.c
+
+all: shared
+.PHONY: shared static
+shared: build/$(APP)-shared
+	ln -sf $(APP)-shared build/$(APP)
+static: build/$(APP)-static
+	ln -sf $(APP)-static build/$(APP)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
+LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) -lrte_pmd_ixgbe
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+
+LIB-OBJ := build/$(LIB-SRC:.c=.o)
+AR_FILE := build/lib$(LIB).a
+
+$(LIB-OBJ): lib/$(LIB-SRC) Makefile $(PC_FILE) | build
+	$(CC) -c $(CFLAGS) lib/$(LIB-SRC) -o $@
+
+$(AR_FILE): $(LIB-OBJ)
+	$(AR) r $@ $<
+
+build/$(APP)-shared: $(SRCS-y) $(AR_FILE) Makefile $(PC_FILE) | build
+	$(CC) -Ilib $(CFLAGS) $(SRCS-y) $(AR_FILE) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
+
+build/$(APP)-static: $(SRCS-y) $(AR_FILE) Makefile $(PC_FILE) | build
+	$(CC) -Ilib $(CFLAGS) $(SRCS-y) $(AR_FILE) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
+
+build:
+	@mkdir -p $@
+
+.PHONY: clean
+clean:
+	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
+	rmdir --ignore-fail-on-non-empty build
+
+else
+
 ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
@@ -21,3 +69,5 @@ endif
 DEPDIRS-ethtool-app := lib
 
 include $(RTE_SDK)/mk/rte.extsubdir.mk
+
+endif # no pkg-config for DPDK
-- 
2.14.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] examples/ethtool: add to meson build
  2018-03-29 14:04 ` [dpdk-dev] [PATCH 1/2] examples/ethtool: add to meson build Bruce Richardson
@ 2018-07-12  7:54   ` Thomas Monjalon
  2018-07-12 10:46     ` Bruce Richardson
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2018-07-12  7:54 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

29/03/2018 16:04, Bruce Richardson:
> Add the ethtool example to the meson build. This example is more
> complicated than the previously added ones as it has files in two
> subdirectories. An ethtool "wrapper lib" in one, used by the actual
> example "ethtool app" in the other.
> 
> Rather than using recursive operation, like is done with the makefiles,
> we instead can just special-case the building of the library from the
> single .c file, and then use that as a dependency when building the app
> proper.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

It does not compile because of experimental function:
examples/ethtool/lib/rte_ethtool.c:186:2: error:
‘rte_eth_dev_get_module_info’ is deprecated: Symbol is not yet part of stable ABI

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] examples/ethtool: add to meson build
  2018-07-12  7:54   ` Thomas Monjalon
@ 2018-07-12 10:46     ` Bruce Richardson
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2018-07-12 10:46 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

On Thu, Jul 12, 2018 at 09:54:32AM +0200, Thomas Monjalon wrote:
> 29/03/2018 16:04, Bruce Richardson:
> > Add the ethtool example to the meson build. This example is more
> > complicated than the previously added ones as it has files in two
> > subdirectories. An ethtool "wrapper lib" in one, used by the actual
> > example "ethtool app" in the other.
> > 
> > Rather than using recursive operation, like is done with the makefiles,
> > we instead can just special-case the building of the library from the
> > single .c file, and then use that as a dependency when building the app
> > proper.
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> 
> It does not compile because of experimental function:
> examples/ethtool/lib/rte_ethtool.c:186:2: error:
> ‘rte_eth_dev_get_module_info’ is deprecated: Symbol is not yet part of stable ABI
> 
Ok. This set is fairly old, and I think I've found other issues with it
since. I suggest we drop this set for 18.08 consideration.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-12 10:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-29 14:04 [dpdk-dev] [PATCH 0/2] support building ethtool example using meson Bruce Richardson
2018-03-29 14:04 ` [dpdk-dev] [PATCH 1/2] examples/ethtool: add to meson build Bruce Richardson
2018-07-12  7:54   ` Thomas Monjalon
2018-07-12 10:46     ` Bruce Richardson
2018-03-29 14:04 ` [dpdk-dev] [PATCH 2/2] examples/ethtool: enable build using pkg-config vars Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).