View | Details | Raw Unified | Return to bug 241105 | Differences between
and this patch

Collapse All | Expand All

(-)b/devel/meson/Makefile (-5 / +17 lines)
Lines 2-14 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	meson
4
PORTNAME=	meson
5
PORTVERSION=	0.51.2
5
PORTVERSION=	0.52.0
6
CATEGORIES=	devel python
6
CATEGORIES=	devel python
7
MASTER_SITES=	https://github.com/mesonbuild/${PORTNAME}/releases/download/${PORTVERSION}/
7
MASTER_SITES=	https://github.com/mesonbuild/${PORTNAME}/releases/download/${PORTVERSION}/
8
8
9
PATCH_SITES=	https://github.com/mesonbuild/${PORTNAME}/commit/
10
PATCHFILES+=	efea48788ab2.patch:-p1
11
12
MAINTAINER=	gnome@FreeBSD.org
9
MAINTAINER=	gnome@FreeBSD.org
13
COMMENT=	High performance build system
10
COMMENT=	High performance build system
14
11
Lines 16-24 LICENSE= APACHE20 Link Here
16
LICENSE_FILE=	${WRKSRC}/COPYING
13
LICENSE_FILE=	${WRKSRC}/COPYING
17
14
18
RUN_DEPENDS=	ninja:devel/ninja
15
RUN_DEPENDS=	ninja:devel/ninja
16
TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pytest-xdist>0:devel/py-pytest-xdist@${PY_FLAVOR}
19
17
20
USES=		python:3.5+
18
USES=		python:3.5+ shebangfix
21
USE_PYTHON=	autoplist distutils noflavors
19
USE_PYTHON=	autoplist distutils noflavors
20
SHEBANG_FILES=	mesonbuild/cmake/data/run_ctgt.py
22
NO_ARCH=	yes
21
NO_ARCH=	yes
23
22
23
.if make(test)
24
# helper_create_binary_wrapper, test_python_module
25
BINARY_ALIAS+=	python3=${PYTHON_CMD:T} python=${PYTHON_CMD:T}
26
# test_compiler_detection
27
.if exists(/usr/bin/clang)
28
CC=		clang
29
CXX=		clang++
30
.endif
31
.endif
32
33
do-test:
34
	@(cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} ${WRKSRC}/run_unittests.py)
35
24
.include <bsd.port.mk>
36
.include <bsd.port.mk>
(-)b/devel/meson/distinfo (-5 / +3 lines)
Lines 1-5 Link Here
1
TIMESTAMP = 1566836953
1
TIMESTAMP = 1570381541
2
SHA256 (meson-0.51.2.tar.gz) = 23688f0fc90be623d98e80e1defeea92bbb7103bf9336a5f5b9865d36e892d76
2
SHA256 (meson-0.52.0.tar.gz) = d60f75f0dedcc4fd249dbc7519d6f3ce6df490033d276ef1cf27453ef4938d32
3
SIZE (meson-0.51.2.tar.gz) = 1453251
3
SIZE (meson-0.52.0.tar.gz) = 1507110
4
SHA256 (efea48788ab2.patch) = eee556fb0cd6cbba5756bbfb508412081743cd813dd10d1b9cbc419769281d39
5
SIZE (efea48788ab2.patch) = 953
(-)b/devel/meson/files/patch-mesonbuild_dependencies_base.py (-26 / +35 lines)
Lines 52-82 users, without depending on the unreliable part of pkg-config output. Link Here
52
52
53
Fixes https://github.com/mesonbuild/meson/issues/4271.
53
Fixes https://github.com/mesonbuild/meson/issues/4271.
54
54
55
--- mesonbuild/dependencies/base.py.orig
55
--- mesonbuild/dependencies/base.py.orig	2019-10-06 17:01:35 UTC
56
+++ mesonbuild/dependencies/base.py
56
+++ mesonbuild/dependencies/base.py
57
@@ -706,6 +706,21 @@ def _set_cargs(self):
57
@@ -784,6 +784,22 @@ class PkgConfigDependency(ExternalDependency):
58
                                       (self.name, out))
59
         self.compile_args = self._convert_mingw_paths(shlex.split(out))
60
 
61
+    def _sort_libpaths(self, libpaths, refpaths):
62
+        if len(refpaths) == 0:
63
+            return list(libpaths)
64
+
65
+        def key_func(libpath):
66
+            common_lengths = []
67
+            for refpath in refpaths:
68
+                common_path = os.path.commonpath([libpath, refpath])
69
+                common_lengths.append(len(common_path))
70
+            max_length = max(common_lengths)
71
+            max_index = common_lengths.index(max_length)
72
+            reversed_max_length = len(refpaths[max_index]) - max_length
73
+            return (max_index, reversed_max_length)
74
+        return sorted(libpaths, key=key_func)
75
+
76
     def _search_libs(self, out, out_raw):
77
         '''
78
         @out: PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 pkg-config --libs
79
@@ -741,6 +756,22 @@ def _search_libs(self, out, out_raw):
80
                     # Resolve the path as a compiler in the build directory would
58
                     # Resolve the path as a compiler in the build directory would
81
                     path = os.path.join(self.env.get_build_dir(), path)
59
                     path = os.path.join(self.env.get_build_dir(), path)
82
                 prefix_libpaths.add(path)
60
                 prefix_libpaths.add(path)
Lines 95-101 Fixes https://github.com/mesonbuild/meson/issues/4271. Link Here
95
+        else:
73
+        else:
96
+            pkg_config_path = []
74
+            pkg_config_path = []
97
+        pkg_config_path = self._convert_mingw_paths(pkg_config_path)
75
+        pkg_config_path = self._convert_mingw_paths(pkg_config_path)
98
+        prefix_libpaths = self._sort_libpaths(prefix_libpaths, pkg_config_path)
76
+        prefix_libpaths = sort_libpaths(prefix_libpaths, pkg_config_path)
99
         system_libpaths = OrderedSet()
77
         system_libpaths = OrderedSet()
100
         full_args = self._convert_mingw_paths(shlex.split(out))
78
         full_args = self._convert_mingw_paths(self._split_args(out))
101
         for arg in full_args:
79
         for arg in full_args:
80
@@ -2284,6 +2300,30 @@ def _build_external_dependency_list(name, env: Environ
81
                                                 False, None, env, None, kwargs))
82
 
83
     return candidates
84
+
85
+
86
+def sort_libpaths(libpaths: List[str], refpaths: List[str]) -> List[str]:
87
+    """Sort <libpaths> according to <refpaths>
88
+
89
+    It is intended to be used to sort -L flags returned by pkg-config.
90
+    Pkg-config returns flags in random order which cannot be relied on.
91
+    """
92
+    if len(refpaths) == 0:
93
+        return list(libpaths)
94
+
95
+    def key_func(libpath):
96
+        common_lengths = []
97
+        for refpath in refpaths:
98
+            try:
99
+                common_path = os.path.commonpath([libpath, refpath])
100
+            except ValueError:
101
+                common_path = ''
102
+            common_lengths.append(len(common_path))
103
+        max_length = max(common_lengths)
104
+        max_index = common_lengths.index(max_length)
105
+        reversed_max_length = len(refpaths[max_index]) - max_length
106
+        return (max_index, reversed_max_length)
107
+    return sorted(libpaths, key=key_func)
108
 
109
 
110
 def strip_system_libdirs(environment, for_machine: MachineChoice, link_args):
(-)b/devel/meson/files/patch-run__unittests.py (+66 lines)
Added Link Here
1
https://github.com/mesonbuild/meson/pull/4324
2
https://github.com/mesonbuild/meson/pull/4325
3
https://github.com/mesonbuild/meson/pull/6007
4
5
--- run_unittests.py.orig	2019-10-06 17:01:35 UTC
6
+++ run_unittests.py
7
@@ -57,6 +57,7 @@ from mesonbuild.mesonlib import (
8
 from mesonbuild.environment import detect_ninja
9
 from mesonbuild.mesonlib import MesonException, EnvironmentException
10
 from mesonbuild.dependencies import PkgConfigDependency, ExternalProgram
11
+import mesonbuild.dependencies.base
12
 from mesonbuild.build import Target
13
 import mesonbuild.modules.pkgconfig
14
 
15
@@ -1164,7 +1165,26 @@ class InternalTests(unittest.TestCase):
16
             deps = d.get_all_dependencies(target)
17
             self.assertEqual(deps, expdeps)
18
 
19
+    def test_sort_libpaths(self):
20
+        sort_libpaths = mesonbuild.dependencies.base.sort_libpaths
21
+        self.assertEqual(sort_libpaths(
22
+            ['/home/mesonuser/.local/lib', '/usr/local/lib', '/usr/lib'],
23
+            ['/home/mesonuser/.local/lib/pkgconfig', '/usr/local/lib/pkgconfig']),
24
+            ['/home/mesonuser/.local/lib', '/usr/local/lib', '/usr/lib'])
25
+        self.assertEqual(sort_libpaths(
26
+            ['/usr/local/lib', '/home/mesonuser/.local/lib', '/usr/lib'],
27
+            ['/home/mesonuser/.local/lib/pkgconfig', '/usr/local/lib/pkgconfig']),
28
+            ['/home/mesonuser/.local/lib', '/usr/local/lib', '/usr/lib'])
29
+        self.assertEqual(sort_libpaths(
30
+            ['/usr/lib', '/usr/local/lib', '/home/mesonuser/.local/lib'],
31
+            ['/home/mesonuser/.local/lib/pkgconfig', '/usr/local/lib/pkgconfig']),
32
+            ['/home/mesonuser/.local/lib', '/usr/local/lib', '/usr/lib'])
33
+        self.assertEqual(sort_libpaths(
34
+            ['/usr/lib', '/usr/local/lib', '/home/mesonuser/.local/lib'],
35
+            ['/home/mesonuser/.local/lib/pkgconfig', '/usr/local/libdata/pkgconfig']),
36
+            ['/home/mesonuser/.local/lib', '/usr/local/lib', '/usr/lib'])
37
 
38
+
39
 @unittest.skipIf(is_tarball(), 'Skipping because this is a tarball release')
40
 class DataTests(unittest.TestCase):
41
 
42
@@ -5643,6 +5664,7 @@ class LinuxlikeTests(BasePlatformTests):
43
                 # Assert that
44
                 self.assertEqual(len(line.split(lib)), 2, msg=(lib, line))
45
 
46
+    @skipIfNoPkgconfig
47
     def test_noncross_options(self):
48
         # C_std defined in project options must be in effect also when native compiling.
49
         testdir = os.path.join(self.unit_test_dir, '51 noncross options')
50
@@ -5665,6 +5687,7 @@ c = ['{0}']
51
         # TODO should someday be explicit about build platform only here
52
         self.init(testdir, override_envvars=env)
53
 
54
+    @skipIfNoPkgconfig
55
     def test_static_link(self):
56
         if is_cygwin():
57
             raise unittest.SkipTest("Cygwin doesn't support LD_LIBRARY_PATH.")
58
@@ -5680,7 +5703,7 @@ c = ['{0}']
59
         # Test that installed libraries works
60
         self.new_builddir()
61
         self.prefix = oldprefix
62
-        meson_args = ['-Dc_link_args=-L{}'.format(libdir),
63
+        meson_args = ['-Dc_link_args=-L{} -Wl,-rpath,{}'.format(libdir, libdir),
64
                       '--fatal-meson-warnings']
65
         testdir = os.path.join(self.unit_test_dir, '69 static link')
66
         env = {'PKG_CONFIG_LIBDIR': os.path.join(libdir, 'pkgconfig')}

Return to bug 241105