Update meson to 0.48.0.

This version brings python 3.7 support. For detailed changelog see:
http://mesonbuild.com/Release-notes-for-0-47-0.html
http://mesonbuild.com/Release-notes-for-0-48-0.html

Exp-run by:	antoine@

PR:		231219
Submitted by:	Tamas Szakaly <sghctoma@gmail.com> (update to 0.47.2),
		Ting-Wei Lan <lantw44@gmail.com> (update to 0.48.0)
This commit is contained in:
Koop Mast 2018-10-13 20:33:23 +00:00
parent 6133f0d8e6
commit fe3f4d64ab
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=482011
7 changed files with 223 additions and 195 deletions

View File

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

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1529220278
SHA256 (meson-0.46.1.tar.gz) = 19497a03e7e5b303d8d11f98789a79aba59b5ad4a81bd00f4d099be0212cee78
SIZE (meson-0.46.1.tar.gz) = 1203713
TIMESTAMP = 1538669945
SHA256 (meson-0.48.0.tar.gz) = 982937ba5b380abe13f3a0c4dff944dd19d08b72870e3b039f5037c91f82835f
SIZE (meson-0.48.0.tar.gz) = 1307245

View File

@ -0,0 +1,40 @@
https://github.com/mesonbuild/meson/pull/4324
From 068f0b3bc7becab6762ada45ecdd5dc601ee2473 Mon Sep 17 00:00:00 2001
From: Ting-Wei Lan <lantw@src.gnome.org>
Date: Thu, 4 Oct 2018 23:03:30 +0800
Subject: [PATCH] backends: Use raw_link_args to check for the need of RPATH
Function rpaths_for_bundled_shared_libraries assumes it needs RPATH when
linking arguments of an external dependency has exactly one argument and
the only argument is an absolute path to a library file. This was mostly
fine because almost all .pc files use a -L -l pair instead of the full
path of the library, which means pkg-config dependencies almost always
have at least two arguments. However, there are patches landed in the
meson 0.47 cycle which convert -L -l pair returned by pkg-config to the
absolute path of library. If the output of pkg-config includes exactly
one -L argument and one -l argument, it will be converted to exactly one
absolute path by meson and rpaths_for_bundled_shared_libraries will
assume it needs RPATH. Since meson passes both -rpath and -rpath-link to
the linker and -rpath-link has precedence over LD_LIBRARY_PATH, it
changes the search order of dependent libraries in an unexpected way and
it causes a lot of linking troubles in JHBuild environments on FreeBSD.
To make the method behave like the old way of using -L -l pairs and
avoid library path order problems, we use raw_link_args instead of
link_args here. raw_link_args stores the unmodified output of pkg-config
and it is much less likely to accidentally match the rule currently used
by the method.
Works around https://github.com/mesonbuild/meson/issues/4270.
--- mesonbuild/backend/backends.py.orig 2018-09-22 13:22:03 UTC
+++ mesonbuild/backend/backends.py
@@ -371,7 +371,7 @@ class Backend:
for dep in target.external_deps:
if not isinstance(dep, (dependencies.ExternalLibrary, dependencies.PkgConfigDependency)):
continue
- la = dep.link_args
+ la = dep.get_link_args(raw=True)
if len(la) != 1 or not os.path.isabs(la[0]):
continue
# The only link argument is an absolute path to a library file.

View File

@ -0,0 +1,100 @@
https://github.com/mesonbuild/meson/pull/4325
From 158d627c141859e28bbca2c2126b5306608aac6e Mon Sep 17 00:00:00 2001
From: Ting-Wei Lan <lantw@src.gnome.org>
Date: Thu, 4 Oct 2018 23:30:28 +0800
Subject: [PATCH] PkgConfigDependency: Sort -L flags according to
PKG_CONFIG_PATH
When there is more than one path in PKG_CONFIG_PATH. It is almost always
preferred to find things in the order specified by PKG_CONFIG_PATH
instead of assuming pkg-config returns flags in a meaningful order.
For example:
/usr/local/lib/libgtk-3.so.0
/usr/local/lib/pkgconfig/gtk+-3.0.pc
/usr/local/lib/libcanberra-gtk3.so
/usr/local/lib/pkgconfig/libcanberra-gtk3.pc
/home/mesonuser/.local/lib/libgtk-3.so.0
/home/mesonuser/.local/lib/pkgconfig/gtk+-3.0.pc
PKG_CONFIG_PATH="/home/mesonuser/.local/lib/pkgconfig:/usr/local/lib/pkgconfig"
libcanberra-gtk3 is a library which depends on gtk+-3.0. The dependency
is mentioned in the .pc file with 'Requires', so flags from gtk+-3.0 are
used in both dynamic and static linking.
Assume the user wants to compile an application which needs both
libcanberra-gtk3 and gtk+-3.0. The application depends on features added
in the latest version of gtk+-3.0, which can be found in the home
directory of the user but not in /usr/local. When meson asks pkg-config
for linker flags of libcanberra-gtk3, pkg-config picks
/usr/local/lib/pkgconfig/libcanberra-gtk3.pc and
/home/mesonuser/.local/lib/pkgconfig/gtk+-3.0.pc. Since these two
libraries come from different prefixes, there will be two -L arguments
in the output of pkg-config. If -L/usr/local/lib is put before
-L/home/mesonuser/.local/lib, meson will find both libraries in
/usr/local/lib instead of picking libgtk-3.so.0 from the home directory.
This can result in linking failure such as undefined references error
when meson decides to put linker arguments of libcanberra-gtk3 before
linker arguments of gtk+-3.0. When both /usr/local/lib/libgtk-3.so.0 and
/home/mesonuser/.local/lib/libgtk-3.so.0 are present on the command
line, the linker chooses the first one and ignores the second one. If
the application needs new symbols that are only available in the second
one, the linker will throw an error because of missing symbols.
To resolve the issue, we should reorder -L flags according to
PKG_CONFIG_PATH ourselves before using it to find the full path of
library files. This makes sure that we always follow the preferences of
users, without depending on the unreliable part of pkg-config output.
Fixes https://github.com/mesonbuild/meson/issues/4271.
--- mesonbuild/dependencies/base.py.orig 2018-09-22 13:22:03 UTC
+++ mesonbuild/dependencies/base.py
@@ -604,6 +604,21 @@ class PkgConfigDependency(ExternalDepend
(self.name, out))
self.compile_args = self._convert_mingw_paths(shlex.split(out))
+ def _sort_libpaths(self, libpaths, refpaths):
+ if len(refpaths) == 0:
+ return list(libpaths)
+
+ def key_func(libpath):
+ common_lengths = []
+ for refpath in refpaths:
+ common_path = os.path.commonpath([libpath, refpath])
+ common_lengths.append(len(common_path))
+ max_length = max(common_lengths)
+ max_index = common_lengths.index(max_length)
+ reversed_max_length = len(refpaths[max_index]) - max_length
+ return (max_index, reversed_max_length)
+ return sorted(libpaths, key=key_func)
+
def _search_libs(self, out, out_raw):
'''
@out: PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 pkg-config --libs
@@ -635,6 +650,22 @@ class PkgConfigDependency(ExternalDepend
for arg in raw_link_args:
if arg.startswith('-L') and not arg.startswith(('-L-l', '-L-L')):
prefix_libpaths.add(arg[2:])
+ # Library paths are not always ordered in a meaningful way
+ #
+ # Instead of relying on pkg-config or pkgconf to provide -L flags in a
+ # specific order, we reorder library paths ourselves, according to th
+ # order specified in PKG_CONFIG_PATH. See:
+ # https://github.com/mesonbuild/meson/issues/4271
+ #
+ # Only prefix_libpaths are reordered here because there should not be
+ # too many system_libpaths to cause library version issues.
+ pkg_config_path = os.environ.get('PKG_CONFIG_PATH')
+ if pkg_config_path:
+ pkg_config_path = pkg_config_path.split(os.pathsep)
+ else:
+ pkg_config_path = []
+ pkg_config_path = self._convert_mingw_paths(pkg_config_path)
+ prefix_libpaths = self._sort_libpaths(prefix_libpaths, pkg_config_path)
system_libpaths = OrderedSet()
full_args = self._convert_mingw_paths(shlex.split(out))
for arg in full_args:

View File

@ -1,190 +1,39 @@
https://github.com/mesonbuild/meson/pull/3463
https://github.com/mesonbuild/meson/pull/4348
From 894457199672413466771da6fd9b6988c29c8557 Mon Sep 17 00:00:00 2001
From ca946665fe824c2010a96f659cff3ae21cecd910 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
Date: Mon, 8 Oct 2018 23:44:33 +0800
Subject: [PATCH] gnome: Quote arguments passed to gtkdoc-scangobj
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
It is possible for compiler flags to include special characters, such as
double quotes which are needed to define macros with -D options. Since
gtkdoc-scangobj uses shlex.split to split arguments passed to --cc,
--ld, --cflags, --ldflags into lists, we can safely use shlex.quote to
properly quote arguments for these options.
--- mesonbuild/modules/gnome.py.orig 2018-09-22 13:22:03 UTC
+++ 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)
@@ -17,6 +17,7 @@ functionality such as gobject-introspect
@@ -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])
import os
import copy
+import shlex
import subprocess
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
from .. import build
@@ -1014,12 +1015,12 @@ This will become a hard error in the fut
compiler = state.environment.coredata.compilers.get('c')
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 compiler:
- args += ['--cc=%s' % ' '.join(compiler.get_exelist())]
- args += ['--ld=%s' % ' '.join(compiler.get_linker_exelist())]
+ args += ['--cc=%s' % ' '.join([shlex.quote(x) for x in compiler.get_exelist()])]
+ args += ['--ld=%s' % ' '.join([shlex.quote(x) for x in compiler.get_linker_exelist()])]
if cflags:
args += ['--cflags=%s' % ' '.join(cflags)]
- args += ['--cflags=%s' % ' '.join(cflags)]
+ args += ['--cflags=%s' % ' '.join([shlex.quote(x) for x in cflags])]
if ldflags:
- args += ['--ldflags=%s' % ' '.join(ldflags)]
+ args += ['--ldflags=%s' % ' '.join([shlex.quote(x) for x in ldflags])]
return args

View File

@ -0,0 +1,39 @@
https://github.com/mesonbuild/meson/issues/4304
From 2ff69b20df0864182fdf2b146d29dc67d0cb9a5b Mon Sep 17 00:00:00 2001
From: Jussi Pakkanen <jpakkane@gmail.com>
Date: Mon, 1 Oct 2018 20:31:48 +0300
Subject: [PATCH] Fix handling generated .desktop files. Closes #4304.
--- mesonbuild/modules/i18n.py.orig 2018-09-22 13:22:03 UTC
+++ mesonbuild/modules/i18n.py
@@ -82,17 +82,19 @@ class I18nModule(ExtensionModule):
kwargs['command'] = command
inputfile = kwargs['input']
- if isinstance(inputfile, str):
- inputfile = mesonlib.File.from_source_file(state.environment.source_dir,
+ if hasattr(inputfile, 'held_object'):
+ ct = build.CustomTarget(kwargs['output'] + '_merge', state.subdir, state.subproject, kwargs)
+ else:
+ if isinstance(inputfile, str):
+ inputfile = mesonlib.File.from_source_file(state.environment.source_dir,
state.subdir, inputfile)
- output = kwargs['output']
- ifile_abs = inputfile.absolute_path(state.environment.source_dir,
- state.environment.build_dir)
- values = mesonlib.get_filenames_templates_dict([ifile_abs], None)
- outputs = mesonlib.substitute_values([output], values)
- output = outputs[0]
-
- ct = build.CustomTarget(output + '_' + state.subdir + '_merge', state.subdir, state.subproject, kwargs)
+ output = kwargs['output']
+ ifile_abs = inputfile.absolute_path(state.environment.source_dir,
+ state.environment.build_dir)
+ values = mesonlib.get_filenames_templates_dict([ifile_abs], None)
+ outputs = mesonlib.substitute_values([output], values)
+ output = outputs[0]
+ ct = build.CustomTarget(output + '_' + state.subdir + '_merge', state.subdir, state.subproject, kwargs)
return ModuleReturnValue(ct, [ct])
@FeatureNewKwargs('i18n.gettext', '0.37.0', ['preset'])

View File

@ -1,11 +1,11 @@
--- setup.py.orig 2016-11-13 20:01:34 UTC
--- setup.py.orig 2018-09-22 13:22:03 UTC
+++ setup.py
@@ -73,7 +73,7 @@ setup(name='meson',
'mesonintrospect.py',
'wraptool.py'],
cmdclass={'install_scripts': install_scripts},
- data_files=[('share/man/man1', ['man/meson.1',
+ data_files=[('man/man1' , ['man/meson.1',
'man/mesonconf.1',
'man/mesonintrospect.1',
'man/wraptool.1'])],
@@ -38,7 +38,7 @@ packages = ['mesonbuild',
data_files = []
if sys.platform != 'win32':
# Only useful on UNIX-like systems
- data_files = [('share/man/man1', ['man/meson.1']),
+ data_files = [('man/man1', ['man/meson.1']),
('share/polkit-1/actions', ['data/com.mesonbuild.install.policy'])]
if __name__ == '__main__':