libretro: set version with git sha

Read version from `CHANGELOG.md` and append the short git sha if not on
the released commit.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-04-16 14:13:22 +00:00
parent 8abbb070e8
commit 4203bb53f2
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
2 changed files with 13 additions and 6 deletions

View File

@ -28,9 +28,16 @@ endif
endif endif
TARGET_NAME = vbam TARGET_NAME = vbam
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
ifneq ($(GIT_VERSION)," unknown") VBAM_VERSION := $(shell sed -En 's/.*\[([0-9]+[^]]+).*/\1/p; T; q' ../../CHANGELOG.md 2>/dev/null)
CXXFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
CXXFLAGS += -DVBAM_VERSION=\"$(VBAM_VERSION)\"
TAG_COMMIT := $(shell git rev-list -n 1 v$(VBAM_VERSION) --abbrev-commit 2>/dev/null)
CURRENT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
ifneq ($(CURRENT_COMMIT),$(TAG_COMMIT))
CXXFLAGS += -DGIT_COMMIT=\"$(CURRENT_COMMIT)\"
endif endif
ifeq ($(platform), unix) ifeq ($(platform), unix)

View File

@ -534,10 +534,10 @@ void retro_get_system_info(struct retro_system_info *info)
{ {
info->need_fullpath = false; info->need_fullpath = false;
info->valid_extensions = "dmg|gb|gbc|cgb|sgb|gba"; info->valid_extensions = "dmg|gb|gbc|cgb|sgb|gba";
#ifdef GIT_VERSION #ifdef GIT_COMMIT
info->library_version = "2.1.0" GIT_VERSION; info->library_version = VBAM_VERSION "-" GIT_COMMIT;
#else #else
info->library_version = "2.1.0-GIT"; info->library_version = VBAM_VERSION;
#endif #endif
info->library_name = "VBA-M"; info->library_name = "VBA-M";
info->block_extract = false; info->block_extract = false;