~stub/ubuntu/trusty/avro-c/trunk

« back to all changes in this revision

Viewing changes to version.sh

  • Committer: Stuart Bishop
  • Date: 2015-05-14 11:53:53 UTC
  • Revision ID: stuart@stuartbishop.net-20150514115353-0cvnrcyohcq5l7yj
Tags: upstream-1.7.7
ImportĀ upstreamĀ versionĀ 1.7.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
# This script is used to generate version numbers for autotools
 
4
#
 
5
# The top-level main version is collected from the top-level build.xml
 
6
#
 
7
# The information for libtool is maintained manually since
 
8
# the public API for the C library can change independent of the project
 
9
#
 
10
# Do each of these steps in order and libtool will do the right thing
 
11
# (1) If there are changes to libavro:
 
12
#         libavro_micro_version++
 
13
#         libavro_interface_age++ 
 
14
#         libavro_binary_age++
 
15
# (2) If any functions have been added:
 
16
#         libavro_interface_age = 0
 
17
# (3) If backwards compatibility has been broken:
 
18
#         libavro_binary_age = 0
 
19
#         libavro_interface_age = 0
 
20
#
 
21
libavro_micro_version=22
 
22
libavro_interface_age=0
 
23
libavro_binary_age=0
 
24
 
 
25
# IGNORE EVERYTHING ELSE FROM HERE DOWN.........
 
26
if test $# != 1; then
 
27
        echo "USAGE: $0 CMD"
 
28
        echo "  where CMD is one of: project, libtool, libcurrent, librevision, libage"
 
29
        exit 1
 
30
fi
 
31
 
 
32
# http://sources.redhat.com/autobook/autobook/autobook_91.html
 
33
# 'Current' is the most recent interface number that this library implements
 
34
libcurrent=$(($libavro_micro_version - $libavro_interface_age))
 
35
# The implementation number of the 'current' interface
 
36
librevision=$libavro_interface_age
 
37
# The difference between the newest and oldest interfaces that this library implements
 
38
# In other words, the library implements all the interface numbers in the range from 
 
39
# number 'current - age' to current
 
40
libage=$(($libavro_binary_age - $libavro_interface_age))
 
41
 
 
42
if test "$1" = "project"; then
 
43
        project_ver="undef"
 
44
        version_file="VERSION.txt"
 
45
        if test -f $version_file; then
 
46
                project_ver=$(cat $version_file)
 
47
        else
 
48
                version_file="../../share/VERSION.txt"
 
49
                if test -f $version_file; then
 
50
                        project_ver=$(cat $version_file)
 
51
                fi
 
52
        fi
 
53
        printf "%s" $project_ver
 
54
elif test "$1" = "libtool"; then
 
55
        # useful for the -version-info flag for libtool
 
56
        printf "%d:%d:%d" $libcurrent $librevision $libage
 
57
elif test "$1" = "libcurrent"; then
 
58
        printf "%d" $libcurrent
 
59
elif test "$1" = "librevision"; then
 
60
        printf "%d" $librevision
 
61
elif test "$1" = "libage"; then
 
62
        printf "%d" $libage
 
63
fi