Author: massie
Date: Fri Oct 23 18:57:24 2009
New Revision: 829178

URL: http://svn.apache.org/viewvc?rev=829178&view=rev
Log:
AVRO-168. Correct shared library versioning for C implementation

Added:
    hadoop/avro/trunk/src/c/version.sh   (with props)
Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/src/c/Makefile.am
    hadoop/avro/trunk/src/c/configure.in

Modified: hadoop/avro/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=829178&r1=829177&r2=829178&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Fri Oct 23 18:57:24 2009
@@ -10,6 +10,8 @@
 
   IMPROVEMENTS
 
+    AVRO-168. Correct shared library versioning for C implementation (massie)
+
     AVRO-142. Remove some Java unused fields and imports.  Start
     running checkstyle on Java test code.  (Philip Zeyliger via cutting)
 

Modified: hadoop/avro/trunk/src/c/Makefile.am
URL: 
http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/Makefile.am?rev=829178&r1=829177&r2=829178&view=diff
==============================================================================
--- hadoop/avro/trunk/src/c/Makefile.am (original)
+++ hadoop/avro/trunk/src/c/Makefile.am Fri Oct 23 18:57:24 2009
@@ -4,7 +4,7 @@
 AM_CFLAGS=$(APR_CFLAGS) $(APR_INCLUDES) $(APU_INCLUDES) -Wall 
 C_DOCS_OUTPUT ?= "docs/dox"
 
-EXTRA_DIST=json_parser.y lemon.c lempar.c json_tests avro_schema_tests docs
+EXTRA_DIST=json_parser.y lemon.c lempar.c json_tests avro_schema_tests docs 
version.sh
 
 include_HEADERS = avro.h
 
@@ -17,6 +17,11 @@
 avro_record.c avro_string.c avro_union.c container_of.h \
 avro_io_file.c avro_io_socket.c avro_io_memory.c \
 avro_file_container.c avro_endian.c avro_primitives.c
+libavro_la_LDFLAGS = \
+        -version-info $(LIBAVRO_VERSION) \
+        -release $(VERSION) \
+        -export-dynamic
+
 
 check_PROGRAMS=test_json_parser test_avro_schema 
 

Modified: hadoop/avro/trunk/src/c/configure.in
URL: 
http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/configure.in?rev=829178&r1=829177&r2=829178&view=diff
==============================================================================
--- hadoop/avro/trunk/src/c/configure.in (original)
+++ hadoop/avro/trunk/src/c/configure.in Fri Oct 23 18:57:24 2009
@@ -2,12 +2,16 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT([avro-c], [1], [http://issues.apache.org/jira/browse/AVRO])
+AC_INIT([avro-c], m4_esyscmd([./version.sh project]), 
[http://issues.apache.org/jira/browse/AVRO])
 AC_CONFIG_AUX_DIR([config])
 AM_INIT_AUTOMAKE
 AC_CONFIG_SRCDIR([avro.h])
 AC_CONFIG_HEADER([config.h])
 
+LIBAVRO_VERSION=m4_esyscmd([./version.sh libtool])
+AC_SUBST(LIBAVRO_VERSION)
+AC_DEFINE_UNQUOTED(LIBAVRO_VERSION, $LIBAVRO_VERSION, [Libtool version info 
for libavro])
+
 # Checks for programs.
 AC_PROG_CC
 AC_PROG_LIBTOOL
@@ -79,5 +83,6 @@
 echo " / ___ \ V /| | | (_) |"
 echo "/_/   \_\_/ |_|  \___/ "
 echo
-echo "         Version: $VERSION"
+echo "Version: $VERSION"
+echo "Library: $LIBAVRO_VERSION"              
 echo

Added: hadoop/avro/trunk/src/c/version.sh
URL: 
http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/version.sh?rev=829178&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/version.sh (added)
+++ hadoop/avro/trunk/src/c/version.sh Fri Oct 23 18:57:24 2009
@@ -0,0 +1,58 @@
+#!/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=1
+libavro_interface_age=1
+libavro_binary_age=1
+
+# 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
+       build_xml="../../build.xml"
+       project_ver="undef"
+       if test -f $build_xml; then
+               project_ver=$(sed -n 
'/name="version"/s/.*value="\(.*\)".*$/\1/p' $build_xml)
+       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

Propchange: hadoop/avro/trunk/src/c/version.sh
------------------------------------------------------------------------------
    svn:executable = *


Reply via email to