]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Makefile: build libgit-rs and libgit-sys serially
authorDavid Aguilar <davvid@gmail.com>
Tue, 26 Aug 2025 23:35:25 +0000 (16:35 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 Aug 2025 00:02:12 +0000 (17:02 -0700)
"make -JN" with INCLUDE_LIBGIT_RS enabled causes cargo lock warnings
and can trigger ld errors during the build.

The build errors are caused by two inner "make" invocations getting
triggered concurrently: once inside of libgit-sys and another inside of
libgit-rs.

Make libgit-rs depend on libgit-sys so that "make" prevents them
from running concurrently. Apply the same logic to the test invocations.
Use cargo's "--manifest-path" option instead of "cd" in the recipes.

Signed-off-by: David Aguilar <davvid@gmail.com>
Acked-by: Kyle Lippincott <spectral@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
t/Makefile

index 70d1543b6b8688bf348f03f5e9cc1690fe547249..13ac35a151c6a637ef536cbc5f8d03482abfcd30 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3946,13 +3946,12 @@ unit-tests: $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) t/helper/test-tool$X
        $(MAKE) -C t/ unit-tests
 
 .PHONY: libgit-sys libgit-rs
-libgit-sys libgit-rs:
-       $(QUIET)(\
-               cd contrib/$@ && \
-               cargo build \
-       )
+libgit-sys:
+       $(QUIET)cargo build --manifest-path contrib/libgit-sys/Cargo.toml
+libgit-rs: libgit-sys
+       $(QUIET)cargo build --manifest-path contrib/libgit-rs/Cargo.toml
 ifdef INCLUDE_LIBGIT_RS
-all:: libgit-sys libgit-rs
+all:: libgit-rs
 endif
 
 LIBGIT_PUB_OBJS += contrib/libgit-sys/public_symbol_export.o
index 791e0a097893e9e94f72afefc1a0ecda6614e4cb..29dd226c7dcd9006baa4b1dfc0b903c32acbff6a 100644 (file)
@@ -190,15 +190,9 @@ perf:
 
 .PHONY: libgit-sys-test libgit-rs-test
 libgit-sys-test:
-       $(QUIET)(\
-               cd ../contrib/libgit-sys && \
-               cargo test \
-       )
-libgit-rs-test:
-       $(QUIET)(\
-               cd ../contrib/libgit-rs && \
-               cargo test \
-       )
+       $(QUIET)cargo test --manifest-path ../contrib/libgit-sys/Cargo.toml
+libgit-rs-test: libgit-sys-test
+       $(QUIET)cargo test --manifest-path ../contrib/libgit-rs/Cargo.toml
 ifdef INCLUDE_LIBGIT_RS
-all:: libgit-sys-test libgit-rs-test
+all:: libgit-rs-test
 endif