windows: Canonicalize `:` in filenames
Fixes https://github.com/mesonbuild/meson/issues/7265
This commit is contained in:
parent
e2379148a6
commit
eab0e5a8b3
|
@ -501,6 +501,12 @@ class Backend:
|
|||
target.rpath_dirs_to_remove.update([d.encode('utf8') for d in result])
|
||||
return tuple(result)
|
||||
|
||||
@staticmethod
|
||||
def canonicalize_filename(fname):
|
||||
for ch in ('/', '\\', ':'):
|
||||
fname = fname.replace(ch, '_')
|
||||
return fname
|
||||
|
||||
def object_filename_from_source(self, target, source):
|
||||
assert isinstance(source, mesonlib.File)
|
||||
build_dir = self.environment.get_build_dir()
|
||||
|
@ -531,7 +537,7 @@ class Backend:
|
|||
source = os.path.relpath(os.path.join(build_dir, rel_src),
|
||||
os.path.join(self.environment.get_source_dir(), target.get_subdir()))
|
||||
machine = self.environment.machines[target.for_machine]
|
||||
return source.replace('/', '_').replace('\\', '_') + '.' + machine.get_object_suffix()
|
||||
return self.canonicalize_filename(source) + '.' + machine.get_object_suffix()
|
||||
|
||||
def determine_ext_objs(self, extobj, proj_dir_to_build_root):
|
||||
result = []
|
||||
|
|
|
@ -2160,7 +2160,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
|
|||
src_filename = os.path.basename(src)
|
||||
else:
|
||||
src_filename = src
|
||||
obj_basename = src_filename.replace('/', '_').replace('\\', '_')
|
||||
obj_basename = self.canonicalize_filename(src_filename)
|
||||
rel_obj = os.path.join(self.get_target_private_dir(target), obj_basename)
|
||||
rel_obj += '.' + self.environment.machines[target.for_machine].get_object_suffix()
|
||||
commands += self.get_compile_debugfile_args(compiler, target, rel_obj)
|
||||
|
|
|
@ -10,6 +10,8 @@ conf_data.set('THREE', 3)
|
|||
|
||||
outfile = configure_file(
|
||||
input : 'mod3.fpp', output : 'mod3.f90', configuration : conf_data)
|
||||
# Manually build absolute path to source file to test
|
||||
# https://github.com/mesonbuild/meson/issues/7265
|
||||
three = library('mod3', meson.current_build_dir() / 'mod3.f90')
|
||||
|
||||
templates_basenames = ['mod2', 'mod1']
|
||||
|
|
Loading…
Reference in New Issue