git: fix build with osxkeychain
Cherry-pick a patch from Git next and make further adjustments to allow it to build in our environment.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
diff -ur a/Makefile b/Makefile
|
||||
--- a/Makefile 2026-02-14 15:58:16.624434564 -0500
|
||||
+++ b/Makefile 2026-02-14 15:59:25.701016105 -0500
|
||||
@@ -4059,9 +4059,9 @@
|
||||
contrib/libgit-sys/libgitpub.a: $(LIBGIT_HIDDEN_EXPORT)
|
||||
$(AR) $(ARFLAGS) $@ $^
|
||||
|
||||
-contrib/credential/osxkeychain/git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain.o $(LIB_FILE) GIT-LDFLAGS
|
||||
+contrib/credential/osxkeychain/git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain.o $(LIB_FILE) $(RUST_LIB) GIT-LDFLAGS
|
||||
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
|
||||
- $(filter %.o,$^) $(LIB_FILE) $(EXTLIBS) -framework Security -framework CoreFoundation
|
||||
+ $(filter %.o,$^) $(LIB_FILE) $(RUST_LIB) $(EXTLIBS) -framework Security -framework CoreFoundation
|
||||
|
||||
contrib/credential/osxkeychain/git-credential-osxkeychain.o: contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS
|
||||
$(QUIET_LINK)$(CC) -o $@ -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
|
||||
@@ -130,6 +130,17 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
url = "https://lore.kernel.org/git/20251201031040.1120091-1-brianmlyles@gmail.com/raw";
|
||||
hash = "sha256-vvhbvg74OIMzfksHiErSnjOZ+W0M/T9J8GOQ4E4wKbU=";
|
||||
})
|
||||
# Fix build failure on Darwin when building Keychain integration
|
||||
# See https://github.com/git/git/pull/2188 and https://github.com/Homebrew/homebrew-core/pull/266961
|
||||
(fetchurl {
|
||||
name = "osxkeychain-define-build-targets-in-toplevel-Makefile.patch";
|
||||
url = "https://lore.kernel.org/git/pull.2046.v2.git.1770775169908.gitgitgadget@gmail.com/raw";
|
||||
hash = "sha256-7jTiMM5XFRDj/srtVf8olW62T/mesqLcyRp3NZJcid8=";
|
||||
})
|
||||
]
|
||||
++ lib.optionals rustSupport [
|
||||
# The above patch doesn’t work with Rust support enabled.
|
||||
./osxkeychain-link-rust_lib.patch
|
||||
]
|
||||
++ lib.optionals withSsh [
|
||||
# Hard-code the ssh executable to ${pkgs.openssh}/bin/ssh instead of
|
||||
@@ -271,7 +282,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
make -C contrib/diff-highlight "''${flagsArray[@]}"
|
||||
''
|
||||
+ lib.optionalString osxkeychainSupport ''
|
||||
make -C contrib/credential/osxkeychain "''${flagsArray[@]}"
|
||||
make -C contrib/credential/osxkeychain COMPUTE_HEADER_DEPENDENCIES=no "''${flagsArray[@]}"
|
||||
''
|
||||
+ lib.optionalString withLibsecret ''
|
||||
make -C contrib/credential/libsecret "''${flagsArray[@]}"
|
||||
|
||||
Reference in New Issue
Block a user