Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
lv2 version (part one)
  • Loading branch information
x42 committed Jun 20, 2015
1 parent 98d82c4 commit 52ecbd2
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 3 deletions.
4 changes: 3 additions & 1 deletion b_synth/Makefile
@@ -1,4 +1,5 @@
include ../common.mak
include ../git2lv2.mk

LOADLIBES = -lm
override CFLAGS+= -I../src -I../b_overdrive -I../b_reverb -I../b_whirl
Expand Down Expand Up @@ -39,7 +40,8 @@ ifeq ($(HAVE_UI), yes)
endif

$(LV2NAME).ttl: $(LV2NAME).ttl.in $(LV2NAME).ui.ttl.in
cat $(LV2NAME).ttl.in > $(LV2NAME).ttl
sed "s/@VERSION@/lv2:microVersion $(LV2MIC) ;lv2:minorVersion $(LV2MIN) ;/g" \
$(LV2NAME).ttl.in > $(LV2NAME).ttl
ifeq ($(HAVE_UI), yes)
sed "s/@UI_TYPE@/$(UI_TYPE)/;s/@UI_REQ@/$(LV2UIREQ)/;" $(LV2NAME).ui.ttl.in >> $(LV2NAME).ttl
endif
Expand Down
1 change: 1 addition & 0 deletions b_synth/b_synth.ttl.in
Expand Up @@ -22,6 +22,7 @@
doap:maintainer <http://gareus.org/rgareus#me> ;
doap:name "setBfree DSP Tonewheel Organ";
doap:license <http://usefulinc.com/doap/licenses/gpl> ;
@VERSION@
lv2:optionalFeature lv2:hardRTCapable ;
lv2:requiredFeature urid:map , work:schedule ;
lv2:extensionData state:interface , work:interface ;
Expand Down
7 changes: 5 additions & 2 deletions b_whirl/Makefile
@@ -1,4 +1,5 @@
include ../common.mak
include ../git2lv2.mk

LOADLIBES = -lm
override CFLAGS+=`pkg-config --cflags lv2` -fvisibility=hidden
Expand Down Expand Up @@ -41,9 +42,11 @@ ifeq ($(HAVE_RTK), yes)
endif

b_whirl-configurable.ttl: b_whirl-configurable.ttl.in b_whirl-configurable.ui.ttl.in
cat b_whirl-configurable.ttl.in > b_whirl-configurable.ttl
sed "s/@UI_REQ@/$(LV2UIREQ)/;s/@VERSION@/lv2:microVersion $(LV2MIC) ;lv2:minorVersion $(LV2MIN) ;/g" \
b_whirl-configurable.ttl.in > b_whirl-configurable.ttl
ifeq ($(HAVE_RTK), yes)
sed "s/@UI_TYPE@/$(UI_TYPE)/;s/@UI_REQ@/$(LV2UIREQ)/;" b_whirl-configurable.ui.ttl.in >> b_whirl-configurable.ttl
sed "s/@UI_TYPE@/$(UI_TYPE)/" \
b_whirl-configurable.ui.ttl.in >> b_whirl-configurable.ttl
endif

DSP_SRC = lv2.c
Expand Down
1 change: 1 addition & 0 deletions b_whirl/b_whirl-configurable.ttl.in
Expand Up @@ -18,6 +18,7 @@
doap:maintainer <http://gareus.org/rgareus#me> ;
doap:name "setBfree Whirl Speaker - Extended Version";
doap:license <http://usefulinc.com/doap/licenses/gpl> ;
@VERSION@
lv2:optionalFeature lv2:hardRTCapable ;
lv2:port
[
Expand Down
4 changes: 4 additions & 0 deletions common.mak
Expand Up @@ -14,6 +14,8 @@ ifeq ($(VERSION),)
$(error "-^-")
endif

LV2VERSION=$(VERSION)

bindir = $(PREFIX)/bin
sharedir = $(PREFIX)/share/setBfree
lv2dir = $(PREFIX)/lib/lv2
Expand Down Expand Up @@ -59,6 +61,7 @@ ifeq ($(UNAME),Darwin)
STRIPFLAGS=-u -r -arch all -s $(RW)lv2syms
UI_TYPE=CocoaUI
PUGL_SRC=../pugl/pugl_osx.m
EXTENDED_RE=-E
else
ifneq ($(XWIN),)
IS_WIN=yes
Expand All @@ -82,6 +85,7 @@ else
UI_TYPE=X11UI
PUGL_SRC=../pugl/pugl_x11.c
endif
EXTENDED_RE=-r
endif

GLUICFLAGS+=`pkg-config --cflags cairo pango $(PKG_GL_LIBS)`
Expand Down
43 changes: 43 additions & 0 deletions git2lv2.mk
@@ -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))

0 comments on commit 52ecbd2

Please sign in to comment.