diff options
-rw-r--r-- | docs/markdown/Configuration.md | 1 | ||||
-rw-r--r-- | mesonbuild/backend/backends.py | 50 | ||||
-rw-r--r-- | mesonbuild/dependencies/ui.py | 2 | ||||
-rw-r--r-- | mesonbuild/environment.py | 4 | ||||
-rw-r--r-- | mesonbuild/mesonmain.py | 3 | ||||
-rw-r--r-- | mesonbuild/scripts/depfixer.py | 20 | ||||
-rw-r--r-- | test cases/failing/75 configuration immutable/input | 0 | ||||
-rw-r--r-- | test cases/failing/75 configuration immutable/meson.build | 12 |
8 files changed, 44 insertions, 48 deletions
diff --git a/docs/markdown/Configuration.md b/docs/markdown/Configuration.md index d8fa54e..89f423c 100644 --- a/docs/markdown/Configuration.md +++ b/docs/markdown/Configuration.md @@ -39,6 +39,7 @@ use a single `configuration_data` object as many times as you like, but it becomes immutable after being passed to the `configure_file` function. That is, after it has been used once to generate output the `set` function becomes unusable and trying to call it causes an error. +Copy of immutable `configuration_data` is still immutable. For more complex configuration file generation Meson provides a second form. To use it, put a line like this in your configuration file. diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 6499105..02ce52d 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -334,38 +334,38 @@ class Backend: def rpaths_for_bundled_shared_libraries(self, target): paths = [] for dep in target.external_deps: - if isinstance(dep, (dependencies.ExternalLibrary, dependencies.PkgConfigDependency)): - la = dep.link_args - if len(la) == 1 and os.path.isabs(la[0]): - # The only link argument is an absolute path to a library file. - libpath = la[0] - if libpath.startswith(('/usr/lib', '/lib')): - # No point in adding system paths. - continue - if os.path.splitext(libpath)[1] not in ['.dll', '.lib', '.so']: - continue - absdir = os.path.dirname(libpath) - if absdir.startswith(self.environment.get_source_dir()): - rel_to_src = absdir[len(self.environment.get_source_dir()) + 1:] - assert not os.path.isabs(rel_to_src), 'rel_to_src: {} is absolute'.format(rel_to_src) - paths.append(os.path.join(self.build_to_src, rel_to_src)) - else: - paths.append(absdir) + if not isinstance(dep, (dependencies.ExternalLibrary, dependencies.PkgConfigDependency)): + continue + la = dep.link_args + if len(la) != 1 or not os.path.isabs(la[0]): + continue + # The only link argument is an absolute path to a library file. + libpath = la[0] + if libpath.startswith(('/usr/lib', '/lib')): + # No point in adding system paths. + continue + # Windows doesn't support rpaths, but we use this function to + # emulate rpaths by setting PATH, so also accept DLLs here + if os.path.splitext(libpath)[1] not in ['.dll', '.lib', '.so', '.dylib']: + continue + absdir = os.path.dirname(libpath) + if absdir.startswith(self.environment.get_source_dir()): + rel_to_src = absdir[len(self.environment.get_source_dir()) + 1:] + assert not os.path.isabs(rel_to_src), 'rel_to_src: {} is absolute'.format(rel_to_src) + paths.append(os.path.join(self.build_to_src, rel_to_src)) + else: + paths.append(absdir) return paths def determine_rpath_dirs(self, target): link_deps = target.get_all_link_deps() - result = [] + result = set() for ld in link_deps: if ld is target: continue - prospective = self.get_target_dir(ld) - if prospective not in result: - result.append(prospective) - for rp in self.rpaths_for_bundled_shared_libraries(target): - if rp not in result: - result += [rp] - return result + result.add(self.get_target_dir(ld)) + result.update(self.rpaths_for_bundled_shared_libraries(target)) + return list(result) def object_filename_from_source(self, target, source): assert isinstance(source, mesonlib.File) diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py index 2f31196..b136d2b 100644 --- a/mesonbuild/dependencies/ui.py +++ b/mesonbuild/dependencies/ui.py @@ -409,7 +409,7 @@ class SDL2Dependency(ExternalDependency): 'sdl2', environment, None, kwargs, ['sdl2-config'], 'sdl2-config') if ctdep.found(): ctdep.compile_args = ctdep.get_config_value(['--cflags'], 'compile_args') - ctdep.links_args = ctdep.get_config_value(['--libs'], 'link_args') + ctdep.link_args = ctdep.get_config_value(['--libs'], 'link_args') return ctdep except Exception as e: mlog.debug('SDL 2 not found via sdl2-config. Trying next, error was:', str(e)) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 045be82..fc837d6 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -652,10 +652,6 @@ class Environment: def get_scratch_dir(self): return self.scratch_dir - def get_depfixer(self): - path = os.path.dirname(__file__) - return os.path.join(path, 'depfixer.py') - def detect_objc_compiler(self, want_cross): popen_exceptions = {} compilers, ccache, is_cross, exe_wrap = self._get_compilers('objc', 'OBJC', want_cross) diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index 82f5031..4a977a1 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -229,9 +229,6 @@ def run_script_command(args): elif cmdname == 'delsuffix': import mesonbuild.scripts.delwithsuffix as abc cmdfunc = abc.run - elif cmdname == 'depfixer': - import mesonbuild.scripts.depfixer as abc - cmdfunc = abc.run elif cmdname == 'dirchanger': import mesonbuild.scripts.dirchanger as abc cmdfunc = abc.run diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py index 185c76a..1d2cc60 100644 --- a/mesonbuild/scripts/depfixer.py +++ b/mesonbuild/scripts/depfixer.py @@ -372,8 +372,11 @@ def fix_darwin(fname, new_rpath): # non-executable target. Just return. return try: - for rp in rpaths: - subprocess.check_call(['install_name_tool', '-delete_rpath', rp, fname], + if rpaths: + args = [] + for rp in rpaths: + args += ['-delete_rpath', rp] + subprocess.check_call(['install_name_tool', fname] + args, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) if new_rpath: @@ -396,16 +399,3 @@ def fix_rpath(fname, new_rpath, verbose=True): if shutil.which('install_name_tool'): fix_darwin(fname, new_rpath) return 0 - -def run(args): - if len(args) < 1 or len(args) > 2: - print('This application resets target rpath.') - print('Don\'t run this unless you know what you are doing.') - print('%s: <binary file> <prefix>' % sys.argv[0]) - sys.exit(1) - fname = args[0] - new_rpath = None if len(args) == 1 else args[1] - return fix_rpath(fname, new_rpath) - -if __name__ == '__main__': - sys.exit(run(sys.argv[1:])) diff --git a/test cases/failing/75 configuration immutable/input b/test cases/failing/75 configuration immutable/input new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/failing/75 configuration immutable/input diff --git a/test cases/failing/75 configuration immutable/meson.build b/test cases/failing/75 configuration immutable/meson.build new file mode 100644 index 0000000..b6cac41 --- /dev/null +++ b/test cases/failing/75 configuration immutable/meson.build @@ -0,0 +1,12 @@ +project('configuration_data is immutable') + +a = configuration_data() + +configure_file( + configuration : a, + input : 'input', + output : 'output', +) + +still_immutable = a +still_immutable.set('hello', 'world') |