Skip to content

Commit ec53539

Browse files
committed
Merge pull request #866 from landstander668/add_platform
Add reporting of build platform
2 parents cfcdb3e + d6a7ee6 commit ec53539

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
@@ -424,6 +424,8 @@ const char *help_unknown_cmd(const char *cmd)
424424

425425
int cmd_version(int argc, const char **argv, const char *prefix)
426426
{
427+
static char build_platform[] = GIT_BUILD_PLATFORM;
428+
427429
/*
428430
* The format of this string should be kept stable for compatibility
429431
* with external projects that rely on the output of "git version".
@@ -432,6 +434,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)
432434
while (*++argv) {
433435
if (!strcmp(*argv, "--build-options")) {
434436
printf("sizeof-long: %d\n", (int)sizeof(long));
437+
printf("machine: %s\n", build_platform);
435438
/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */
436439
}
437440
}

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)