apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <joe+gm...@sunstarsys.com>
Subject libtool & pattern match fixes for build/get-version.sh
Date Mon, 21 Jun 2004 17:02:58 GMT
We've been using the build/get-version.sh script in
httpd-apreq-2.  The following patch corrects the 
libtool version string miscalculation (we let libtool
generate the shared library version for libapreq2, so 
it's pretty well-tested).

The patch also includes a patch to correctly handle
multi-digit numbers (the original regexp will drop
all but the final digit due to the greediness of the
opening .* pattern.

% diff -u apr/build/get-version.sh httpd-apreq-2/build/get-version.sh
--- apr/build/get-version.sh    2002-09-10 09:11:20.000000000 +0000
+++ httpd-apreq-2/build/get-version.sh  2004-06-21 16:50:43.816189354 +0000
@@ -13,24 +13,24 @@

 if test $# != 3; then
   echo "USAGE: $0 CMD INCLUDEDIR PREFIX"
-  echo "  where CMD is one of: all, major"
+  echo "  where CMD is one of: all, major, libtool"
   exit 1
 fi

-major_sed="/#define.*$3_MAJOR_VERSION/s/^.*\([0-9][0-9]*\).*$/\1/p"
-minor_sed="/#define.*$3_MINOR_VERSION/s/^.*\([0-9][0-9]*\).*$/\1/p"
-patch_sed="/#define.*$3_PATCH_VERSION/s/^.*\([0-9][0-9]*\).*$/\1/p"
+major_sed="/#define.*$3_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
+minor_sed="/#define.*$3_MINOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
+patch_sed="/#define.*$3_PATCH_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
 major="`sed -n $major_sed $2`"
 minor="`sed -n $minor_sed $2`"
 patch="`sed -n $patch_sed $2`"
+ltmaj="`expr $major + $minor`"

 if test "$1" = "all"; then
   echo ${major}.${minor}.${patch}
 elif test "$1" = "major"; then
   echo ${major}
 elif test "$1" = "libtool"; then
-  # Yes, ${minor}:${patch}:${minor} is correct due to libtool idiocy.
-  echo ${minor}:${patch}:${minor}
+  echo ${ltmaj}:${patch}:${minor}
 else
   echo "ERROR: unknown version CMD ($1)"
   exit 1


-- 
Joe Schaefer


Mime
View raw message