+
+# This will extract a flavour out of the name of the source directory
+# and flavour the packages and binaries with it. 'Official' builds
+# should use a source dir of the form wxwidgets$RELEASE-$VERSION.
+# Flavoured builds may use wxwidgets$RELEASE-$FLAVOUR-$VERSION, where
+# any descriptive alphanumeric name will do for FLAVOUR. This will
+# allow a custom build to be installed alongside the mainline ones
+# without conflict. You will also need to make a corresponding
+# changelog entry for your flavour source package using:
+# wxwidget$RELEASE-$FLAVOUR ($VERSION) to satify dpkg-source and
+# to correctly set the release below.
+DEBIAN_WXFLAVOUR := $(shell pwd | sed -e 's@.*/wxwidgets[0-9.]\+-\?\(.*\)-[0-9.]\+-\?.*@\1@')
+
+release := $(shell dpkg-parsechangelog | sed -n 's/^Source: wxwidgets//p')
+soversion := $(shell grep '^WX_CURRENT=' configure.in | sed 's/WX_CURRENT=\([0-9]\+\).*/\1/')
+sorelease := $(release:%-$(DEBIAN_WXFLAVOUR)=%).$(soversion)$(addprefix -,$(DEBIAN_WXFLAVOUR))