-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.sh
executable file
·63 lines (60 loc) · 2.08 KB
/
version.sh
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
#
# This script is used to generate version numbers for autotools
#
# The top-level main version is collected from the top-level build.xml
#
# The information for libtool is maintained manually since
# the public API for the C library can change independent of the project
#
# Do each of these steps in order and libtool will do the right thing
# (1) If there are changes to libavro:
# libavro_micro_version++
# libavro_interface_age++
# libavro_binary_age++
# (2) If any functions have been added:
# libavro_interface_age = 0
# (3) If backwards compatibility has been broken:
# libavro_binary_age = 0
# libavro_interface_age = 0
#
libavro_micro_version=22
libavro_interface_age=0
libavro_binary_age=0
# IGNORE EVERYTHING ELSE FROM HERE DOWN.........
if test $# != 1; then
echo "USAGE: $0 CMD"
echo " where CMD is one of: project, libtool, libcurrent, librevision, libage"
exit 1
fi
# http://sources.redhat.com/autobook/autobook/autobook_91.html
# 'Current' is the most recent interface number that this library implements
libcurrent=$(($libavro_micro_version - $libavro_interface_age))
# The implementation number of the 'current' interface
librevision=$libavro_interface_age
# The difference between the newest and oldest interfaces that this library implements
# In other words, the library implements all the interface numbers in the range from
# number 'current - age' to current
libage=$(($libavro_binary_age - $libavro_interface_age))
if test "$1" = "project"; then
project_ver="undef"
version_file="VERSION.txt"
if test -f $version_file; then
project_ver=$(cat $version_file)
else
version_file="../../share/VERSION.txt"
if test -f $version_file; then
project_ver=$(cat $version_file)
fi
fi
printf "%s" $project_ver
elif test "$1" = "libtool"; then
# useful for the -version-info flag for libtool
printf "%d:%d:%d" $libcurrent $librevision $libage
elif test "$1" = "libcurrent"; then
printf "%d" $libcurrent
elif test "$1" = "librevision"; then
printf "%d" $librevision
elif test "$1" = "libage"; then
printf "%d" $libage
fi