simplify efl version and initialization in a macro, fixes libtool version-info.

Introduces EFL_VERSION() to make it simpler to define our version. The
last parameter is the release status, defaults to 'dev' for
development purposes and may be set to something else to be a
snapshot. It non-empty will be given to libtool's -release.

As EFL_VERSION() must be done *before* AC_INIT(), we need to create
another macro to do the AC_SUBST() and AC_DEFINE(). This is
EFL_INIT. And no, we can't just call AC_INIT() from inside EFL_INIT().

Last but not least, we had a problem with our libtool version-info. It
was being calculated as MAJOR + MINOR, right now 1 + 7 = 8. But as
soon as we get to MAJOR=2 and MINOR=0, we get into problems. This was
fixed by rewriting as (MAJOR * 100 + MINOR), but this is still
problematic.

According to libtool's manual (info libtool), we shouldn't bind the
version-info with package info, instead doing the 'release'
field. Pretty likely we'll do worse than expected by distros and
binary packages in future :-/




SVN revision: 82891
This commit is contained in:
Gustavo Sverzut Barbieri 2013-01-16 17:24:36 +00:00
parent 09f342fdeb
commit ad1417713b
2 changed files with 78 additions and 40 deletions

View File

@ -1,27 +1,6 @@
m4_define([v_maj], [1])
m4_define([v_min], [7])
m4_define([v_mic], [99])
m4_define([v_rev], m4_esyscmd([(LC_ALL=C svnversion "${SVN_REPO_PATH:-.}" | grep -v '\(export\|Unversioned directory\)' || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])
#### FIXME: i am sure that we can do some m4 to automagically do the stuff below for release and snapshots
##-- When released, remove the dnl on the below line
dnl m4_undefine([v_rev])
m4_define([v_rel], [])
##-- When doing snapshots - change soname. remove dnl on below line
dnl m4_define([relname], [ver-pre-svn-07])
dnl m4_define([v_rel], [-release relname])
m4_ifdef([v_rev], [m4_define([efl_version], [v_maj.v_min.v_mic.v_rev])], [m4_define([efl_version], [v_maj.v_min.v_mic])])
m4_define([lt_cur], m4_eval(v_maj + v_min))
m4_define([lt_rev], v_mic)
m4_define([lt_age], v_min)
EFL_VERSION([1], [7], [99], [dev])
AC_INIT([efl], [efl_version], [enlightenment-devel@lists.sourceforge.net])
AC_PREREQ([2.60])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
@ -40,17 +19,6 @@ AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE([1.6 dist-bzip2 -Wall color-tests])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
AC_DEFINE_UNQUOTED([VMAJ], [v_maj], [Major version])
AC_DEFINE_UNQUOTED([VMIN], [v_min], [Minor version])
AC_DEFINE_UNQUOTED([VMIC], [v_mic], [Micro version])
AC_DEFINE_UNQUOTED([VREV], [v_rev], [Revison])
VMAJ=v_maj
VMIN=v_min
AC_SUBST([VMAJ])
AC_SUBST([VMIN])
#### Additional options to configure
AC_ARG_WITH([profile],
@ -58,7 +26,7 @@ AC_ARG_WITH([profile],
[use the predefined build profile, one of: dev, debug and release.
@<:@default=dev@:>@])],
[build_profile=${withval}],
[build_profile=dev])
[build_profile=def_build_profile])
case "${build_profile}" in
dev|debug|release)
@ -219,11 +187,7 @@ if test "x${have_windows}" = "xyes" ; then
fi
AM_PROG_AR
LT_INIT([win32-dll disable-static pic-only])
EFL_LTLIBRARY_FLAGS="-no-undefined -version-info lt_cur:lt_rev:lt_age v_rel"
AC_SUBST(EFL_LTLIBRARY_FLAGS)
EFL_LTMODULE_FLAGS="-no-undefined -avoid-version"
AC_SUBST([EFL_LTMODULE_FLAGS])
EFL_INIT
### gettext

View File

@ -1,5 +1,79 @@
dnl file to manage modules in efl
dnl EFL_VERSION(major, minor, micro, release)
dnl This setup EFL version information and should be called BEFORE AC_INIT().
dnl
dnl release parameter is 'dev' to use from SVN or libtool -release field.
dnl It may be empty if not dev (svn/live build) and no -release is to be used.
dnl
dnl Examples:
dnl EFL_VERSION(1, 7, 99, dev)
dnl EFL_VERSION(1, 7, 99, ver-1234)
dnl This will define couple of m4 symbols:
dnl v_maj = given major number (first parameter)
dnl v_min = given minor number (second parameter)
dnl v_mic = given micro number (third parameter)
dnl v_rev = if release, it's 0, otherwise it's dev_version.
dnl v_rel = if release, it's -release followed by fourth parameter,
dnl otherwise it's empty. (mostly for libtool)
dnl efl_version = if release, it's major.minor.micro, otherwise it's
dnl major.minor.micro.dev_version
dnl dev_version = development version (svn revision).
dnl def_build_profile = dev or release based on 'dev' release parameter.
AC_DEFUN([EFL_VERSION],
[dnl
m4_define([v_maj], [$1])dnl
m4_define([v_min], [$2])dnl
m4_define([v_mic], [$3])dnl
m4_define([dev_version], m4_esyscmd([(LC_ALL=C svnversion "${SVN_REPO_PATH:-.}" | grep -v '\(export\|Unversioned directory\)' || echo 0) | cut -d: -f2 | tr -d ' :MSP\n']))dnl
m4_if(dev_version, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])dnl
m4_define([v_rev], m4_if($4, dev, [dev_version], [0]))dnl
m4_define([v_rel], m4_if($4, dev, [], m4_ifblank($4, [], [-release $4])))dnl
m4_define([def_build_profile], m4_if($4, dev, [dev], [release]))dnl
m4_define([efl_version], m4_if($4, dev, [v_maj.v_min.v_mic.v_rev], [v_maj.v_min.v_mic]))dnl
])
dnl EFL_INIT()
dnl Will AC_DEFINE() the following:
dnl VMAJ = v_maj
dnl VMIN = v_min
dnl VMIC = v_mic
dnl VREV = v_rev
dnl Will AC_SUBST() the following:
dnl VMAJ = v_maj
dnl VMIN = v_min
dnl EFL_LTLIBRARY_FLAGS="-no-undefined -version-info ..."
dnl EFL_LTMODULE_FLAGS="-no-undefined -avoid-version"
dnl Will define the following m4:
dnl lt_cur = libtool 'current' field of libtool's -version-info
dnl lt_rev = libtool 'revision' field of libtool's -version-info
dnl lt_age = libtool 'age' field of libtool's -version-info
AC_DEFUN([EFL_INIT],
[dnl
AC_DEFINE_UNQUOTED([VMAJ], [v_maj], [Major version])dnl
AC_DEFINE_UNQUOTED([VMIN], [v_min], [Minor version])dnl
AC_DEFINE_UNQUOTED([VMIC], [v_mic], [Micro version])dnl
AC_DEFINE_UNQUOTED([VREV], [v_rev], [Revison])dnl
VMAJ=v_maj
VMIN=v_min
AC_SUBST([VMAJ])dnl
AC_SUBST([VMIN])dnl
dnl
dnl TODO: warning - lt_cur:
dnl the previous code assumed v_maj + v_min, but this will be a problem when
dnl we bump v_maj and reset v_min. 1 + 7 == 7 + 1, so if v_maj is bumped
dnl we multiply it by 100.
m4_define([lt_cur], m4_if(m4_cmp(v_maj, 1), 0, m4_eval(v_maj + v_min), m4_eval(v_maj * 100 + v_min)))dnl
m4_define([lt_rev], v_mic)dnl
m4_define([lt_age], v_min)dnl
dnl
EFL_LTLIBRARY_FLAGS="-no-undefined -version-info lt_cur:lt_rev:lt_age v_rel"
AC_SUBST(EFL_LTLIBRARY_FLAGS)dnl
EFL_LTMODULE_FLAGS="-no-undefined -avoid-version"
AC_SUBST([EFL_LTMODULE_FLAGS])dnl
AC_MSG_NOTICE([Initialized AC_PACKAGE_NAME (AC_PACKAGE_VERSION) development=dev_version v_rel])
])
dnl EFL_EVAL_PKGS(EFL)
dnl does PKG_CHECK_MODULES() for given EFL
AC_DEFUN([EFL_EVAL_PKGS],