[build] Use dynamic versioning same way as PulseAudio.

This commit is contained in:
Juho Hämäläinen 2015-02-05 11:57:11 +02:00
parent 4bc2ad8ab5
commit bd75fb9f92
4 changed files with 45 additions and 7 deletions

View file

@ -1,3 +1,10 @@
SUBDIRS = src SUBDIRS = src
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
$(top_srcdir)/.version:
echo $(VERSION) > $@-t && mv $@-t $@
dist-hook:
echo $(VERSION) > $(distdir)/.tarball-version
echo $(VERSION) > $(distdir)/.version

View file

@ -1,15 +1,15 @@
AC_PREREQ(2.60) AC_PREREQ(2.60)
m4_define(PA_MAJOR, [5]) AC_INIT([pulseaudio-modules-droid], [m4_esyscmd(./git-version-gen .tarball-version)], [mer-general@lists.merproject.org])
m4_define(PA_MINOR, [0])
m4_define(NEMO_MICRO, [33])
AC_INIT([pulseaudio-modules-droid], [PA_MAJOR.PA_MINOR.NEMO_MICRO], [mer-general@lists.merproject.org])
AC_CONFIG_HEADER([config.h]) AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([foreign -Wall silent-rules]) AM_INIT_AUTOMAKE([foreign -Wall silent-rules])
AC_CONFIG_MACRO_DIR(m4) AC_CONFIG_MACRO_DIR(m4)
AM_SILENT_RULES([yes]) AM_SILENT_RULES([yes])
AS_IF([! test -n "$VERSION"], [
AC_MSG_ERROR([git-version-gen failed])
])
if type -p stow > /dev/null && test -d /usr/local/stow ; then if type -p stow > /dev/null && test -d /usr/local/stow ; then
AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***]) AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}" ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
@ -20,7 +20,11 @@ AC_PROG_CC_C99
AM_PROG_CC_C_O AM_PROG_CC_C_O
AC_PROG_GCC_TRADITIONAL AC_PROG_GCC_TRADITIONAL
AC_SUBST(PA_MAJORMINOR, PA_MAJOR.PA_MINOR) m4_define(pa_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
m4_define(pa_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
AC_SUBST(PA_MAJOR, pa_major)
AC_SUBST(PA_MAJORMINOR, pa_major.pa_minor)
DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wno-long-long -Winline -Wvla -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wpacked -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Winit-self -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common -fdiagnostics-show-option" # PulseAudio 0.9.15 usess same + -Wcast-align -Wdeclaration-after-statement DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wno-long-long -Winline -Wvla -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wpacked -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Winit-self -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common -fdiagnostics-show-option" # PulseAudio 0.9.15 usess same + -Wcast-align -Wdeclaration-after-statement
@ -164,7 +168,7 @@ AS_IF([test "$pulseaudio_cv__Bool" = "yes"], [
#LT_INIT([dlopen win32-dll disable-static]) #LT_INIT([dlopen win32-dll disable-static])
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
PKG_CHECK_MODULES([PULSEAUDIO], [libpulse >= 2.1 pulsecore >= 2.1 ]) PKG_CHECK_MODULES([PULSEAUDIO], [libpulse >= 5.0 pulsecore >= 5.0])
AC_SUBST(PULSEAUDIO_CFLAGS) AC_SUBST(PULSEAUDIO_CFLAGS)
AC_SUBST(PULSEAUDIO_LIBS) AC_SUBST(PULSEAUDIO_LIBS)

26
git-version-gen Executable file
View file

@ -0,0 +1,26 @@
#!/bin/sh
if test $# -lt 1
then
echo 1>&2 "Usage: $0 \$srcdir/.tarball-version"
exit 1
fi
VF=$1
# First see if there is a version file,
# then try git-describe, otherwise fail.
if test -f $VF
then
VN=$(cat $VF)
elif test -d ${GIT_DIR:-.git} -o -f .git &&
V=$(git describe --match "[0-9]*" --abbrev=7 --tags 2>/dev/null)
then
VN=$V
else
echo 1>&2 "$0: Failed to determine revision"
exit 1
fi
# Omit the trailing newline, so that m4_esyscmd can use the result directly.
echo "$VN" | tr -d '\012'

View file

@ -6,6 +6,7 @@ AM_CFLAGS = \
$(PULSEAUDIO_CFLAGS) \ $(PULSEAUDIO_CFLAGS) \
$(DROIDHEADERS_CFLAGS) \ $(DROIDHEADERS_CFLAGS) \
$(HYBRIS_CFLAGS) \ $(HYBRIS_CFLAGS) \
-DPULSEAUDIO_VERSION=@PA_MAJOR@ \
-I$(top_srcdir)/src/droid -I$(top_srcdir)/src/droid