automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamic package version numbers with Autoconf and Automake (was: Re:


From: Bob Friesenhahn
Subject: Re: Dynamic package version numbers with Autoconf and Automake (was: Re: Automake 1.12.0b test release)
Date: Tue, 14 Aug 2012 18:57:02 -0500 (CDT)
User-agent: Alpine 2.01 (GSO 1266 2009-07-14)

The script I intend to use to obtain package information is in the GraphicsMagick repository and produces information gleaned from a 'version.sh' script which has the smarts to produce some obvious variable names.

echo `./scripts/pkginfo.sh package_bugreport`
address@hidden

% echo `./scripts/pkginfo.sh package_name`
GraphicsMagick

% echo `./scripts/pkginfo.sh package_version`
1.4.020120814

It is intended to be used like this in configure.ac:

AC_INIT(m4_esyscmd([scripts/pkginfo.sh package_name]),
        m4_esyscmd([scripts/pkginfo.sh package_version]),
        m4_esyscmd([scripts/pkginfo.sh package_bugreport]))

Unfortunately, the values passed to AC_INIT are cached so even if the configure script is run again, it uses the cached values rather than the new values.

The script:

#!/bin/sh
#
# Print the package version based on content of $srcdir/version.sh.
#
# This script is expected to be run under the context of a configure
# script (via AC_INIT) to dynamically determine the package version.
me=$0
info=$1
srcdir=`dirname $0`/..
value=
nl='
'
. version.sh

case "${info}" in
  package_bugreport )
    value="${PACKAGE_BUGREPORT}"
    ;;
  package_name )
    value="${PACKAGE_NAME}"
    ;;
  package_version )
    value="${PACKAGE_VERSION}${PACKAGE_VERSION_ADDENDUM}"
    ;;
  * )
    echo "$me: Must supply argument {package_bugreport, package_name, 
package_version}"
    exit 1
    ;;
esac

# Omit the trailing newline, so that m4_esyscmd can use the result directly.
echo "${value}" | tr -d "$nl"

--
Bob Friesenhahn
address@hidden, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]