Skip to content

pr-git-2288/kiranani/next-v2

tagged this 01 Jul 22:01
From: Shnatu <snatu@google.com>

When Rust is enabled, ensure that the git-credential-osxkeychain
helper is linked with the necessary Rust libraries.

Also, introduce native support for macOS Universal Binaries
(multi-architecture builds) in the Git build system by allowing
the user to specify a list of target triples in the RUST_TARGETS
environment variable.

To implement this cleanly without complex shell scripting in recipes:
  1. We introduce a declarative Make pattern rule (target/%/...) to
     compile each target-specific library slice (e.g.,
     target/aarch64-apple-darwin/...).
  2. We update the $(RUST_LIB) recipe to depend on the list of
     compiled target-specific member libraries ($(RUST_MEMBER_LIBS)).
  3. On macOS, if multiple targets are specified, we use lipo to
     combine them into a single Universal static library at
     target/release/libgitcore.a.
  4. If only one target is specified, we copy it to the standard
     path.
  5. We enforce that building for multiple targets requires macOS
     (as lipo is only available there), raising a clear make error
     on other platforms.

This is a highly elegant and native Makefile solution that avoids
complex shell scripting in recipes and fully supports macOS Universal
Binaries.

Signed-off-by: Shardul Natu <snatu@google.com>

Submitted-As: https://lore.kernel.org/git/pull.2288.v2.git.git.1782943303219.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2288.git.git.1778001976709.gitgitgadget@gmail.com
Assets 2
Loading