Skip to content
Permalink
Browse files

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>
  • Loading branch information
rkitover committed Apr 16, 2019
1 parent 8abbb07 commit 4203bb53f2637d6d2a904877da1432b1e9c157f1
Showing with 13 additions and 6 deletions.
  1. +10 −3 src/libretro/Makefile
  2. +3 −3 src/libretro/libretro.cpp
@@ -28,9 +28,16 @@ endif
endif

TARGET_NAME = vbam
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
ifneq ($(GIT_VERSION)," unknown")
CXXFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"

VBAM_VERSION := $(shell sed -En 's/.*\[([0-9]+[^]]+).*/\1/p; T; q' ../../CHANGELOG.md 2>/dev/null)

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

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

0 comments on commit 4203bb5

Please sign in to comment.
You can’t perform that action at this time.