(zilch lang ninja build): More compatibility fixes

Change-Id: Ic56e71d13e8f897c165b7d8379840ac16a6a6964
This commit is contained in:
puck 2025-11-24 18:37:10 +00:00
parent 48e8cd9455
commit f9336ab1ad

View file

@ -171,12 +171,12 @@
; This file is produced by another build edge. Add it to our input vfs.
(input-file
(let ((prev-copy-input-files copy-input-files))
(if (string-prefix? "/nix/store" path)
(if (string-prefix? "/nix/store" (normalize-path path))
(set! copy-input-files #~,(string-append #$prev-copy-input-files "\n" "$COREUTILS/mkdir -p $($COREUTILS/dirname " path "); $COREUTILS/cp -rf --preserve=timestamps " #$(force input-file) " /" path))
(set! copy-input-files #~,(string-append #$prev-copy-input-files "\n" "$COREUTILS/mkdir -p bdir/" (build-env-build-dir env) "/$($COREUTILS/dirname " path "); $COREUTILS/cp -rf --preserve=timestamps " #$(force input-file) " bdir/" (build-env-build-dir env) "/" path)))))
(else
(unless (string-prefix? "/nix/store" path)
(unless (string-prefix? "/nix/store" (normalize-path path))
(error "Path doesn't exist as build edge" (list path (build-edge-outputs current-edge))))))
; Workaround for Meson not adding the .so as build dependency when linking, instead using a .symbols file.
@ -216,6 +216,17 @@
(append-file input)))
(append (build-edge-inputs so-edge) (build-edge-implicit-dependencies so-edge) (build-edge-order-only-dependencies so-edge)))))
; When we depend on a thinly-linked static library, depend on _its_ inputs;
; this is necessary to ensure the thin archive can be resolved.
(when
(and input-edge
(string=? (build-edge-rule (built-edge-edge input-edge)) "STATIC_LINKER")
(let
((link-args (mapping-ref/default (build-edge-variables (built-edge-edge input-edge)) "LINK_ARGS" "")))
(or (string-contains link-args "T") (string-contains link-args "--thin"))))
(for-each append-file
(build-edge-inputs (built-edge-edge input-edge))))
(when (string=? path "PHONY")
(set! is-meson-phony #t)))