Skip to content

Commit 178d089

Browse files
committed
Merge pull request #866 from landstander668/add_platform
Add reporting of build platform
2 parents b413b77 + b2ecdc1 commit 178d089

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

help.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ const char *help_unknown_cmd(const char *cmd)
429429

430430
int cmd_version(int argc, const char **argv, const char *prefix)
431431
{
432+
static char build_platform[] = GIT_BUILD_PLATFORM;
433+
432434
/*
433435
* The format of this string should be kept stable for compatibility
434436
* with external projects that rely on the output of "git version".
@@ -437,6 +439,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)
437439
while (*++argv) {
438440
if (!strcmp(*argv, "--build-options")) {
439441
printf("sizeof-long: %d\n", (int)sizeof(long));
442+
printf("machine: %s\n", build_platform);
440443
/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */
441444
}
442445
}

help.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,16 @@ extern void list_commands(unsigned int colopts, struct cmdnames *main_cmds, stru
3333
*/
3434
extern void help_unknown_ref(const char *ref, const char *cmd, const char *error);
3535
#endif /* HELP_H */
36+
37+
/*
38+
* identify build platform
39+
*/
40+
#ifndef GIT_BUILD_PLATFORM
41+
#if defined __x86__ || defined __i386__ || defined __i586__ || defined __i686__
42+
#define GIT_BUILD_PLATFORM "x86";
43+
#elif defined __x86_64__
44+
#define GIT_BUILD_PLATFORM "x86_64";
45+
#else
46+
#define GIT_BUILD_PLATFORM "unknown";
47+
#endif
48+
#endif

0 commit comments

Comments
 (0)