From 2401501759c4ff5dcc7c022a9c2194b504bdf0d6 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 15 Feb 2024 09:32:12 +0000 Subject: build system: try to find a more precise EXTRAVERSION The default EXTRAVERSION is .git. Use some clues to determine a more precise EXTRAVERSION: - git describe - A .frp_describe file embedded in the release tarball - The name of the build directory: tarballs of release tags from GitLab and GitHub include the version in the directory name. --- .gitignore | 5 +++++ Makefile | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/.gitignore b/.gitignore index a4031f6ec..9055b745e 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,8 @@ TAGS # user-supplied scripts # /embed + +# +# release description for tarball +# +.frp_describe diff --git a/Makefile b/Makefile index 9dd359244..36d66d2d0 100644 --- a/Makefile +++ b/Makefile @@ -368,6 +368,35 @@ AFLAGS := $(AFLAGS) LDFLAGS := $(LDFLAGS) LDLIBS := +CONFIG_PLATFORM_MINGW32 ?= +ifeq ($(CONFIG_PLATFORM_MINGW32),) +CONFIG_PLATFORM_MINGW32 := $(shell grep ^CONFIG_PLATFORM_MINGW32= .config 2>/dev/null) +CONFIG_PLATFORM_MINGW32 := $(subst CONFIG_PLATFORM_MINGW32=,,$(CONFIG_PLATFORM_MINGW32)) +CONFIG_PLATFORM_MINGW32 := $(subst ",,$(CONFIG_PLATFORM_MINGW32)) +#") +endif + +# Try various methods to get a more specific EXTRAVERSION +ifeq ($(CONFIG_PLATFORM_MINGW32),y) +# Ask git +extraversion = $(shell git describe --match FRP 2>/dev/null) +ifeq ($(strip $(extraversion)),) +# That didn't work, look for a .frp_describe file +extraversion = $(shell cat .frp_describe 2>/dev/null | grep '^FRP-') +ifeq ($(strip $(extraversion)),) +# That didn't work either, look at current directory name +e1 = $(shell basename `pwd` | grep '^busybox-w32-FRP-') +ifneq ($(strip $(e1)),) +extraversion = $(subst busybox-w32-,,$(e1)) +endif +endif +endif + +ifneq ($(strip $(extraversion)),) +EXTRAVERSION = .$(subst FRP,git,$(extraversion)) +endif +endif + # Read KERNELRELEASE from .kernelrelease (if it exists) KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null) KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) -- cgit v1.2.3-55-g6feb