git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v8 0/3] Makefile: link osxkeychain helper against Rust

From
SGShardul Natu via GitGitGadget <gitgitgadget@gmail.com>
Date
Jul 8, 2026, 03:21 UTC
Message-ID
<pull.2288.v8.git.git.1783480879.gitgitgadget@gmail.com>
In-Reply-To
<pull.2288.v7.git.git.1783443745.gitgitgadget@gmail.com>

This series improves macOS build reliability, automated CI verification, and distribution support when Rust is enabled in the Git build system. It addresses three distinct challenges: a parallel build race condition in git-credential-osxkeychain, support for macOS Universal Binaries (multi-architecture distribution), and missing automated CI test wiring for macOS contrib utilities.

Why This Series is Needed =========================

 1. Parallel Build Race Condition (make -j): While commit 522ea8ef7d
    ("osxkeychain: fix build with Rust") updated the link command for
    git-credential-osxkeychain to pass $(LIBS), it omitted $(RUST_LIB) from
    the target prerequisite list. When running a parallel build (make -j)
    from a clean working tree, Make can attempt to link
    git-credential-osxkeychain before Cargo has finished compiling
    libgitcore.a, causing linker failures.
 2. macOS Universal Binary (lipo) Support: On macOS, Universal Binaries
    bundle native executable code for multiple architectures (Intel x86_64
    and Apple Silicon arm64) into a single file. This is standard practice
    for macOS distribution and CI packaging (such as Burrito, Homebrew, and
    Git's macOS CI runners), allowing a single artifact to run natively
    across all Macs without Rosetta translation.

While Apple's C compiler (clang) natively supports universal builds by passing -arch x86_64 -arch arm64 in CFLAGS and LDFLAGS, Cargo and rustc do not support multiple -arch flags in a single invocation. Instead, Cargo must be invoked separately for each target triple (--target x86_64-apple-darwin and --target aarch64-apple-darwin). This series bridges that gap.

 3. Automated CI Verification for Contrib on macOS: When running make test
    with TEST_CONTRIB_TOO=yes (default in macOS CI workflows), $(MAKE) -C
    contrib/ test is invoked. However, contrib/Makefile only invoked tests
    for diff-highlight and subtree, meaning git-credential-osxkeychain was
    never compiled or verified during standard CI test runs.

Overview of Patches ===================

 * Patch 1: Makefile: add $(RUST_LIB) prerequisite to osxkeychain Adds
   $(RUST_LIB) as a prerequisite dependency to the osxkeychain target,
   eliminating the parallel build race condition. Additionally, wraps the
   definitions of $(RUST_LIB) and the rust build target in ifndef NO_RUST so
   that disabling Rust cleanly makes the dependency a no-op.
 * Patch 2: Makefile: support universal macOS builds via RUST_TARGETS Allows
   users to specify space-separated target triples in RUST_TARGETS.
   Introduces declarative pattern rules (target/%/...) to compile each
   target slice via Cargo, and uses lipo (part of the mandatory Xcode
   Command Line Tools) to combine the resulting static archives into a
   universal library at target/release/libgitcore.a. Uses
   mkdir_p_parent_template to guarantee directory creation before lipo.
   
   * Patch 3: contrib: wire up osxkeychain in contrib/Makefile on macOS Adds
     a test target to contrib/credential/osxkeychain/Makefile that depends
     on building git-credential-osxkeychain. Introduces a generic OS_CONTRIB
     variable in contrib/Makefile to conditionally wire
     credential/osxkeychain into all, test, and clean whenever running on
     macOS (Darwin). This guarantees that standard CI test runs on macOS
     automatically compile and link the helper, preventing build
     regressions.
Changes since v7:
 * Added inclusion of ../config.mak.uname to the top of contrib/Makefile in
   the canonical order. This guarantees that $(uname_S) is correctly defined
   on the shell, preventing the OS_CONTRIB additions from being silently
   ignored.
Changes since v5:
 * Reverted Patch 1 to depend explicitly on $(LIB_FILE) $(RUST_LIB) rather
   than $(GITLIBS). Unlike Git builtins or scalar (which define cmd_main()),
   git-credential-osxkeychain.c defines its own standalone main(), meaning
   $(GITLIBS) caused a duplicate symbol error for _main during linking.
 * Added Patch 3 ("contrib: wire up osxkeychain in contrib/Makefile on
   macOS") using a scalable OS_CONTRIB variable so that running make test
   with TEST_CONTRIB_TOO=yes in macOS CI workflows automatically verifies
   compilation and linking integrity.
Changes since v4:
 * Changed the osxkeychain prerequisite dependency from $(LIB_FILE)
   $(RUST_LIB) to $(GITLIBS) to match the canonical prerequisite pattern
   used by all other core Git targets linking $(LIBS).
Changes since v3:
 * Removed leading @ from $(call mkdir_p_parent_template) so it relies on
   the built-in $(QUIET_MKDIR_P_PARENT) behavior, matching existing Makefile
   conventions.
 * Replaced if [ with if test in Bourne shell recipe snippets to strictly
   adhere to the project's CodingGuidelines.
Changes since v2:
 * Split the original combined commit into a two-patch series to separate
   prerequisite bug fixes from Universal Binary features.
 * Added $(call mkdir_p_parent_template) prior to invoking lipo to guarantee
   that parent target directories exist.
Shardul Natu (3):
  Makefile: add $(RUST_LIB) prerequisite to osxkeychain
  Makefile: support universal macOS builds via RUST_TARGETS
  contrib: wire up osxkeychain in contrib/Makefile on macOS
 Makefile                                | 46 ++++++++++++++++++++++---
 contrib/Makefile                        | 12 +++++++
 contrib/credential/osxkeychain/Makefile |  4 ++-
 3 files changed, 56 insertions(+), 6 deletions(-)
base-commit: 00534a21ce949ef80a5b8b9d7fc20b7d381038e9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2288%2Fkiranani%2Fnext-v8
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2288/kiranani/next-v8
Pull-Request: https://github.com/git/git/pull/2288
Range-diff vs v7:
 1:  8f2bd4b14a = 1:  8f2bd4b14a Makefile: add $(RUST_LIB) prerequisite to osxkeychain
 2:  a999be6939 = 2:  a999be6939 Makefile: support universal macOS builds via RUST_TARGETS
 3:  32af2c51a8 ! 3:  5659709ab4 contrib: wire up osxkeychain in contrib/Makefile on macOS
     @@ Commit message
      
       ## contrib/Makefile ##
      @@
     ++include ../config.mak.uname
      +-include ../config.mak.autogen
      +-include ../config.mak
      +
     ++
      +ifeq ($(uname_S),Darwin)
      +OS_CONTRIB += credential/osxkeychain
      +endif
-- 
gitgitgadget
Previous: Junio C HamanoNext: Shardul Natu via GitGitGadget
Message 42 of 46 in “Makefile: link osxkeychain helper against Rust”
  1. Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, May 5, 2026
  2. Kristoffer HaugsbakkMay 5, 2026
  3. ShnatuMay 7, 2026
  4. Junio C HamanoMay 8, 2026
  5. Koji NakamaruMay 8, 2026
  6. ShnatuMay 8, 2026
  7. Makefile: link osxkeychain & support universal RustShardul Natu via GitGitGadget, Jul 1, 2026
  8. Junio C HamanoJul 2, 2026
  9. Patrick SteinhardtJul 2, 2026
  10. Shardul NatuJul 2, 2026
  11. Patrick SteinhardtJul 3, 2026
  12. lipo availability [was: [PATCH v2] Makefile: link osxkeychain & support universal Rust]Ben Knoble, Jul 3, 2026
  13. 0/2 Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, Jul 2, 2026
  14. 1/2 Makefile: add $(RUST_LIB) prerequisite to osxkeychainShardul Natu via GitGitGadget, Jul 2, 2026
  15. 2/2 Makefile: support universal macOS builds via RUST_TARGETSShardul Natu via GitGitGadget, Jul 2, 2026
  16. Junio C HamanoJul 3, 2026
  17. Shardul NatuJul 3, 2026
  18. 0/2 Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, Jul 4, 2026
  19. 1/2 Makefile: add $(RUST_LIB) prerequisite to osxkeychainShardul Natu via GitGitGadget, Jul 4, 2026
  20. Patrick SteinhardtJul 6, 2026
  21. 2/2 Makefile: support universal macOS builds via RUST_TARGETSShardul Natu via GitGitGadget, Jul 4, 2026
  22. Patrick SteinhardtJul 6, 2026
  23. Junio C HamanoJul 5, 2026
  24. Shardul NatuJul 5, 2026
  25. 0/2 Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, Jul 6, 2026
  26. 1/2 Makefile: add $(GITLIBS) prerequisite to osxkeychainShardul Natu via GitGitGadget, Jul 6, 2026
  27. Junio C HamanoJul 6, 2026
  28. ShnatuJul 7, 2026
  29. ShnatuJul 7, 2026
  30. Shardul NatuJul 8, 2026
  31. 2/2 Makefile: support universal macOS builds via RUST_TARGETSShardul Natu via GitGitGadget, Jul 6, 2026
  32. 0/3 Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, Jul 6, 2026
  33. 1/3 Makefile: add $(RUST_LIB) prerequisite to osxkeychainShardul Natu via GitGitGadget, Jul 6, 2026
  34. 2/3 Makefile: support universal macOS builds via RUST_TARGETSShardul Natu via GitGitGadget, Jul 6, 2026
  35. 3/3 contrib: wire up osxkeychain in contrib/Makefile on macOSShardul Natu via GitGitGadget, Jul 6, 2026
  36. 0/3 Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, Jul 7, 2026
  37. 1/3 Makefile: add $(RUST_LIB) prerequisite to osxkeychainShardul Natu via GitGitGadget, Jul 7, 2026
  38. 2/3 Makefile: support universal macOS builds via RUST_TARGETSShardul Natu via GitGitGadget, Jul 7, 2026
  39. 3/3 contrib: wire up osxkeychain in contrib/Makefile on macOSShardul Natu via GitGitGadget, Jul 7, 2026
  40. Junio C HamanoJul 8, 2026
  41. Junio C HamanoJul 7, 2026
  42. 0/3 Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, Jul 8, 2026
  43. 1/3 Makefile: add $(RUST_LIB) prerequisite to osxkeychainShardul Natu via GitGitGadget, Jul 8, 2026
  44. 2/3 Makefile: support universal macOS builds via RUST_TARGETSShardul Natu via GitGitGadget, Jul 8, 2026
  45. 3/3 contrib: wire up osxkeychain in contrib/Makefile on macOSShardul Natu via GitGitGadget, Jul 8, 2026
  46. Junio C HamanoJul 8, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.