[svn-r10627] Purpose:

Feature - libtool shared library versioning

Description:
Libtool provides a mechanism for different versions of the same shared
library to be distinguished.  Now this is applied to HDF5 when it is
built as a shared library.

Solution:
The version number is stored in config/lt_vers.am, and included in
src/Makefile.am.
This number will be automatically updated by bin/h5vers; developers
only need to update it when they change the API.

*** IMPORTANT ***
Any time the API changes, the version number in config/lt_vers.am must
be updated!



Platforms tested:
mir, eirene, verbena, modi4

Misc. update:
This commit is contained in:
James Laird 2005-04-18 10:48:32 -05:00
parent 28a3ec7209
commit d8b08dbc85
5 changed files with 74 additions and 5 deletions

View File

@ -76,6 +76,7 @@
./config/linux-gnuaout
./config/linux-gnulibc1
./config/linux-gnulibc2
./config/lt_vers.am
./config/Makefile.am.blank
./config/pgi-fflags
./config/pgi-flags

View File

@ -72,6 +72,12 @@ use strict;
# something like: This is hdf5-1.2.3-pre1 currently under development.
# The AC_INIT macro in configure.in will also change in this case to be
# something like: AC_INIT([HDF5], [hdf5-1.2.3-pre1], [hdfhelp@ncsa.uiuc.edu])
#
# Whenever the version changes, this script will increment the revision
# field in HDF5's libtool shared library version in config/lt_vers.am,
# which is included in src/Makefile.am. Incrementing the revision field
# indicates that the source code has changed since the last version
# (which it probably has).
##############################################################################
sub getvers {
@ -150,9 +156,9 @@ while ($_ = shift) {
die "mutually exclusive options given\n" if $set && $inc;
# Determine file to use as H5public.h, README.txt,
# release_docs/RELEASE.txt, and configure.in. The README.txt,
# release_docs/RELEASE.txt, and configure.in files are always in the
# directory above H5public.h
# release_docs/RELEASE.txt, configure.in, and config/lt_vers.am. The
# README.txt, release_docs/RELEASE.txt, configure.in, and
# config/lt_vers.am files are always in the directory above H5public.h
unless ($file) {
for (@files) {
($file=$_,last) if -f $_;
@ -160,6 +166,10 @@ unless ($file) {
}
die "unable to find source files\n" unless defined $file;
die "unable to read file: $file\n" unless -r $file;
# config/lt_vers.am
my $LT_VERS = $file;
$LT_VERS =~ s/[^\/]*$/..\/config\/lt_vers.am/;
die "unable to read file: $LT_VERS\n" unless -r $file;
# README.txt
my $README = $file;
$README =~ s/[^\/]*$/..\/README.txt/;
@ -219,6 +229,7 @@ if ($set) {
$README = "";
$RELEASE = "";
$CONFIGURE = "";
$LT_VERS = "";
@newver = @curver;
}
@ -241,6 +252,23 @@ if ($newver[0]!=$curver[0] ||
close FILE;
}
# Update the libtool shared library version in src/Makefile.am
if ($LT_VERS) {
open FILE, $LT_VERS or die "$LT_VERS: $!\n";
my ($contentsy) = join "", <FILE>;
close FILE;
local($_) = $contentsy;
my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m;
my $new_lt_revision = $lt_revision+1;
($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m;
open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n";
print FILE $contentsy;
close FILE;
}
# Update the README.txt file
if ($README) {
open FILE, $README or die "$README: $!\n";

26
config/lt_vers.am Normal file
View File

@ -0,0 +1,26 @@
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 0
LT_VERS_REVISION = 0
LT_VERS_AGE = 0
## If the API changes *at all*, increment LT_VERS_INTERFACE and
## reset LT_VERS_REVISION to 0.
##
## If the API changes but no functions are removed, also increment
## LT_VERS_AGE.
## If any functions are removed from the API, reset LT_VERS_AGE
## to 0.
##
## If the source changes but there are no API changes, increment
## LT_VERS_REVISION. This will happen automatically when
## bin/h5vers is run, but doing it manually shouldn't hurt
## anything.
##
## Note that this versioning system doesn't attempt to handle
## the effects of the H5_V1_x_COMPAT flag.
##
## Since the revision number is automatically incremented by
## bin/h5vers, don't move LT_VERS_REVISION from the fourth line
## without also editing the script!

View File

@ -18,6 +18,7 @@
#
include $(top_srcdir)/config/commence.am
include $(top_srcdir)/config/lt_vers.am
# How to build H5detect for number format detection.
# Use -g to force no optimization since many compilers (e.g., Intel) takes
@ -29,6 +30,9 @@ H5detect_CFLAGS = -g
# Our main target, the HDF5 library
lib_LTLIBRARIES=libhdf5.la
# Add libtool numbers to the HDF5 library (from config/lt_vers.am)
libhdf5_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
# Temporary files
MOSTLYCLEANFILES=H5detect.o H5detect.lo H5detect H5Tinit.o H5Tinit.lo H5Tinit.c

View File

@ -60,7 +60,8 @@ host_triplet = @host@
DIST_COMMON = $(include_HEADERS) $(srcdir)/H5config.h.in \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/libhdf5.settings.in $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am
$(top_srcdir)/config/conclude.am \
$(top_srcdir)/config/lt_vers.am
noinst_PROGRAMS = H5detect$(EXEEXT)
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -336,11 +337,20 @@ H5CC = $(bindir)/h5cc
H5CC_PP = $(bindir)/h5pcc
H5FC = $(bindir)/h5fc
H5FC_PP = $(bindir)/h5pfc
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 0
LT_VERS_REVISION = 0
LT_VERS_AGE = 0
H5detect_CFLAGS = -g
# Our main target, the HDF5 library
lib_LTLIBRARIES = libhdf5.la
# Add libtool numbers to the HDF5 library (from config/lt_vers.am)
libhdf5_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
# Temporary files
MOSTLYCLEANFILES = H5detect.o H5detect.lo H5detect H5Tinit.o H5Tinit.lo H5Tinit.c
@ -420,7 +430,7 @@ all: H5config.h
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/lt_vers.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \