File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -72,20 +72,24 @@ def _perl_xs_implementation(ctx):
7272
7373 gen = []
7474 cc_infos = []
75- args_typemaps = []
76-
77- for typemap in ctx .files .typemaps :
78- args_typemaps += ["-typemap" , typemap .short_path ]
7975
8076 for src in ctx .files .srcs :
8177 c_execpath = paths .replace_extension (src .path , ".c" )
8278 o_packagepath = paths .join ("_objs/execroot/" , c_execpath )
8379 out = ctx .actions .declare_file (o_packagepath )
8480
81+ # typemap paths are resolved relative to their src.
82+ src_dir = paths .dirname (src .path )
83+ args_typemaps_relative = []
84+ for typemap in ctx .files .typemaps :
85+ # Calculate the relative path from the src directory to the typemap path
86+ relative_typemap_path = paths .relativize (typemap .path , src_dir )
87+ args_typemaps_relative += ["-typemap" , relative_typemap_path ]
88+
8589 ctx .actions .run (
8690 outputs = [out ],
8791 inputs = [src ] + ctx .files .typemaps ,
88- arguments = args_typemaps + ["-output" , out .path , src .path ],
92+ arguments = args_typemaps_relative + ["-output" , out .path , src .path ],
8993 progress_message = "Translitterating %s to %s" % (src .short_path , out .short_path ),
9094 executable = xsubpp ,
9195 tools = toolchain_files ,
You can’t perform that action at this time.
0 commit comments