Make the rpath order deterministic. (#3932)

pull/3947/head
Rafael Ávila de Espíndola 6 years ago committed by Jussi Pakkanen
parent 10a1a39961
commit c7360dd426
  1. 2
      mesonbuild/backend/backends.py
  2. 19
      run_unittests.py
  3. 11
      test cases/unit/35 rpath order/meson.build
  4. 3
      test cases/unit/35 rpath order/myexe.c
  5. 0
      test cases/unit/35 rpath order/subprojects/sub1/lib.c
  6. 5
      test cases/unit/35 rpath order/subprojects/sub1/meson.build
  7. 0
      test cases/unit/35 rpath order/subprojects/sub2/lib.c
  8. 5
      test cases/unit/35 rpath order/subprojects/sub2/meson.build

@ -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

@ -3600,6 +3600,25 @@ 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.unit_test_dir, '35 rpath order')
self.init(testdir)
if is_osx():
rpathre = re.compile('-rpath,.*/subprojects/sub1.*-rpath,.*/subprojects/sub2')
else:
rpathre = re.compile('-rpath,\$\$ORIGIN/subprojects/sub1:\$\$ORIGIN/subprojects/sub2')
with open(os.path.join(self.builddir, 'build.ninja')) as bfile:
for line in bfile:
if '-rpath' in line:
self.assertRegex(line, rpathre)
return
raise RuntimeError('Could not find the rpath')
@skipIfNoPkgconfig
def test_usage_external_library(self):
'''

@ -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])

@ -0,0 +1,3 @@
int main(void) {
return 0;
}

@ -0,0 +1,5 @@
project('sub1', 'c')
sub1_lib = library('sub1', 'lib.c')
sub1_dep = declare_dependency(link_with : sub1_lib)

@ -0,0 +1,5 @@
project('sub2', 'c')
sub2_lib = library('sub2', 'lib.c')
sub2_dep = declare_dependency(link_with : sub2_lib)
Loading…
Cancel
Save