summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/avro/version.sh
blob: be90c0f6329f41fc2250f5b3f509a6685c7567c4 (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

# This script is used to generate version numbers for autotools
#
# 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=23
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

# https://www.sourceware.org/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