1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
Description: Fix calculation of version number in the library mapfiles
Author: Christophe CURIS <christophe.curis@free.fr>
Origin: https://repo.or.cz/wmaker-crm.git/commitdiff/2264ed9
Bug-Debian: https://bugs.debian.org/1043417
Last-Update: 2024-11-08
Forwarded: not-needed
--- a/script/generate-mapfile-from-header.sh
+++ b/script/generate-mapfile-from-header.sh
@@ -77,10 +77,8 @@
-v)
shift
- # Version may be 'x:y:z', we keep only 'x'
- version="`echo "$1" | sed -e 's,:.*$,,' `"
- # the version should only be a number
- echo "$version" | grep '^[1-9][0-9]*$' > /dev/null || \
+ version="$1"
+ echo "$version" | grep -E '^[1-9][0-9]*(:[0-9]+(:[0-9]+)?)?$' > /dev/null || \
arg_error "version \"$1\" is not valid"
;;
@@ -109,9 +107,18 @@
# generate the rest of the script so that other symbols will not be kept.
awk '
BEGIN {
+ # Version number here uses only 1 number from the full version used in libtool
+ libversion="'"$version"'";
+ if (split(libversion, subversions, ":") > 1) {
+ # Calculate [CURRENT - AGE], the goal is that the number will not
+ # change when functions are added to the API, but it will be incremented
+ # when functions are removed or argument change (which breaks compat)
+ libversion = subversions[1] - subversions[3];
+ }
+
print "/* Generated version-script for ld */";
print "";
- print "'"$libname$version"'";
+ print "'"$libname"'" libversion;
print "{";
print " global:";
}
|