From 28091d07a0cb9ce30501ba36f10b42a3d296c4b7 Mon Sep 17 00:00:00 2001 From: kp2pml30 Date: Fri, 20 Sep 2024 17:47:27 +0400 Subject: [PATCH] fix realpath, separate -c --- ya-build | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ya-build b/ya-build index 166950b..d7a1235 100755 --- a/ya-build +++ b/ya-build @@ -367,7 +367,7 @@ rule CUSTOM_COMMAND rule COMPILE_C depfile = $out.d command = cd $ROOT_DIR && \ - $CC -MD -MF $out.d $cflags -o $out -c "$$(realpath -s "--relative-to=$ROOT_DIR" "$in")" && \ + $CC -MD -MF $out.d $cflags -o $out "$$(#{[RbConfig.ruby, Pathname.new(__FILE__).realpath, '__realpath_to_from'].map(&Shellwords.method(:escape)).join(' ')} "$in" "$ROOT_DIR")" && \ #{[RbConfig.ruby, Pathname.new(__FILE__).realpath, '__patch_dep'].map(&Shellwords.method(:escape)).join(' ')} $ROOT_DIR $out.d rule LINK_C @@ -585,9 +585,15 @@ def patch_dep() File.write(dep, res) end +def realpath_to_from + _, to, from = ARGV + puts Pathname.new(to).relative_path_from(from) +end + modes = { 'config' => method(:config), - '__patch_dep' => method(:patch_dep) + '__patch_dep' => method(:patch_dep), + '__realpath_to_from' => method(:realpath_to_from) } toExec = modes[ARGV[0]]