Update meson to 0.46.0.

* add upstream patches and a pull request to fix some bugs in this release.

Exp-run by:	antoine@
PR:		228297
Obtained from:	meson github
This commit is contained in:
Koop Mast 2018-05-22 14:30:07 +00:00
parent 32e42ae479
commit 41e8d4fc27
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=470618
5 changed files with 294 additions and 4 deletions

View file

@ -2,7 +2,8 @@
# $FreeBSD$
PORTNAME= meson
PORTVERSION= 0.45.1
PORTVERSION= 0.46.0
PORTREVISION= 2
CATEGORIES= devel python
MASTER_SITES= https://github.com/mesonbuild/${PORTNAME}/releases/download/${PORTVERSION}/

View file

@ -1,3 +1,3 @@
TIMESTAMP = 1521857611
SHA256 (meson-0.45.1.tar.gz) = 4d0bb0dbb1bb556cb7a4092fdfea3d6e76606bd739a4bc97481c2d7bc6200afb
SIZE (meson-0.45.1.tar.gz) = 1163209
TIMESTAMP = 1524914549
SHA256 (meson-0.46.0.tar.gz) = b7df91b01a358a8facdbfa33596a47cda38a760435ab55e1985c0bff06a9cbf0
SIZE (meson-0.46.0.tar.gz) = 1200001

View file

@ -0,0 +1,190 @@
https://github.com/mesonbuild/meson/pull/3463
From 894457199672413466771da6fd9b6988c29c8557 Mon Sep 17 00:00:00 2001
From: Ting-Wei Lan <lantw@src.gnome.org>
Date: Sun, 22 Apr 2018 22:38:18 +0800
Subject: [PATCH] gnome: Distinguish between internal and external linker flags
When an older version of the library being built is installed in the
same prefix as external dependencies, we have to be careful to construct
the linker or compiler command line. If a -L flag from external
dependencoes comes before a -L flag pointing to builddir, it is possible
for the linker to load older libraries from the installation prefix
instead of the newly built ones, which is likely to cause undefined
reference error.
Since the order of dependencies is not significant, we cannot expect
internal dependencies to appear before external dependencies when
recursively iterating the list of dependencies. To make it harder to
make mistakes, linker flags come from internal and external
dependencies are now stored in different order sets. Code using
_get_dependencies_flags are expected to follow the order when
constructing linker command line:
1. Internal linker flags
2. LDFLAGS set by users
3. External linker flags
It is similar to what automake and libtool do for autotools projects.
---
mesonbuild/modules/gnome.py | 61 +++++++++++++++++++++++++++------------------
1 file changed, 37 insertions(+), 24 deletions(-)
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index abefe0579..5629ad169 100644
--- mesonbuild/modules/gnome.py
+++ mesonbuild/modules/gnome.py
@@ -316,7 +316,8 @@ def _get_link_args(self, state, lib, depends=None, include_rpath=False,
def _get_dependencies_flags(self, deps, state, depends=None, include_rpath=False,
use_gir_args=False):
cflags = OrderedSet()
- ldflags = OrderedSet()
+ internal_ldflags = OrderedSet()
+ external_ldflags = OrderedSet()
gi_includes = OrderedSet()
deps = mesonlib.listify(deps, unholder=True)
@@ -326,17 +327,19 @@ def _get_dependencies_flags(self, deps, state, depends=None, include_rpath=False
for lib in dep.libraries:
if hasattr(lib, 'held_object'):
lib = lib.held_object
- ldflags.update(self._get_link_args(state, lib, depends, include_rpath))
+ internal_ldflags.update(self._get_link_args(state, lib, depends, include_rpath))
libdepflags = self._get_dependencies_flags(lib.get_external_deps(), state, depends, include_rpath,
use_gir_args)
cflags.update(libdepflags[0])
- ldflags.update(libdepflags[1])
- gi_includes.update(libdepflags[2])
+ internal_ldflags.update(libdepflags[1])
+ external_ldflags.update(libdepflags[2])
+ gi_includes.update(libdepflags[3])
extdepflags = self._get_dependencies_flags(dep.ext_deps, state, depends, include_rpath,
use_gir_args)
cflags.update(extdepflags[0])
- ldflags.update(extdepflags[1])
- gi_includes.update(extdepflags[2])
+ internal_ldflags.update(extdepflags[1])
+ external_ldflags.update(extdepflags[2])
+ gi_includes.update(extdepflags[3])
for source in dep.sources:
if hasattr(source, 'held_object'):
source = source.held_object
@@ -351,9 +354,9 @@ def _get_dependencies_flags(self, deps, state, depends=None, include_rpath=False
# For PkgConfigDependency only:
getattr(dep, 'is_libtool', False)):
lib_dir = os.path.dirname(lib)
- ldflags.update(["-L%s" % lib_dir])
+ external_ldflags.update(["-L%s" % lib_dir])
if include_rpath:
- ldflags.update(['-Wl,-rpath {}'.format(lib_dir)])
+ external_ldflags.update(['-Wl,-rpath {}'.format(lib_dir)])
libname = os.path.basename(lib)
if libname.startswith("lib"):
libname = libname[3:]
@@ -362,7 +365,7 @@ def _get_dependencies_flags(self, deps, state, depends=None, include_rpath=False
# Hack to avoid passing some compiler options in
if lib.startswith("-W"):
continue
- ldflags.update([lib])
+ external_ldflags.update([lib])
if isinstance(dep, PkgConfigDependency):
girdir = dep.get_pkgconfig_variable("girdir", {'default': ''})
@@ -375,14 +378,17 @@ def _get_dependencies_flags(self, deps, state, depends=None, include_rpath=False
continue
if gir_has_extra_lib_arg(self.interpreter) and use_gir_args:
- fixed_ldflags = OrderedSet()
- for ldflag in ldflags:
- if ldflag.startswith("-l"):
- fixed_ldflags.add(ldflag.replace('-l', '--extra-library=', 1))
- else:
- fixed_ldflags.add(ldflag)
- ldflags = fixed_ldflags
- return cflags, ldflags, gi_includes
+ def fix_ldflags(ldflags):
+ fixed_ldflags = OrderedSet()
+ for ldflag in ldflags:
+ if ldflag.startswith("-l"):
+ fixed_ldflags.add(ldflag.replace('-l', '--extra-library=', 1))
+ else:
+ fixed_ldflags.add(ldflag)
+ return fixed_ldflags
+ internal_ldflags = fix_ldflags(internal_ldflags)
+ external_ldflags = fix_ldflags(external_ldflags)
+ return cflags, internal_ldflags, external_ldflags, gi_includes
@permittedKwargs({'sources', 'nsversion', 'namespace', 'symbol_prefix', 'identifier_prefix',
'export_packages', 'includes', 'dependencies', 'link_with', 'include_directories',
@@ -484,7 +490,8 @@ def generate_gir(self, state, args, kwargs):
'Gir includes must be str, GirTarget, or list of them')
cflags = []
- ldflags = []
+ internal_ldflags = []
+ external_ldflags = []
for lang, compiler in girtarget.compilers.items():
# XXX: Can you use g-i with any other language?
if lang in ('c', 'cpp', 'objc', 'objcpp', 'd'):
@@ -501,7 +508,7 @@ def generate_gir(self, state, args, kwargs):
sanitize = state.environment.coredata.base_options['b_sanitize'].value
cflags += compilers.sanitizer_compile_args(sanitize)
if 'address' in sanitize.split(','):
- ldflags += ['-lasan']
+ external_ldflags += ['-lasan']
# FIXME: Linking directly to libasan is not recommended but g-ir-scanner
# does not understand -f LDFLAGS. https://bugzilla.gnome.org/show_bug.cgi?id=783892
# ldflags += compilers.sanitizer_link_args(sanitize)
@@ -562,10 +569,11 @@ def generate_gir(self, state, args, kwargs):
# ldflags will be misinterpreted by gir scanner (showing
# spurious dependencies) but building GStreamer fails if they
# are not used here.
- dep_cflags, dep_ldflags, gi_includes = self._get_dependencies_flags(deps, state, depends,
- use_gir_args=True)
+ dep_cflags, dep_internal_ldflags, dep_external_ldflags, gi_includes = \
+ self._get_dependencies_flags(deps, state, depends, use_gir_args=True)
cflags += list(dep_cflags)
- ldflags += list(dep_ldflags)
+ internal_ldflags += list(dep_internal_ldflags)
+ external_ldflags += list(dep_external_ldflags)
scan_command += ['--cflags-begin']
scan_command += cflags
scan_command += state.environment.coredata.external_args[lang]
@@ -575,7 +583,7 @@ def generate_gir(self, state, args, kwargs):
# ones.
if isinstance(girtarget, build.SharedLibrary):
scan_command += ["-L@PRIVATE_OUTDIR_ABS_%s@" % girtarget.get_id()]
- scan_command += list(ldflags)
+ scan_command += list(internal_ldflags)
for i in gi_includes:
scan_command += ['--add-include-path=%s' % i]
@@ -603,6 +611,7 @@ def generate_gir(self, state, args, kwargs):
for link_arg in state.environment.coredata.external_link_args[lang]:
if link_arg.startswith('-L'):
scan_command.append(link_arg)
+ scan_command += list(external_ldflags)
scankwargs = {'output': girfile,
'command': scan_command,
@@ -825,7 +834,8 @@ def gtkdoc(self, state, args, kwargs):
def _get_build_args(self, kwargs, state):
args = []
deps = extract_as_list(kwargs, 'dependencies', unholder=True)
- cflags, ldflags, gi_includes = self._get_dependencies_flags(deps, state, include_rpath=True)
+ cflags, internal_ldflags, external_ldflags, gi_includes = \
+ self._get_dependencies_flags(deps, state, include_rpath=True)
inc_dirs = mesonlib.extract_as_list(kwargs, 'include_directories')
for incd in inc_dirs:
if not isinstance(incd.held_object, (str, build.IncludeDirs)):
@@ -833,7 +843,10 @@ def _get_build_args(self, kwargs, state):
'Gir include dirs should be include_directories().')
cflags.update(get_include_args(inc_dirs))
cflags.update(state.environment.coredata.external_args['c'])
+ ldflags = OrderedSet()
+ ldflags.update(internal_ldflags)
ldflags.update(state.environment.coredata.external_link_args['c'])
+ ldflags.update(external_ldflags)
if cflags:
args += ['--cflags=%s' % ' '.join(cflags)]
if ldflags:

View file

@ -0,0 +1,32 @@
From cbc2f2d1df769123caa2e4562dbe1809cca1304d Mon Sep 17 00:00:00 2001
From: Jussi Pakkanen <jpakkane@gmail.com>
Date: Sun, 29 Apr 2018 21:43:24 +0300
Subject: [PATCH] Keep separator spaces in pkg-config declarations. Closes
#3479.
---
mesonbuild/modules/pkgconfig.py | 6 ++++--
run_unittests.py | 11 +++++++++++
test cases/unit/31 pkgconfig format/meson.build | 12 ++++++++++++
test cases/unit/31 pkgconfig format/somelib.c | 5 +++++
4 files changed, 32 insertions(+), 2 deletions(-)
create mode 100644 test cases/unit/31 pkgconfig format/meson.build
create mode 100644 test cases/unit/31 pkgconfig format/somelib.c
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index a3ba973f3..419a14c77 100644
--- mesonbuild/modules/pkgconfig.py
+++ mesonbuild/modules/pkgconfig.py
@@ -139,8 +139,10 @@ def add_version_reqs(self, name, version_reqs):
if version_reqs:
if name not in self.version_reqs:
self.version_reqs[name] = set()
- # We could have '>=1.0' or '>= 1.0', remove spaces to normalize
- new_vreqs = [s.replace(' ', '') for s in mesonlib.stringlistify(version_reqs)]
+ # Note that pkg-config is picky about whitespace.
+ # 'foo > 1.2' is ok but 'foo>1.2' is not.
+ # foo, bar' is ok, but 'foo,bar' is not.
+ new_vreqs = [s for s in mesonlib.stringlistify(version_reqs)]
self.version_reqs[name].update(new_vreqs)
def split_version_req(self, s):

View file

@ -0,0 +1,67 @@
From a3b2ae8ebcdcebd68b8a217d03102c6d03fcb766 Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Tue, 1 May 2018 17:54:54 +0530
Subject: [PATCH] pkgconfig: Don't expose internal libraries in .pc files
Libraries that have been linked with link_whole: are internal
implementation details and should never be exposed to the outside
world in either Libs: or Libs.private:
Closes https://github.com/mesonbuild/meson/issues/3509
---
mesonbuild/build.py | 12 +++++++++---
mesonbuild/modules/pkgconfig.py | 4 ++--
run_unittests.py | 11 ++++++-----
test cases/unit/31 pkgconfig format/meson.build | 5 +++--
test cases/unit/31 pkgconfig format/somelib.c | 4 +++-
test cases/unit/31 pkgconfig format/someret.c | 3 +++
6 files changed, 26 insertions(+), 13 deletions(-)
create mode 100644 test cases/unit/31 pkgconfig format/someret.c
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 3d531d181..a2d024aec 100644
--- mesonbuild/build.py
+++ mesonbuild/build.py
@@ -817,16 +817,22 @@ def get_outputs(self):
def get_extra_args(self, language):
return self.extra_args.get(language, [])
- def get_dependencies(self, exclude=None):
+ def get_dependencies(self, exclude=None, internal=True):
transitive_deps = []
if exclude is None:
exclude = []
- for t in itertools.chain(self.link_targets, self.link_whole_targets):
+ if internal:
+ link_targets = itertools.chain(self.link_targets, self.link_whole_targets)
+ else:
+ # We don't want the 'internal' libraries when generating the
+ # `Libs:` and `Libs.private:` lists in pkg-config files.
+ link_targets = self.link_targets
+ for t in link_targets:
if t in transitive_deps or t in exclude:
continue
transitive_deps.append(t)
if isinstance(t, StaticLibrary):
- transitive_deps += t.get_dependencies(transitive_deps + exclude)
+ transitive_deps += t.get_dependencies(transitive_deps + exclude, internal)
return transitive_deps
def get_source_subdir(self):
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index 419a14c77..365d3cd37 100644
--- mesonbuild/modules/pkgconfig.py
+++ mesonbuild/modules/pkgconfig.py
@@ -123,10 +123,10 @@ def _process_libs(self, libs, public):
if not hasattr(obj, 'generated_pc'):
obj.generated_pc = self.name
if isinstance(obj, build.StaticLibrary) and public:
- self.add_pub_libs(obj.get_dependencies())
+ self.add_pub_libs(obj.get_dependencies(internal=False))
self.add_pub_libs(obj.get_external_deps())
else:
- self.add_priv_libs(obj.get_dependencies())
+ self.add_priv_libs(obj.get_dependencies(internal=False))
self.add_priv_libs(obj.get_external_deps())
elif isinstance(obj, str):
processed_libs.append(obj)