Skip to content

Commit

Permalink
lv2 version
Browse files Browse the repository at this point in the history
  • Loading branch information
x42 committed Jun 20, 2015
1 parent 4ff6200 commit 8c525e5
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CFLAGS ?= $(OPTIMIZATIONS) -Wall
STRIP=strip
STRIPFLAGS=-s

midifilter_VERSION?=$(shell git describe --tags HEAD 2>/dev/null | sed 's/-g.*$$//;s/^v//' || echo "LV2")
###############################################################################

LV2DIR ?= $(PREFIX)/lib/lv2
Expand All @@ -22,9 +23,11 @@ ifeq ($(UNAME),Darwin)
LIB_EXT=.dylib
STRIPFLAGS=-u -r -arch all -s lv2syms
targets+=lv2syms
EXTENDED_RE=-E
else
LV2LDFLAGS=-Wl,-Bstatic -Wl,-Bdynamic
LIB_EXT=.so
EXTENDED_RE=-r
endif

ifneq ($(XWIN),)
Expand All @@ -37,6 +40,11 @@ endif

targets+=$(BUILDDIR)$(LV2NAME)$(LIB_EXT)

###############################################################################
# extract versions
LV2VERSION=$(midifilter_VERSION)
include git2lv2.mk

# check for build-dependencies
ifeq ($(shell pkg-config --exists lv2 || echo no), no)
$(error "LV2 SDK was not found")
Expand Down Expand Up @@ -90,7 +98,7 @@ $(BUILDDIR)$(LV2NAME).ttl: $(LV2NAME).ttl.in ttf.h filters.c
cat $(LV2NAME).ttl.in > $(BUILDDIR)$(LV2NAME).ttl
gcc -E -I. -DMX_TTF filters.c \
| grep -v '^\#' \
| sed 's/HTTPP/http:\//g' \
| sed 's/HTTPP/http:\//g;s/@VERSION@/lv2:microVersion $(LV2MIC) ;lv2:minorVersion $(LV2MIN) ;/g' \
| uniq \
>> $(BUILDDIR)$(LV2NAME).ttl

Expand Down
43 changes: 43 additions & 0 deletions git2lv2.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

###############################################################################
# extract versions
GIT_REV_REGEXP="([0-9][0-9]*)\.([0-9][0-9]*)(\.([0-9][0-9]*))?(-([0-9][0-9]*))?(-g([a-f0-9]+))?"

override MAJOR=$(shell echo $(LV2VERSION) | sed $(EXTENDED_RE) -e s/$(GIT_REV_REGEXP)/\\1/)
override MINOR=$(shell echo $(LV2VERSION) | sed $(EXTENDED_RE) -e s/$(GIT_REV_REGEXP)/\\2/)
override MICRO=$(shell echo $(LV2VERSION) | sed $(EXTENDED_RE) -e s/$(GIT_REV_REGEXP)/\\4/)
override GITREV=$(shell echo $(LV2VERSION) | sed $(EXTENDED_RE) -e s/$(GIT_REV_REGEXP)/\\6/)

ifeq ($(MAJOR),)
override MAJOR=0
endif
ifeq ($(MINOR),)
override MINOR=0
endif
ifeq ($(MICRO),)
override MICRO=0
endif

$(info Version: $(LV2VERSION) -> $(MAJOR) $(MINOR) $(MICRO) $(GITREV))

# version requirements, see
# http://lv2plug.in/ns/lv2core/#minorVersion
# http://lv2plug.in/ns/lv2core/#microVersion
ifeq ($(GITREV),)
# even numbers for tagged releases
override LV2MIN = $(shell expr $(MAJOR) \* 65536 + $(MINOR) \* 256 + $(MICRO) \* 2 )
override LV2MIC = 0
else
# odd-numbers for all non tagged git versions
override LV2MIN = $(shell expr $(MAJOR) \* 65536 + $(MINOR) \* 256 + $(MICRO) \* 2 + 1 )
override LV2MIC = $(shell expr $(GITREV) \* 2 + 1)
endif

ifeq ($(LV2MIN),)
$(error "Cannot extract required LV2 minor-version parameter")
endif
ifeq ($(LV2MIC),)
$(error "Cannot extract required LV2 micro-version parameter")
endif

$(info LV2 Version: $(LV2MIN) $(LV2MIC))
1 change: 1 addition & 0 deletions ttf.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#define TTF_DEF(DOAPNAME, INSUPPORTS) \
a lv2:Plugin, lv2:FilterPlugin ; \
doap:name DOAPNAME ; \
@VERSION@ \
doap:license <HTTPP/usefulinc.com/doap/licenses/gpl> ; \
lv2:project <HTTPP/gareus.org/oss/lv2/midifilter> ; \
lv2:optionalFeature lv2:hardRTCapable ; \
Expand Down

0 comments on commit 8c525e5

Please sign in to comment.