Skip to content

Commit

Permalink
fixup config.mak.uname
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Hostetler <jeffhostetler@github.com>
  • Loading branch information
jeffhostetler committed Oct 17, 2023
1 parent f6f8321 commit bf5d26b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config.mak.uname
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ ifeq ($(uname_S),Darwin)
COMPAT_OBJS += compat/precompose_utf8.o
BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
# Create universal binaries. HOST_CPU is a bit of a lie and only
# used in `git version --build-options`. We'll fix that in code.
BASIC_CFLAGS += -arch arm64 -arch x86_64
HOST_CPU += universal
HAVE_BSD_SYSCTL = YesPlease
Expand Down
16 changes: 15 additions & 1 deletion help.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,20 @@ const char *help_unknown_cmd(const char *cmd)
exit(1);
}

static const char *git_host_cpu(void) {
#if defined(__APPLE__)
if (!strcmp(GIT_HOST_CPU, "universal")) {
#if defined(__x86_64__)
return "x86_64";
#elif defined(__aarch64__)
return "arm64";
#endif
}
#endif

return GIT_HOST_CPU;
}

void get_version_info(struct strbuf *buf, int show_build_options)
{
/*
Expand All @@ -741,7 +755,7 @@ void get_version_info(struct strbuf *buf, int show_build_options)
strbuf_addf(buf, "git version %s\n", git_version_string);

if (show_build_options) {
strbuf_addf(buf, "cpu: %s\n", GIT_HOST_CPU);
strbuf_addf(buf, "cpu: %s\n", git_host_cpu());
if (git_built_from_commit_string[0])
strbuf_addf(buf, "built from commit: %s\n",
git_built_from_commit_string);
Expand Down

0 comments on commit bf5d26b

Please sign in to comment.