48 lines
2.0 KiB
Diff
48 lines
2.0 KiB
Diff
|
Description: Allow overriding git hash in version string with package version
|
||
|
When compiling cc65, it will place the git hash of the checked out commit in
|
||
|
the version string which isn't useful when building a distribution package
|
||
|
since there either won't be an upstream git hash if there is one at all. Make
|
||
|
it so that if the variable PKG_VERSION is defined when building, its contents
|
||
|
will be placed into the version string instead of the git hash.
|
||
|
Author: Andreas Bombe <aeb@debian.org>
|
||
|
Last-Update: 2017-11-16
|
||
|
---
|
||
|
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
|
||
|
Index: cc65work/src/Makefile
|
||
|
===================================================================
|
||
|
--- cc65work.orig/src/Makefile 2017-11-16 01:54:30.795532327 +0100
|
||
|
+++ cc65work/src/Makefile 2017-11-16 02:21:19.661770273 +0100
|
||
|
@@ -62,11 +62,16 @@ else
|
||
|
endif
|
||
|
endif
|
||
|
|
||
|
+ifdef PKG_VERSION
|
||
|
+ $(info PKG_VERSION: $(PKG_VERSION))
|
||
|
+ DEF_PKGVER := -DPKG_VERSION="$(PKG_VERSION)"
|
||
|
+endif
|
||
|
+
|
||
|
CFLAGS += -MMD -MP -O3 -I common \
|
||
|
-Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \
|
||
|
-DCA65_INC="$(CA65_INC)" -DCC65_INC="$(CC65_INC)" -DCL65_TGT="$(CL65_TGT)" \
|
||
|
-DLD65_LIB="$(LD65_LIB)" -DLD65_OBJ="$(LD65_OBJ)" -DLD65_CFG="$(LD65_CFG)" \
|
||
|
- -DGIT_SHA=$(GIT_SHA)
|
||
|
+ -DGIT_SHA=$(GIT_SHA) $(DEF_PKGVER)
|
||
|
|
||
|
LDLIBS += -lm
|
||
|
|
||
|
Index: cc65work/src/common/version.c
|
||
|
===================================================================
|
||
|
--- cc65work.orig/src/common/version.c 2017-11-16 01:54:30.815532304 +0100
|
||
|
+++ cc65work/src/common/version.c 2017-11-16 02:07:10.974699766 +0100
|
||
|
@@ -61,7 +61,9 @@
|
||
|
/* Returns the version number as a string in a static buffer */
|
||
|
{
|
||
|
static char Buf[60];
|
||
|
-#if defined(GIT_SHA)
|
||
|
+#if defined(PKG_VERSION)
|
||
|
+ xsnprintf (Buf, sizeof (Buf), "%u.%u - %s", VER_MAJOR, VER_MINOR, STRINGIZE (PKG_VERSION));
|
||
|
+#elif defined(GIT_SHA)
|
||
|
xsnprintf (Buf, sizeof (Buf), "%u.%u - Git %s", VER_MAJOR, VER_MINOR, STRINGIZE (GIT_SHA));
|
||
|
#else
|
||
|
xsnprintf (Buf, sizeof (Buf), "%u.%u", VER_MAJOR, VER_MINOR);
|