diff options
author | Rafael Ăvila de EspĂndola <rafael@espindo.la> | 2018-07-23 22:48:32 -0700 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-08-24 03:11:32 +0530 |
commit | 833e3e7d8d6e513525b0cc1debb376fc1d83a908 (patch) | |
tree | ed9b5623d1c2ddacdf03c6170ef92b582617c940 | |
parent | dd24da316de751011bda28f707f172e67b75c0c6 (diff) | |
download | meson-833e3e7d8d6e513525b0cc1debb376fc1d83a908.zip meson-833e3e7d8d6e513525b0cc1debb376fc1d83a908.tar.gz meson-833e3e7d8d6e513525b0cc1debb376fc1d83a908.tar.bz2 |
Make the rpath order deterministic.
We were using a set to store the rpaths. Just switch to a OrderedSet.
Fixes #3928.
-rw-r--r-- | mesonbuild/backend/backends.py | 2 | ||||
-rwxr-xr-x | run_unittests.py | 15 | ||||
-rw-r--r-- | test cases/common/207 rpath order/meson.build | 11 | ||||
-rw-r--r-- | test cases/common/207 rpath order/myexe.c | 3 | ||||
-rw-r--r-- | test cases/common/207 rpath order/subprojects/sub1/lib.c | 0 | ||||
-rw-r--r-- | test cases/common/207 rpath order/subprojects/sub1/meson.build | 5 | ||||
-rw-r--r-- | test cases/common/207 rpath order/subprojects/sub2/lib.c | 0 | ||||
-rw-r--r-- | test cases/common/207 rpath order/subprojects/sub2/meson.build | 5 |
8 files changed, 40 insertions, 1 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 354d25a..0e2389d 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -376,7 +376,7 @@ class Backend: def determine_rpath_dirs(self, target): link_deps = target.get_all_link_deps() - result = set() + result = OrderedSet() for ld in link_deps: if ld is target: continue diff --git a/run_unittests.py b/run_unittests.py index 9e8cf4d..4a4ecbf 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -3576,6 +3576,21 @@ endian = 'little' return raise RuntimeError('Could not find the build rule') + def test_deterministic_rpath_order(self): + ''' + Test that the rpaths are always listed in a deterministic order. + ''' + if is_cygwin(): + raise unittest.SkipTest('rpath are not used on Cygwin') + testdir = os.path.join(self.common_test_dir, '207 rpath order') + self.init(testdir) + with open(os.path.join(self.builddir, 'build.ninja')) as bfile: + for line in bfile: + if '-rpath' in line: + self.assertIn('-rpath,$$ORIGIN/subprojects/sub1:$$ORIGIN/subprojects/sub2', line) + return + raise RuntimeError('Could not find the rpath') + @skipIfNoPkgconfig def test_usage_external_library(self): ''' diff --git a/test cases/common/207 rpath order/meson.build b/test cases/common/207 rpath order/meson.build new file mode 100644 index 0000000..a722894 --- /dev/null +++ b/test cases/common/207 rpath order/meson.build @@ -0,0 +1,11 @@ +project('myexe', 'c') + +sub1 = subproject('sub1') +sub1_dep = sub1.get_variable('sub1_dep') + +sub2 = subproject('sub2') +sub2_dep = sub2.get_variable('sub2_dep') + +executable('myexe', + 'myexe.c', + dependencies: [sub1_dep, sub2_dep]) diff --git a/test cases/common/207 rpath order/myexe.c b/test cases/common/207 rpath order/myexe.c new file mode 100644 index 0000000..03b2213 --- /dev/null +++ b/test cases/common/207 rpath order/myexe.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/common/207 rpath order/subprojects/sub1/lib.c b/test cases/common/207 rpath order/subprojects/sub1/lib.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/common/207 rpath order/subprojects/sub1/lib.c diff --git a/test cases/common/207 rpath order/subprojects/sub1/meson.build b/test cases/common/207 rpath order/subprojects/sub1/meson.build new file mode 100644 index 0000000..4dd5d08 --- /dev/null +++ b/test cases/common/207 rpath order/subprojects/sub1/meson.build @@ -0,0 +1,5 @@ +project('sub1', 'c') + +sub1_lib = library('sub1', 'lib.c') + +sub1_dep = declare_dependency(link_with : sub1_lib) diff --git a/test cases/common/207 rpath order/subprojects/sub2/lib.c b/test cases/common/207 rpath order/subprojects/sub2/lib.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/common/207 rpath order/subprojects/sub2/lib.c diff --git a/test cases/common/207 rpath order/subprojects/sub2/meson.build b/test cases/common/207 rpath order/subprojects/sub2/meson.build new file mode 100644 index 0000000..bc3510d --- /dev/null +++ b/test cases/common/207 rpath order/subprojects/sub2/meson.build @@ -0,0 +1,5 @@ +project('sub2', 'c') + +sub2_lib = library('sub2', 'lib.c') + +sub2_dep = declare_dependency(link_with : sub2_lib) |