From 40638ad66610cf09070ab150fcd0d88752f8cd9c Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Thu, 1 May 2025 13:20:05 +0000 Subject: [PATCH] (zilch lang ninja build): workaround Meson .so linking Meson implements early-cutoff for shared library linking by having each .so generate a .symbols file, and only relinking when that changes. The issue is that this loses the direct dependency to the .so, and I'm unwilling to commit to putting every transitive dependency in the environment's VFS. Instead, work around it specifically for Meson. --- lang/ninja/src/build.sld | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lang/ninja/src/build.sld b/lang/ninja/src/build.sld index 8fdcc21..d1298f9 100644 --- a/lang/ninja/src/build.sld +++ b/lang/ninja/src/build.sld @@ -59,6 +59,14 @@ (fprintf (current-error-port) "Path doesn't exist as build edge: ~S\n" path) (error "Path doesn't exist as build edge" path)))) + ; Workaround for Meson not adding the .so as build dependency when linking, instead using a .symbols file. + ; This makes sense, as it only relinks when symbols change, but it breaks the dependency link, and is the only + ; place this happens in Ninja file processing. + ; TODO: how does nix-ninja handle this? + (when (string-suffix? ".so.symbols" path) + (let ((index (string-contains path ".p/"))) + (append-file (string-copy path 0 index))))) + ; Add the inputs, implicit dependencies, _and_ order-only dependencies to our vfs. (for-each append-file (build-edge-inputs current-edge)) (for-each append-file (build-edge-implicit-dependencies current-edge))