1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 22:43:17 +02:00

meson make: use VERSION file

To create a distribution package with meson you run
  `meson dist -C <your_build_dir>`
This will collect all git tracked files and pack them into an archive.
There is no way to collect version information for that.

So now the base version stands in the VERSION file. To relase a flashrom
version you change that file and tag the changing commit.

When building from git the git version is embedded in the flashrom
binary. E.g.:
flashrom 1.4.0-devel (git:v1.2-1172-g7f186838) on Linux 6.1.3 (x86_64)

Change-Id: Idc17eadb397b3c579bddfbf9ae6bf1b171f5dfb7
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/72657
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Thomas Heijligen
2023-02-01 15:52:26 +01:00
committed by Anastasia Klimchuk
parent 3d5c9a5cea
commit c4d89eadfd
6 changed files with 24 additions and 334 deletions

View File

@ -398,13 +398,11 @@ LIB_OBJS = libflashrom.o layout.o erasure_layout.o flashrom.o udelay.o parallel.
CLI_OBJS = cli_classic.o cli_output.o cli_common.o print.o
# versioninfo.inc stores metadata required to build a packaged flashrom. It is generated by the export rule and
# imported below. If versioninfo.inc is not found and the variables are not defined by the user, the info will
# be obtained using util/getrevision.sh, which is the common case during development.
-include versioninfo.inc
VERSION ?= $(shell ./util/getrevision.sh --revision)
SCMDEF := -D'FLASHROM_VERSION="$(VERSION)"'
VERSION ?= $(shell cat ./VERSION)
VERSION_GIT ?= $(shell git describe 2>/dev/null)
ifdef VERSION_GIT
VERSION := "$(VERSION) (git:$(VERSION_GIT))"
endif
# No spaces in release names unless set explicitly
RELEASENAME ?= $(shell echo "$(VERSION)" | sed -e 's/ /_/')
@ -1021,7 +1019,7 @@ config:
fi
%.o: %.c | config
$(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(FLASHROM_CFLAGS) $(FEATURE_FLAGS) $(SCMDEF) -o $@ -c $<
$(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(FLASHROM_CFLAGS) $(FEATURE_FLAGS) -D'FLASHROM_VERSION=$(VERSION)' -o $@ -c $<
$(PROGRAM)$(EXEC_SUFFIX): $(CLI_OBJS) libflashrom.a
$(CC) -o $@ $^ $(LDFLAGS)
@ -1101,7 +1099,7 @@ libpayload: clean
make CC="CC=i386-elf-gcc lpgcc" AR=i386-elf-ar RANLIB=i386-elf-ranlib
gitconfig:
./util/getrevision.sh -c 2>/dev/null && ./util/git-hooks/install.sh
git rev-parse 2>/dev/null && ./util/git-hooks/install.sh
.PHONY: all install clean distclean config _export export tarball libpayload