Re: [PATCH 10/14] rust: add a build.rs script for tests
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 29, 2025, 16:43 UTC
- Message-ID
- <xmqqms59acak.fsf@gitster.g>
- In-Reply-To
- <20251027004404.2152927-11-sandals@crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 5 quoted lines
> Cargo uses the build.rs script to determine how to compile and link a > binary. The only binary we're generating, however, is for our tests, > but in a future commit, we're going to link against libgit.a for some > functionality and we'll need to make sure the test binaries are > complete.
OK.
Show 13 quoted lines
> -$(RUST_LIB): Cargo.toml $(RUST_SOURCES)
> +$(RUST_LIB): Cargo.toml $(RUST_SOURCES) $(XDIFF_LIB) $(LIB_FILE) $(REFTABLE_LIB)
> $(QUIET_CARGO)cargo build $(CARGO_ARGS)
> ...
> +fn main() {
> + println!("cargo::rustc-link-search=.");
> + println!("cargo::rustc-link-search=reftable");
> + println!("cargo::rustc-link-search=xdiff");
> + println!("cargo::rustc-link-lib=git");
> + println!("cargo::rustc-link-lib=reftable");
> + println!("cargo::rustc-link-lib=z");
> + println!("cargo::rustc-link-lib=xdiff");
> +}Hmm, I recall Ezekiel earlier arguing to roll reftable and xdiff libraries into libgit.a as it is a lot more cumbersome to have to link with multiple libraries (sorry, I may be misremembering and do not have reference handy), but if the above is all it takes to link with these, perhaps it is not such a huge deal?
I am a bit confused.
XDIFF_LIB and REFTABLE_LIB are gone from Makefile on 'master' already. Perhaps we should revert earlier series from him?
Thanks.