[v2,3/3] build: bump minimum Meson to 0.47.1 and use dependency() for libbsd

Message ID 20190111123809.8789-3-bluca@debian.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2,1/3] build: use static deps of libs for pkg-config libs.private |

Checks

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

Commit Message

Luca Boccassi Jan. 11, 2019, 12:38 p.m. UTC
  Move libbsd inclusion to librte_eal, so that all other libraries and
PMDs will inherit it, and librte_cmdline which is built before
librte_eal.
Bump Meson dependency to 0.47.1, to avoid bug where the linker flag of
the dependency gets replicated again and again.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v2: bump meson minimum version to 0.47.1 to avoid meson bug, and move
    libbsd dependency to eal and cmdline

 config/meson.build             | 10 +++++-----
 lib/librte_cmdline/meson.build |  4 ++++
 lib/librte_eal/meson.build     |  3 +++
 meson.build                    |  2 +-
 4 files changed, 13 insertions(+), 6 deletions(-)
  

Comments

Bruce Richardson Jan. 11, 2019, 2:27 p.m. UTC | #1
On Fri, Jan 11, 2019 at 12:38:09PM +0000, Luca Boccassi wrote:
> Move libbsd inclusion to librte_eal, so that all other libraries and
> PMDs will inherit it, and librte_cmdline which is built before
> librte_eal.
> Bump Meson dependency to 0.47.1, to avoid bug where the linker flag of
> the dependency gets replicated again and again.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v2: bump meson minimum version to 0.47.1 to avoid meson bug, and move
>     libbsd dependency to eal and cmdline
> 
>  config/meson.build             | 10 +++++-----
>  lib/librte_cmdline/meson.build |  4 ++++
>  lib/librte_eal/meson.build     |  3 +++
>  meson.build                    |  2 +-
>  4 files changed, 13 insertions(+), 6 deletions(-)
> 
There are some meson version checks in the code that can be removed as
part of this change:

$ git grep meson.version
drivers/meson.build:    if meson.version().version_compare('>=0.47')
kernel/linux/meson.build:       if meson.version().version_compare('>=0.44')
kernel/linux/meson.build:               if meson.version().version_compare('>=0.44')
meson.build:    meson_version: '>= 0.41'
meson.build:if meson.version().version_compare('>=0.47')
  
Bruce Richardson Jan. 11, 2019, 2:30 p.m. UTC | #2
On Fri, Jan 11, 2019 at 02:27:01PM +0000, Bruce Richardson wrote:
> On Fri, Jan 11, 2019 at 12:38:09PM +0000, Luca Boccassi wrote:
> > Move libbsd inclusion to librte_eal, so that all other libraries and
> > PMDs will inherit it, and librte_cmdline which is built before
> > librte_eal.
> > Bump Meson dependency to 0.47.1, to avoid bug where the linker flag of
> > the dependency gets replicated again and again.
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > ---
> > v2: bump meson minimum version to 0.47.1 to avoid meson bug, and move
> >     libbsd dependency to eal and cmdline
> > 
> >  config/meson.build             | 10 +++++-----
> >  lib/librte_cmdline/meson.build |  4 ++++
> >  lib/librte_eal/meson.build     |  3 +++
> >  meson.build                    |  2 +-
> >  4 files changed, 13 insertions(+), 6 deletions(-)
> > 
> There are some meson version checks in the code that can be removed as
> part of this change:
> 
> $ git grep meson.version
> drivers/meson.build:    if meson.version().version_compare('>=0.47')
> kernel/linux/meson.build:       if meson.version().version_compare('>=0.44')
> kernel/linux/meson.build:               if meson.version().version_compare('>=0.44')
> meson.build:    meson_version: '>= 0.41'
> meson.build:if meson.version().version_compare('>=0.47')
> 
Thinking on this more, I think the version bump to 0.47 should be done in a
separate standalone patch at the start of this set. Then the other patches
can be based on that.

/Bruce
  
Luca Boccassi Jan. 11, 2019, 3:04 p.m. UTC | #3
On Fri, 2019-01-11 at 14:30 +0000, Bruce Richardson wrote:
> On Fri, Jan 11, 2019 at 02:27:01PM +0000, Bruce Richardson wrote:
> > On Fri, Jan 11, 2019 at 12:38:09PM +0000, Luca Boccassi wrote:
> > > Move libbsd inclusion to librte_eal, so that all other libraries
> > > and
> > > PMDs will inherit it, and librte_cmdline which is built before
> > > librte_eal.
> > > Bump Meson dependency to 0.47.1, to avoid bug where the linker
> > > flag of
> > > the dependency gets replicated again and again.
> > > 
> > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > ---
> > > v2: bump meson minimum version to 0.47.1 to avoid meson bug, and
> > > move
> > >     libbsd dependency to eal and cmdline
> > > 
> > >  config/meson.build             | 10 +++++-----
> > >  lib/librte_cmdline/meson.build |  4 ++++
> > >  lib/librte_eal/meson.build     |  3 +++
> > >  meson.build                    |  2 +-
> > >  4 files changed, 13 insertions(+), 6 deletions(-)
> > > 
> > 
> > There are some meson version checks in the code that can be removed
> > as
> > part of this change:
> > 
> > $ git grep meson.version
> > drivers/meson.build:    if
> > meson.version().version_compare('>=0.47')
> > kernel/linux/meson.build:       if
> > meson.version().version_compare('>=0.44')
> > kernel/linux/meson.build:               if
> > meson.version().version_compare('>=0.44')
> > meson.build:    meson_version: '>= 0.41'
> > meson.build:if meson.version().version_compare('>=0.47')
> > 
> 
> Thinking on this more, I think the version bump to 0.47 should be
> done in a
> separate standalone patch at the start of this set. Then the other
> patches
> can be based on that.
> 
> /Bruce

Ok, will remove those checks in v3 and move the bump to a different
patch. I'll put it second, as the first patch is really not related to
the version and it's stand-alone (and marked for stable), I was just
too lazy to do 2 series :-)
  
Bruce Richardson Jan. 11, 2019, 3:50 p.m. UTC | #4
On Fri, Jan 11, 2019 at 03:04:38PM +0000, Luca Boccassi wrote:
> On Fri, 2019-01-11 at 14:30 +0000, Bruce Richardson wrote:
> > On Fri, Jan 11, 2019 at 02:27:01PM +0000, Bruce Richardson wrote:
> > > On Fri, Jan 11, 2019 at 12:38:09PM +0000, Luca Boccassi wrote:
> > > > Move libbsd inclusion to librte_eal, so that all other libraries
> > > > and
> > > > PMDs will inherit it, and librte_cmdline which is built before
> > > > librte_eal.
> > > > Bump Meson dependency to 0.47.1, to avoid bug where the linker
> > > > flag of
> > > > the dependency gets replicated again and again.
> > > > 
> > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > > ---
> > > > v2: bump meson minimum version to 0.47.1 to avoid meson bug, and
> > > > move
> > > >     libbsd dependency to eal and cmdline
> > > > 
> > > >  config/meson.build             | 10 +++++-----
> > > >  lib/librte_cmdline/meson.build |  4 ++++
> > > >  lib/librte_eal/meson.build     |  3 +++
> > > >  meson.build                    |  2 +-
> > > >  4 files changed, 13 insertions(+), 6 deletions(-)
> > > > 
> > > 
> > > There are some meson version checks in the code that can be removed
> > > as
> > > part of this change:
> > > 
> > > $ git grep meson.version
> > > drivers/meson.build:    if
> > > meson.version().version_compare('>=0.47')
> > > kernel/linux/meson.build:       if
> > > meson.version().version_compare('>=0.44')
> > > kernel/linux/meson.build:               if
> > > meson.version().version_compare('>=0.44')
> > > meson.build:    meson_version: '>= 0.41'
> > > meson.build:if meson.version().version_compare('>=0.47')
> > > 
> > 
> > Thinking on this more, I think the version bump to 0.47 should be
> > done in a
> > separate standalone patch at the start of this set. Then the other
> > patches
> > can be based on that.
> > 
> > /Bruce
> 
> Ok, will remove those checks in v3 and move the bump to a different
> patch. I'll put it second, as the first patch is really not related to
> the version and it's stand-alone (and marked for stable), I was just
> too lazy to do 2 series :-)
> 
> -- 
> Kind regards,
> Luca Boccassi

I don't expect the version bump to happen for 19.02, so if you want the
first patch to go into that release, it probably needs to be standalone.

/Bruce
  
Luca Boccassi Jan. 11, 2019, 4:14 p.m. UTC | #5
On Fri, 2019-01-11 at 15:50 +0000, Bruce Richardson wrote:
> On Fri, Jan 11, 2019 at 03:04:38PM +0000, Luca Boccassi wrote:
> > On Fri, 2019-01-11 at 14:30 +0000, Bruce Richardson wrote:
> > > On Fri, Jan 11, 2019 at 02:27:01PM +0000, Bruce Richardson wrote:
> > > > On Fri, Jan 11, 2019 at 12:38:09PM +0000, Luca Boccassi wrote:
> > > > > Move libbsd inclusion to librte_eal, so that all other
> > > > > libraries
> > > > > and
> > > > > PMDs will inherit it, and librte_cmdline which is built
> > > > > before
> > > > > librte_eal.
> > > > > Bump Meson dependency to 0.47.1, to avoid bug where the
> > > > > linker
> > > > > flag of
> > > > > the dependency gets replicated again and again.
> > > > > 
> > > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > > > ---
> > > > > v2: bump meson minimum version to 0.47.1 to avoid meson bug,
> > > > > and
> > > > > move
> > > > >     libbsd dependency to eal and cmdline
> > > > > 
> > > > >  config/meson.build             | 10 +++++-----
> > > > >  lib/librte_cmdline/meson.build |  4 ++++
> > > > >  lib/librte_eal/meson.build     |  3 +++
> > > > >  meson.build                    |  2 +-
> > > > >  4 files changed, 13 insertions(+), 6 deletions(-)
> > > > > 
> > > > 
> > > > There are some meson version checks in the code that can be
> > > > removed
> > > > as
> > > > part of this change:
> > > > 
> > > > $ git grep meson.version
> > > > drivers/meson.build:    if
> > > > meson.version().version_compare('>=0.47')
> > > > kernel/linux/meson.build:       if
> > > > meson.version().version_compare('>=0.44')
> > > > kernel/linux/meson.build:               if
> > > > meson.version().version_compare('>=0.44')
> > > > meson.build:    meson_version: '>= 0.41'
> > > > meson.build:if meson.version().version_compare('>=0.47')
> > > > 
> > > 
> > > Thinking on this more, I think the version bump to 0.47 should be
> > > done in a
> > > separate standalone patch at the start of this set. Then the
> > > other
> > > patches
> > > can be based on that.
> > > 
> > > /Bruce
> > 
> > Ok, will remove those checks in v3 and move the bump to a different
> > patch. I'll put it second, as the first patch is really not related
> > to
> > the version and it's stand-alone (and marked for stable), I was
> > just
> > too lazy to do 2 series :-)
> > 
> > -- 
> > Kind regards,
> > Luca Boccassi
> 
> I don't expect the version bump to happen for 19.02, so if you want
> the
> first patch to go into that release, it probably needs to be
> standalone.
> 
> /Bruce

Ok, will do that.
  

Patch

diff --git a/config/meson.build b/config/meson.build
index db32499b3..e1af468ee 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -74,11 +74,11 @@  if numa_dep.found() and cc.has_header('numaif.h')
 endif
 
 # check for strlcpy
-if host_machine.system() == 'linux' and cc.find_library('bsd',
-		required: false).found() and cc.has_header('bsd/string.h')
-	dpdk_conf.set('RTE_USE_LIBBSD', 1)
-	add_project_link_arguments('-lbsd', language: 'c')
-	dpdk_extra_ldflags += '-lbsd'
+if host_machine.system() == 'linux'
+	libbsd = dependency('libbsd', required: false)
+	if libbsd.found()
+		dpdk_conf.set('RTE_USE_LIBBSD', 1)
+	endif
 endif
 
 # add -include rte_config to cflags
diff --git a/lib/librte_cmdline/meson.build b/lib/librte_cmdline/meson.build
index 30498906c..be286d4a2 100644
--- a/lib/librte_cmdline/meson.build
+++ b/lib/librte_cmdline/meson.build
@@ -5,6 +5,10 @@ 
 includes = [global_inc]
 includes += include_directories('../librte_eal/common/include')
 
+if dpdk_conf.has('RTE_USE_LIBBSD')
+	ext_deps += libbsd
+endif
+
 version = 2
 sources = files('cmdline.c',
 	'cmdline_cirbuf.c',
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index a18f3a826..fa60736c9 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -25,6 +25,9 @@  version = 9  # the version of the EAL API
 allow_experimental_apis = true
 deps += 'compat'
 deps += 'kvargs'
+if dpdk_conf.has('RTE_USE_LIBBSD')
+	ext_deps += libbsd
+endif
 sources = common_sources + env_sources
 objs = common_objs + env_objs
 headers = common_headers + env_headers
diff --git a/meson.build b/meson.build
index 35126106a..4041eccb6 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@  project('DPDK', 'C',
 	version: '19.02.0-rc1',
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
-	meson_version: '>= 0.42'
+	meson_version: '>= 0.47.1'
 )
 
 # set up some global vars for compiler, platform, configuration, etc.