[Midnightbsd-cvs] mports [24501] trunk/devel/meson/files: add patches

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Oct 15 21:19:57 EDT 2018


Revision: 24501
          http://svnweb.midnightbsd.org/mports/?rev=24501
Author:   laffer1
Date:     2018-10-15 21:19:57 -0400 (Mon, 15 Oct 2018)
Log Message:
-----------
add patches

Modified Paths:
--------------
    trunk/devel/meson/files/patch-setup.py

Added Paths:
-----------
    trunk/devel/meson/files/patch-mesonbuild_backend_backends.py
    trunk/devel/meson/files/patch-mesonbuild_dependencies_base.py
    trunk/devel/meson/files/patch-mesonbuild_dependencies_dev.py
    trunk/devel/meson/files/patch-mesonbuild_modules_i18n.py

Added: trunk/devel/meson/files/patch-mesonbuild_backend_backends.py
===================================================================
--- trunk/devel/meson/files/patch-mesonbuild_backend_backends.py	                        (rev 0)
+++ trunk/devel/meson/files/patch-mesonbuild_backend_backends.py	2018-10-16 01:19:57 UTC (rev 24501)
@@ -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 at 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.


Property changes on: trunk/devel/meson/files/patch-mesonbuild_backend_backends.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/devel/meson/files/patch-mesonbuild_dependencies_base.py
===================================================================
--- trunk/devel/meson/files/patch-mesonbuild_dependencies_base.py	                        (rev 0)
+++ trunk/devel/meson/files/patch-mesonbuild_dependencies_base.py	2018-10-16 01:19:57 UTC (rev 24501)
@@ -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 at 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:


Property changes on: trunk/devel/meson/files/patch-mesonbuild_dependencies_base.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/devel/meson/files/patch-mesonbuild_dependencies_dev.py
===================================================================
--- trunk/devel/meson/files/patch-mesonbuild_dependencies_dev.py	                        (rev 0)
+++ trunk/devel/meson/files/patch-mesonbuild_dependencies_dev.py	2018-10-16 01:19:57 UTC (rev 24501)
@@ -0,0 +1,11 @@
+--- mesonbuild/dependencies/dev.py.orig	2018-10-15 21:03:27.833743000 -0400
++++ mesonbuild/dependencies/dev.py	2018-10-15 21:10:37.782201000 -0400
+@@ -260,7 +260,7 @@
+ 
+     def _set_new_link_args(self):
+         """How to set linker args for LLVM versions >= 3.9"""
+-        if ((mesonlib.is_dragonflybsd() or mesonlib.is_freebsd()) and not
++        if ((mesonlib.is_dragonflybsd() or mesonlib.is_freebsd() or mesonlib.is_midnightbsd()) and not
+                 self.static and version_compare(self.version, '>= 4.0')):
+             # llvm-config on DragonFly BSD and FreeBSD for versions 4.0, 5.0,
+             # and 6.0 have an error when generating arguments for shared mode


Property changes on: trunk/devel/meson/files/patch-mesonbuild_dependencies_dev.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/devel/meson/files/patch-mesonbuild_modules_i18n.py
===================================================================
--- trunk/devel/meson/files/patch-mesonbuild_modules_i18n.py	                        (rev 0)
+++ trunk/devel/meson/files/patch-mesonbuild_modules_i18n.py	2018-10-16 01:19:57 UTC (rev 24501)
@@ -0,0 +1,39 @@
+https://github.com/mesonbuild/meson/issues/4304
+
+From 2ff69b20df0864182fdf2b146d29dc67d0cb9a5b Mon Sep 17 00:00:00 2001
+From: Jussi Pakkanen <jpakkane at 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'])


Property changes on: trunk/devel/meson/files/patch-mesonbuild_modules_i18n.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/devel/meson/files/patch-setup.py
===================================================================
--- trunk/devel/meson/files/patch-setup.py	2018-10-16 01:16:11 UTC (rev 24500)
+++ trunk/devel/meson/files/patch-setup.py	2018-10-16 01:19:57 UTC (rev 24501)
@@ -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__':



More information about the Midnightbsd-cvs mailing list