Replace GIT_SHA with a more versatile BUILD_ID definition.

When compiling cc65, it will by default place the git hash (if available) of
the checked out commit in the version string.  This isn't useful when building
a package for a Linux distribution, since there either won't be an upstream
git hash if there is one at all.

Thus we replace GIT_SHA with a more versatile BUILD_ID, which can be defined
to any arbitrary string.  When building, its contents will be appended to the
version string instead of the git hash.

If BUILD_ID is not defined by the user the behaviour will be exactly the same
as before.  That means BUILD_ID gets automatically defined to Git <GIT_SHA>,
if it can be determined from a checkout.
This commit is contained in:
Björn Esser
2019-06-09 01:19:53 +02:00
committed by Oliver Schmidt
parent e34ee32973
commit 83e0c70de5
2 changed files with 9 additions and 9 deletions

View File

@@ -61,8 +61,8 @@ const char* GetVersionAsString (void)
/* Returns the version number as a string in a static buffer */
{
static char Buf[60];
#if defined(GIT_SHA)
xsnprintf (Buf, sizeof (Buf), "%u.%u - Git %s", VER_MAJOR, VER_MINOR, STRINGIZE (GIT_SHA));
#if defined(BUILD_ID)
xsnprintf (Buf, sizeof (Buf), "%u.%u - %s", VER_MAJOR, VER_MINOR, STRINGIZE (BUILD_ID));
#else
xsnprintf (Buf, sizeof (Buf), "%u.%u", VER_MAJOR, VER_MINOR);
#endif