]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add "git describe" based version string postfix
authorJouni Malinen <j@w1.fi>
Fri, 16 Oct 2015 19:20:55 +0000 (22:20 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 16 Oct 2015 19:20:55 +0000 (22:20 +0300)
If hostapd or wpa_supplicant is built from a git repository, add a
VERSION_STR postfix from the current git branch state. This is from "git
describe --dirty=+". VERSION_STR will thus look something like
"2.6-devel-hostap_2_5-132-g4363c0d+" for development builds from a
modified repository.

This behavior is enabled automatically if a build within git repository
is detected (based on ../.git existing). This can be disabled with
CONFIG_NO_GITVER=y in wpa_supplicant/.config and hostapd/.config.

Signed-off-by: Jouni Malinen <j@w1.fi>
hostapd/Makefile
src/common/version.h
wpa_supplicant/Makefile

index a812b9d661c3312867de9f04c3ab8550a14e21b8..67b025b287e072fca3fa43f63574b7774b3c4752 100644 (file)
@@ -18,6 +18,16 @@ export BINDIR ?= /usr/local/bin/
 
 -include .config
 
+ifndef CONFIG_NO_GITVER
+# Add VERSION_STR postfix for builds from a git repository
+ifeq ($(wildcard ../.git),../.git)
+GITVER := $(shell git describe --dirty=+)
+ifneq ($(GITVER),)
+CFLAGS += -DGIT_VERSION_STR_POSTFIX=\"-$(GITVER)\"
+endif
+endif
+endif
+
 ifdef CONFIG_TESTING_OPTIONS
 CFLAGS += -DCONFIG_TESTING_OPTIONS
 CONFIG_WPS_TESTING=y
index 14cf8103e80aac2071be6831b585bc2c8f19f296..ae5c9d4c44da5b115718b01e5225e0d0700cd31a 100644 (file)
@@ -5,6 +5,10 @@
 #define VERSION_STR_POSTFIX ""
 #endif /* VERSION_STR_POSTFIX */
 
-#define VERSION_STR "2.6-devel" VERSION_STR_POSTFIX
+#ifndef GIT_VERSION_STR_POSTFIX
+#define GIT_VERSION_STR_POSTFIX ""
+#endif /* GIT_VERSION_STR_POSTFIX */
+
+#define VERSION_STR "2.6-devel" VERSION_STR_POSTFIX GIT_VERSION_STR_POSTFIX
 
 #endif /* VERSION_H */
index 4cf00e823dc67bd946e2bc19fd643d098179947a..0129031e46a0ea36da026fbb1975ec611cf64820 100644 (file)
@@ -17,6 +17,16 @@ CFLAGS += -I$(abspath ../src/utils)
 
 -include .config
 
+ifndef CONFIG_NO_GITVER
+# Add VERSION_STR postfix for builds from a git repository
+ifeq ($(wildcard ../.git),../.git)
+GITVER := $(shell git describe --dirty=+)
+ifneq ($(GITVER),)
+CFLAGS += -DGIT_VERSION_STR_POSTFIX=\"-$(GITVER)\"
+endif
+endif
+endif
+
 ifdef CONFIG_TESTING_OPTIONS
 CFLAGS += -DCONFIG_TESTING_OPTIONS
 CONFIG_WPS_TESTING=y