Skip to content

Commit d01c20c

Browse files
committed
inject snapshot-version in banner
if compiled from a git-clone Related: v4l2loopback#469
1 parent 2199283 commit d01c20c

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

.gitversion

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
this file is a dummy marker to notify the build-process
2+
that we are building from a development version of v4l2loopback.
3+
(that is: directly from a git-clone, rather than from a released tarball)

Makefile

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
ifneq ($(wildcard .gitversion),)
2+
# building a snapshot version
3+
override KCPPFLAGS += -DSNAPSHOT_VERSION='"$(shell git describe --always --dirty 2>/dev/null || shell git describe --always 2>/dev/null || echo snapshot)"'
4+
endif
5+
16
include Kbuild
27
ifeq ($(KBUILD_MODULES),)
38

@@ -43,7 +48,7 @@ all: v4l2loopback.ko utils
4348
v4l2loopback: v4l2loopback.ko
4449
v4l2loopback.ko:
4550
@echo "Building v4l2-loopback driver..."
46-
$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules
51+
$(MAKE) -C $(KERNEL_DIR) M=$(PWD) KCPPFLAGS="$(KCPPFLAGS)" modules
4752

4853
install-all: install install-utils install-man
4954
install:

v4l2loopback.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -2865,11 +2865,17 @@ static int __init v4l2loopback_init_module(void)
28652865

28662866
dprintk("module installed\n");
28672867

2868-
printk(KERN_INFO "v4l2loopback driver version %d.%d.%d loaded\n",
2868+
printk(KERN_INFO "v4l2loopback driver version %d.%d.%d%s loaded\n",
28692869
// clang-format off
28702870
(V4L2LOOPBACK_VERSION_CODE >> 16) & 0xff,
28712871
(V4L2LOOPBACK_VERSION_CODE >> 8) & 0xff,
2872-
(V4L2LOOPBACK_VERSION_CODE ) & 0xff);
2872+
(V4L2LOOPBACK_VERSION_CODE ) & 0xff,
2873+
#ifdef SNAPSHOT_VERSION
2874+
" (" STRINGIFY2(SNAPSHOT_VERSION) ")"
2875+
#else
2876+
""
2877+
#endif
2878+
);
28732879
// clang-format on
28742880

28752881
return 0;

0 commit comments

Comments
 (0)