Browse Source

Always generate version from git if possible #532.

linenumbers
Daniel Carl 3 years ago
parent
commit
ce5f114527
  1. 1
      .gitignore
  2. 12
      Makefile
  3. 6
      config.mk
  4. 5
      src/main.c
  5. 1
      src/setting.c

1
.gitignore

@ -3,3 +3,4 @@
*.so
*.tar.gz
sandbox
version.h

12
Makefile

@ -1,6 +1,12 @@
version = 3.3.0
include config.mk
all: src.subdir-all
all: version.h src.subdir-all
version.h: Makefile .git/index
@echo "create $@"
$(Q)v="$$(git describe --tags 2>/dev/null)"; \
echo "#define VERSION \"$${v:-$(version)}\"" > $@
options:
@echo "vimb build options:"
@ -10,7 +16,7 @@ options:
@echo "EXTCFLAGS = $(EXTCFLAGS)"
@echo "CC = $(CC)"
install: src.subdir-all
install: all
@# binary
install -d $(BINPREFIX)
install -m 755 src/vimb $(BINPREFIX)/vimb
@ -19,7 +25,7 @@ install: src.subdir-all
install -m 644 src/webextension/$(EXTTARGET) $(LIBDIR)/$(EXTTARGET)
@# man page
install -d $(MANPREFIX)/man1
@sed -e "s!VERSION!$(VERSION)!g" \
@sed -e "s!VERSION!$(version)!g" \
-e "s!PREFIX!$(PREFIX)!g" \
-e "s!DATE!`date +'%m %Y'`!g" $(DOCDIR)/vimb.1 > $(MANPREFIX)/man1/vimb.1
@# .desktop file

6
config.mk

@ -1,5 +1,3 @@
VERSION = 3.3.0
ifneq ($(V),1)
Q := @
endif
@ -20,11 +18,9 @@ DOCDIR = doc
# used libs
LIBS = gtk+-3.0 'webkit2gtk-4.0 >= 2.20.0'
COMMIT := $(shell git describe --tags --always 2> /dev/null || echo "unknown")
# setup general used CFLAGS
CFLAGS += -std=c99 -pipe -Wall -fPIC
CPPFLAGS += -DVERSION=\"${VERSION}\" -DEXTENSIONDIR=\"${EXTENSIONDIR}\" -DCOMMIT=\"$(COMMIT)\"
CPPFLAGS += -DEXTENSIONDIR=\"${EXTENSIONDIR}\"
CPPFLAGS += -DPROJECT=\"vimb\" -DPROJECT_UCFIRST=\"Vimb\"
CPPFLAGS += -D_XOPEN_SOURCE=500
CPPFLAGS += -D__BSD_VISIBLE

5
src/main.c

@ -28,6 +28,7 @@
#include <unistd.h>
#include <webkit2/webkit2.h>
#include "../version.h"
#include "ascii.h"
#include "command.h"
#include "completion.h"
@ -1923,12 +1924,12 @@ int main(int argc, char* argv[])
}
if (ver) {
printf("%s, version %s\n\n", PROJECT, VERSION);
printf("%s, version %s\n", PROJECT, VERSION);
return EXIT_SUCCESS;
}
if (buginfo) {
printf("Commit: %s\n", COMMIT);
printf("Version: %s\n", VERSION);
printf("WebKit compile: %d.%d.%d\n",
WEBKIT_MAJOR_VERSION,
WEBKIT_MINOR_VERSION,

1
src/setting.c

@ -20,6 +20,7 @@
#include <glib.h>
#include <string.h>
#include "../version.h"
#include "completion.h"
#include "config.h"
#include "ext-proxy.h"

Loading…
Cancel
Save