[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] API - Provide version macros for major/minor/micro versions
From: |
Jeremy Whiting |
Subject: |
[PATCH] API - Provide version macros for major/minor/micro versions |
Date: |
Mon, 18 May 2015 10:21:43 -0600 |
That should work. I'll give it a try locally to see how well and what
the results are, etc.
On Thu, May 14, 2015 at 11:33 PM, Luke Yelavich
<luke.yelavich at canonical.com> wrote:
> From: Luke Yelavich <themuso at themuso.com>
>
> Split the version into major/minor/micro versions and make the
> split version available to clients using the C API, so they can check
> for functionality based on the micro version if required.
> ---
> Makefile.am | 2 +-
> configure.ac | 8 ++++++++
> split-version.sh | 25 +++++++++++++++++++++++++
> src/api/c/Makefile.am | 20 +++++++++++++++++++-
> src/api/c/libspeechd.h | 2 ++
> src/api/c/libspeechd_version.h.in | 31 +++++++++++++++++++++++++++++++
> 6 files changed, 86 insertions(+), 2 deletions(-)
> create mode 100755 split-version.sh
> create mode 100644 src/api/c/libspeechd_version.h.in
>
> diff --git a/Makefile.am b/Makefile.am
> index 4b59d14..2a36060 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -7,7 +7,7 @@ BUILT_SOURCES = $(top_srcdir)/.version
>
> SUBDIRS= include src config doc po
>
> -EXTRA_DIST= ANNOUNCE BUGS FAQ README.packagers README.translators
> README.style build.sh git-version-gen
> +EXTRA_DIST= ANNOUNCE BUGS FAQ README.packagers README.translators
> README.style build.sh git-version-gen split-version.sh
>
> MAINTAINERCLEANFILES=configure
>
> diff --git a/configure.ac b/configure.ac
> index 599b00d..3b9a67a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -12,6 +12,14 @@ AC_CONFIG_HEADERS([config.h])
> IT_PROG_INTLTOOL([0.40.0])
> AM_GLIB_GNU_GETTEXT
>
> +# Split version number
> +MAJOR_VERSION="$(./split-version.sh -ma)"
> +MINOR_VERSION="$(./split-version.sh -mi)"
> +MICRO_VERSION="$(./split-version.sh -mc)"
> +AC_SUBST([MAJOR_VERSION])
> +AC_SUBST([MINOR_VERSION])
> +AC_SUBST([MICRO_VERSION])
> +
> # Config test suite
> AC_CONFIG_TESTDIR(src/tests)
>
> diff --git a/split-version.sh b/split-version.sh
> new file mode 100755
> index 0000000..c2bc4c7
> --- /dev/null
> +++ b/split-version.sh
> @@ -0,0 +1,25 @@
> +#!/bin/sh
> +
> +# Small script to split out major/minor/micro versions for API version
> checks.
> +VERSION=$(./git-version-gen .tarball-version)
> +
> +case "$1" in
> + -ma)
> + echo $VERSION | cut -f1 -d.
> + ;;
> + -mi)
> + echo $VERSION | cut -f2 -d. | cut -f1 -d~
> + ;;
> + -mc)
> + micro_version=$(echo $VERSION | cut -f3 -d.)
> + if test -z "$micro_version"; then
> + echo 0
> + else
> + echo $micro_version
> + fi
> + ;;
> + *)
> + echo "Usage: $0 [-ma|-mi|-mc]"
> + exit 1
> + ;;
> +esac
> diff --git a/src/api/c/Makefile.am b/src/api/c/Makefile.am
> index b91fbdf..e92d9ab 100644
> --- a/src/api/c/Makefile.am
> +++ b/src/api/c/Makefile.am
> @@ -1,7 +1,8 @@
> ## Process this file with automake to produce Makefile.in
>
> -spdinclude_HEADERS = libspeechd.h
> +spdinclude_HEADERS = libspeechd.h libspeechd_version.h
> inc_local = -I$(top_srcdir)/include/
> +BUILT_SOURCES = libspeechd_version.h
>
> lib_LTLIBRARIES = libspeechd.la
> libspeechd_la_SOURCES = libspeechd.c
> @@ -9,3 +10,20 @@ libspeechd_la_CFLAGS = $(ERROR_CFLAGS)
> libspeechd_la_CPPFLAGS = $(inc_local) -D_GNU_SOURCE $(GLIB_CFLAGS)
> -DSPD_SPAWN_CMD=\""$(prefix)/bin/speech-dispatcher"\"
> libspeechd_la_LDFLAGS = -version-info
> $(LIB_SPD_CURRENT):$(LIB_SPD_REVISION):$(LIB_SPD_AGE)
> libspeechd_la_LIBADD = $(GLIB_LIBS)
> +
> +libspeechd_version.h: $(srcdir)/libspeechd_version.h.in
> +
> +CLEANFILES = libspeechd_version.h
> +
> +EXTRA_DIST = libspeechd_version.h.in
> +
> +libspeechd_version.h: Makefile
> + rm -f $@
> + srcdir=; \
> + test -f ./address@hidden || srcdir=$(srcdir)/; \
> + $(edit_version) address@hidden > $@
> +
> +edit_version = sed \
> + -e 's:address@hidden@]:$(MAJOR_VERSION):' \
> + -e 's:address@hidden@]:$(MINOR_VERSION):' \
> + -e 's:address@hidden@]:$(MICRO_VERSION):'
> diff --git a/src/api/c/libspeechd.h b/src/api/c/libspeechd.h
> index 3c8424d..acb4f8a 100644
> --- a/src/api/c/libspeechd.h
> +++ b/src/api/c/libspeechd.h
> @@ -28,6 +28,8 @@
> #include <stddef.h>
> #include <pthread.h>
>
> +#include "libspeechd_version.h"
> +
> /*
> * Since the API includes speechd_types.h directly, we only need this
> * include if we are not being included by the API.
> diff --git a/src/api/c/libspeechd_version.h.in
> b/src/api/c/libspeechd_version.h.in
> new file mode 100644
> index 0000000..9df8469
> --- /dev/null
> +++ b/src/api/c/libspeechd_version.h.in
> @@ -0,0 +1,31 @@
> +/*
> + * libspeechd_version.h - Shared library for easy access to Speech
> Dispatcher functions (header)
> + *
> + * Copyright (C) 2001, 2002, 2003, 2004 Brailcom, o.p.s.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as published by
> + * the Free Software Foundation; either version 2.1, or (at your option)
> + * any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public License
> + * along with this package; see the file COPYING. If not, write to
> + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
> + * Boston, MA 02110-1301, USA.
> + *
> + * $Id: libspeechd.h,v 1.29 2008-07-30 09:47:00 hanke Exp $
> + */
> +
> +#ifndef _LIBSPEECHD_VERSION_H
> +#define _LIBSPEECHD_VERSION_H
> +
> +#define LIBSPEECHD_MAJOR_VERSION @LIBSPEECHD_MAJOR_VERSION@
> +#define LIBSPEECHD_MINOR_VERSION @LIBSPEECHD_MINOR_VERSION@
> +#define LIBSPEECHD_MICRO_VERSION @LIBSPEECHD_MICRO_VERSION@
> +
> +#endif /* ifndef _LIBSPEECHD_VERSION_H */
> --
> 2.1.4
>
>
> _______________________________________________
> Speechd mailing list
> Speechd at lists.freebsoft.org
> http://lists.freebsoft.org/mailman/listinfo/speechd