(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.
This commit is contained in:
puck 2025-05-01 13:20:05 +00:00
parent be1b4c3792
commit 40638ad666

View file

@ -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))