28c4276
#!/bin/sh
28c4276
28c4276
GETVER="${0%/*}/getver.pl"
28c4276
GDLIB_MAJOR=$("${GETVER}" MAJOR)
28c4276
GDLIB_MINOR=$("${GETVER}" MINOR)
28c4276
GDLIB_REVISION=$("${GETVER}" RELEASE)
28c4276
28c4276
# Dynamic library version information
28c4276
# See http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
28c4276
28c4276
GDLIB_LT_CURRENT=3
28c4276
# This is the version where the soname (current above) changes.  We use it
28c4276
# to reset the revision base back to zero.  It's a bit of a pain, but some
28c4276
# systems restrict the revision range below to [0..255] (like OS X).
28c4276
GDLIB_PREV_MAJOR=2
28c4276
GDLIB_PREV_MINOR=2
28c4276
# This isn't 100% correct, but it tends to be a close enough approximation
28c4276
# for how we manage the codebase.  It's rare to do a release that doesn't
28c4276
# modify the library since this project is centered around the library.
28c4276
GDLIB_LT_REVISION=$(( ((GDLIB_MAJOR - GDLIB_PREV_MAJOR) << 6) | ((GDLIB_MINOR - GDLIB_PREV_MINOR) << 3) | GDLIB_REVISION ))
28c4276
GDLIB_LT_AGE=0
28c4276
28c4276
# The first three fields we feed into libtool and the OS target determines how
28c4276
# they get used.  The last two fields we feed into cmake.  We use the same rules
28c4276
# as Linux SONAME versioning in libtool, but cmake should handle it for us.
28c4276
case $1 in
28c4276
CURRENT)
28c4276
	printf '%s' "${GDLIB_LT_CURRENT}"
28c4276
	;;
28c4276
REVISION)
28c4276
	printf '%s' "${GDLIB_LT_REVISION}"
28c4276
	;;
28c4276
AGE)
28c4276
	printf '%s' "${GDLIB_LT_AGE}"
28c4276
	;;
28c4276
VERSION)
28c4276
	printf '%s' "$(( GDLIB_LT_CURRENT - GDLIB_LT_AGE )).${GDLIB_LT_AGE}.${GDLIB_LT_REVISION}"
28c4276
	;;
28c4276
SONAME)
28c4276
	printf '%s' "$(( GDLIB_LT_CURRENT - GDLIB_LT_AGE ))"
28c4276
	;;
28c4276
esac