All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Knoble <ben.knoble@gmail.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: Shardul Natu via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org,
	Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
	Shnatu <snatu@google.com>, Koji Nakamaru <koji.nakamaru@gree.net>
Subject: lipo availability [was: [PATCH v2] Makefile: link osxkeychain & support universal Rust]
Date: Fri, 3 Jul 2026 08:02:44 -0400	[thread overview]
Message-ID: <539E5E6E-ADEB-415B-B126-18FC0BDABC99@gmail.com> (raw)
In-Reply-To: <akZQmDYe9MtTdGM2@pks.im>


> Le 2 juil. 2026 à 07:57, Patrick Steinhardt <ps@pks.im> a écrit :
> 
> On Wed, Jul 01, 2026 at 10:01:43PM +0000, Shardul Natu via GitGitGadget wrote:
>> From: Shnatu <snatu@google.com>
>> 
>> 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.
> 
>>  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.
>> 
> 
>> diff --git a/Makefile b/Makefile
>> index 1f3f099f5c..8d49ecc897 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -3019,11 +3030,33 @@ scalar$X: scalar.o GIT-LDFLAGS $(GITLIBS)
>> $(LIB_FILE): $(LIB_OBJS)
>>    $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
>> 
>> +ifndef NO_RUST
>> +ifeq ($(RUST_TARGETS),)
>> $(RUST_LIB): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)
>>    $(QUIET_CARGO)cargo build $(CARGO_ARGS)
>> +else
>> +ifneq ($(words $(RUST_TARGETS)),1)
>> +ifneq ($(uname_S),Darwin)
>> +$(error Building universal Rust libraries requires macOS (lipo is not available on $(uname_S)))
>> +endif
>> +endif
>> +
>> +RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))
>> +$(RUST_MEMBER_LIBS): target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)
>> 
>> +    $(QUIET_CARGO)cargo build $(CARGO_ARGS) --target $*
>> +
>> +$(RUST_LIB): $(RUST_MEMBER_LIBS)
>> +    $(QUIET_GEN)\
>> +    if [ $(words $(RUST_TARGETS)) -gt 1 ]; then \
>> +        lipo -create $^ -output $@; \
> 
> Can we assume lipo to be generally available on macOS?

From my digging, universal binaries to support the PowerPC transition to Intel have been available since Xcode 2.1 from 2005 (whose release notes, if they ever existed, have been impossible for me to find). Of course for modern (Universal Binary 2) formats, you will need newer Xcode: the format was announced in 2020, so I suspect Xcode 12 is a minimum but not necessarily sufficient version. I have not been able to find a release note specific to UB2, though in 12.2 there is mention of both universal binaries and the arm architecture. Apple’s announcement [1] supports the argument for v12.

[1]: https://www.apple.com/au/newsroom/2020/06/apple-announces-mac-transition-to-apple-silicon/

  parent reply	other threads:[~2026-07-03 12:02 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05 17:26 [PATCH] Makefile: link osxkeychain helper against Rust Shardul Natu via GitGitGadget
2026-05-05 19:08 ` Kristoffer Haugsbakk
2026-05-07  0:39   ` Shnatu
2026-05-08  2:54 ` Junio C Hamano
2026-05-08  9:33   ` Koji Nakamaru
2026-05-08 17:44     ` Shnatu
2026-07-01 22:01 ` [PATCH v2] Makefile: link osxkeychain & support universal Rust Shardul Natu via GitGitGadget
2026-07-02  1:35   ` Junio C Hamano
2026-07-02 11:50   ` Patrick Steinhardt
2026-07-02 22:30     ` Shardul Natu
2026-07-03  5:15       ` Patrick Steinhardt
2026-07-03 12:02     ` Ben Knoble [this message]
2026-07-02 22:22   ` [PATCH v3 0/2] Makefile: link osxkeychain helper against Rust Shardul Natu via GitGitGadget
2026-07-02 22:22     ` [PATCH v3 1/2] Makefile: add $(RUST_LIB) prerequisite to osxkeychain Shardul Natu via GitGitGadget
2026-07-02 22:22     ` [PATCH v3 2/2] Makefile: support universal macOS builds via RUST_TARGETS Shardul Natu via GitGitGadget
2026-07-03  5:36       ` Junio C Hamano
2026-07-03 17:37         ` Shardul Natu
2026-07-04 18:05     ` [PATCH v4 0/2] Makefile: link osxkeychain helper against Rust Shardul Natu via GitGitGadget
2026-07-04 18:05       ` [PATCH v4 1/2] Makefile: add $(RUST_LIB) prerequisite to osxkeychain Shardul Natu via GitGitGadget
2026-07-06 10:49         ` Patrick Steinhardt
2026-07-04 18:05       ` [PATCH v4 2/2] Makefile: support universal macOS builds via RUST_TARGETS Shardul Natu via GitGitGadget
2026-07-06 10:49         ` Patrick Steinhardt
2026-07-05  4:08       ` [PATCH v4 0/2] Makefile: link osxkeychain helper against Rust Junio C Hamano
2026-07-05 17:38         ` Shardul Natu
2026-07-06 17:14       ` [PATCH v5 " Shardul Natu via GitGitGadget
2026-07-06 17:14         ` [PATCH v5 1/2] Makefile: add $(GITLIBS) prerequisite to osxkeychain Shardul Natu via GitGitGadget
2026-07-06 19:52           ` Junio C Hamano
2026-07-06 17:14         ` [PATCH v5 2/2] Makefile: support universal macOS builds via RUST_TARGETS Shardul Natu via GitGitGadget
2026-07-06 22:52         ` [PATCH v6 0/3] Makefile: link osxkeychain helper against Rust Shardul Natu via GitGitGadget
2026-07-06 22:52           ` [PATCH v6 1/3] Makefile: add $(RUST_LIB) prerequisite to osxkeychain Shardul Natu via GitGitGadget
2026-07-06 22:52           ` [PATCH v6 2/3] Makefile: support universal macOS builds via RUST_TARGETS Shardul Natu via GitGitGadget
2026-07-06 22:52           ` [PATCH v6 3/3] contrib: wire up osxkeychain in contrib/Makefile on macOS Shardul Natu via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=539E5E6E-ADEB-415B-B126-18FC0BDABC99@gmail.com \
    --to=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=koji.nakamaru@gree.net \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=ps@pks.im \
    --cc=snatu@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.