[Pvfs2-developers] [PATCH 2/2] library versioning

Sam Lang slang at mcs.anl.gov
Fri Mar 14 14:34:15 EST 2008


On Mar 14, 2008, at 2:23 PM, Pete Wyckoff wrote:

> This one I also think is good.  But it installs things like this:
>
> titan$ ll /usr/local/pvfs-test/lib
> total 2712
> drwxr-xr-x 2 pw pw    4096 2008-03-14 15:16 ./
> drwxr-xr-x 7 pw pw    4096 2008-03-14 15:16 ../
> lrwxrwxrwx 1 pw pw      13 2008-03-14 15:16 libpvfs2.so ->  
> libpvfs2.so.2*
> lrwxrwxrwx 1 pw pw      17 2008-03-14 15:16 libpvfs2.so.2 ->  
> libpvfs2.so.2.7.1*
> -rwxr-xr-x 1 pw pw 2763856 2008-03-14 15:16 libpvfs2.so.2.7.1*
>
> which is a bit different, but hopefully causes no damage.
>
> Now would be a good opportunity to rename pvfs2 -> pvfs above since
> we have the major version in the version string already.
>
> Also we should remember to do the numbers properly.  If making no
> change to the ABI, increment just the release part.  If making
> upward compatible changes, increment minor.  Else increment major.

Works for me.

>
>
> We can look into doing in-library symbol versioning too for future
> changes like tweaking the create API without breaking old
> pre-compiled apps, if anyone is compelled.

That would be cool.
-sam

>
>
> 		-- Pete
>
>
> This patch adds a version code to the installed shared libraries,
> libpvfs2.so and possibly libpvfs2-threaded.so.  Library versioning
> is considered a good thing, in that apps can know what version of the
> library they need.  Use the actual PVFS version numbers to build
> the library version string.  This is not always the right thing to do,
> but works for us because we pay attention to the meaning of "major",
> "minor" and "release" changes.  Adapted from a patch by Justin  
> Bronder.
> ---
> Makefile.in  |   22 +++++++++++++++++++---
> configure    |   33 +++++++++++++++++++++------------
> configure.in |   19 +++++++++++--------
> 3 files changed, 51 insertions(+), 23 deletions(-)
>
> diff --git a/Makefile.in b/Makefile.in
> index 777afd3..a9e9f30 100644
> --- a/Makefile.in
> +++ b/Makefile.in
> @@ -65,6 +65,7 @@ INSTALL = @INSTALL@
> # TODO: should probably check for bison and flex in configure
> BISON = bison
> FLEX = flex
> +LN_S = ln -snf
> BUILD_BMI_TCP = @BUILD_BMI_TCP@
> BUILD_GM = @BUILD_GM@
> BUILD_MX = @BUILD_MX@
> @@ -166,6 +167,10 @@ TRUSTED_CONNECTIONS = @TRUSTED_CONNECTIONS@
> REDHAT_RELEASE = @REDHAT_RELEASE@
> NPTL_WORKAROUND = @NPTL_WORKAROUND@
> STRICT_CFLAGS = @STRICT_CFLAGS@
> +SO_VER = @PVFS2_VERSION_MAJOR@
> +SO_MINOR = @PVFS2_VERSION_MINOR@
> +SO_RELEASE = @PVFS2_VERSION_SUB@
> +SO_FULLVER = $(SO_VER).$(SO_MINOR).$(SO_RELEASE)
> # for Solaris:
> # LIBS += -lsocket -lnsl
>
> @@ -647,13 +652,13 @@ lib/libpvfs2-threaded.a: $(LIBTHREADEDOBJS)
> lib/libpvfs2.so: $(LIBPICOBJS)
> 	$(Q) "  LDSO		$@"
> 	$(E)$(INSTALL) -d lib
> -	$(E)$(LDSHARED) -o $@ $(LIBPICOBJS) $(DEPLIBS)
> +	$(E)$(LDSHARED) -Wl,-soname,libpvfs2.so -o $@ $(LIBPICOBJS) $ 
> (DEPLIBS)
>
> # rule for building the pvfs2 _multithreaded_ library
> lib/libpvfs2-threaded.so: $(LIBTHREADEDPICOBJS)
> 	$(Q) "  LDSO		$@"
> 	$(E)$(INSTALL) -d lib
> -	$(E)$(LDSHARED) -o $@ $(LIBTHREADEDPICOBJS) $(DEPLIBS)
> +	$(E)$(LDSHARED) -Wl,-soname,libpvfs2-threaded.so -o $@ $ 
> (LIBTHREADEDPICOBJS) $(DEPLIBS)
>
> # rule for building the pvfs2 server library
> lib/libpvfs2-server.a: $(SERVEROBJS)
> @@ -915,7 +920,18 @@ install:: all install_doc
> 	install -m 644 $(srcdir)/include/pvfs2-encode-stubs.h $(includedir)
>
> 	install -d $(libdir)
> -	install -m 755 $(LIBRARIES) $(libdir)
> +ifneq (,$(LIBRARIES_STATIC))
> +	for i in $(notdir $(LIBRARIES_STATIC)) ; do \
> +	    install -m 755 lib/$$i $(libdir) ;\
> +	done
> +endif
> +ifneq (,$(LIBRARIES_SHARED))
> +	for i in $(notdir $(LIBRARIES_SHARED)) ; do \
> +	    install -m 755 lib/$$i $(libdir)/$$i.$(SO_FULLVER) ;\
> +	    $(LN_S) $$i.$(SO_FULLVER) $(libdir)/$$i.$(SO_VER) ;\
> +	    $(LN_S) $$i.$(SO_VER) $(libdir)/$$i ;\
> +	done
> +endif
>
> ifdef TARGET_OS_DARWIN
> #       TOC needs to be regenerated in libs after they get moved
> diff --git a/configure b/configure
> index 1b27ffb..195c440 100755
> --- a/configure
> +++ b/configure
> @@ -651,6 +651,9 @@ build_alias
> host_alias
> target_alias
> PVFS2_VERSION
> +PVFS2_VERSION_MAJOR
> +PVFS2_VERSION_MINOR
> +PVFS2_VERSION_SUB
> build
> build_cpu
> build_vendor
> @@ -1841,30 +1844,33 @@ ac_configure="$SHELL $ac_aux_dir/configure"   
> # Please don't use this var.
>
>
> CONFIGURE_TIME=`date -u +"%Y-%m-%d-%H%M%S"`
> -PVFS2_MAJOR=2
> -PVFS2_MINOR=7
> -PVFS2_SUB=1
> +PVFS2_VERSION_MAJOR=2
> +PVFS2_VERSION_MINOR=7
> +PVFS2_VERSION_SUB=1
> #PVFS2_PRE=""
> -PVFS2_PRE="pre1-$CONFIGURE_TIME"
> +PVFS2_VERSION_PRE="pre1-$CONFIGURE_TIME"
>
> -PVFS2_VERSION=$PVFS2_MAJOR.$PVFS2_MINOR.$PVFS2_SUB$PVFS2_PRE
> +PVFS2_VERSION=$PVFS2_VERSION_MAJOR.$PVFS2_VERSION_MINOR. 
> $PVFS2_VERSION_SUB$PVFS2_VERSION_PRE
>
>
> cat >>confdefs.h <<_ACEOF
> -#define PVFS2_VERSION_MAJOR $PVFS2_MAJOR
> +#define PVFS2_VERSION_MAJOR $PVFS2_VERSION_MAJOR
> _ACEOF
>
>
> cat >>confdefs.h <<_ACEOF
> -#define PVFS2_VERSION_MINOR $PVFS2_MINOR
> +#define PVFS2_VERSION_MINOR $PVFS2_VERSION_MINOR
> _ACEOF
>
>
> cat >>confdefs.h <<_ACEOF
> -#define PVFS2_VERSION_SUB $PVFS2_SUB
> +#define PVFS2_VERSION_SUB $PVFS2_VERSION_SUB
> _ACEOF
>
>
> +
> +
> +
> # Make sure we can run config.sub.
> $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
>   { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/ 
> config.sub" >&5
> @@ -18543,6 +18549,9 @@ build_alias!$build_alias$ac_delim
> host_alias!$host_alias$ac_delim
> target_alias!$target_alias$ac_delim
> PVFS2_VERSION!$PVFS2_VERSION$ac_delim
> +PVFS2_VERSION_MAJOR!$PVFS2_VERSION_MAJOR$ac_delim
> +PVFS2_VERSION_MINOR!$PVFS2_VERSION_MINOR$ac_delim
> +PVFS2_VERSION_SUB!$PVFS2_VERSION_SUB$ac_delim
> build!$build$ac_delim
> build_cpu!$build_cpu$ac_delim
> build_vendor!$build_vendor$ac_delim
> @@ -18599,9 +18608,6 @@ PVFS2_SEGV_BACKTRACE!$PVFS2_SEGV_BACKTRACE 
> $ac_delim
> build_shared!$build_shared$ac_delim
> INTELC!$INTELC$ac_delim
> GNUC!$GNUC$ac_delim
> -DB_CFLAGS!$DB_CFLAGS$ac_delim
> -DB_LIB!$DB_LIB$ac_delim
> -NEEDS_LIBRT!$NEEDS_LIBRT$ac_delim
> _ACEOF
>
>   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X`  
> = 97; then
> @@ -18643,6 +18649,9 @@ _ACEOF
> ac_delim='%!_!# '
> for ac_last_try in false false false false false :; do
>   cat >conf$$subs.sed <<_ACEOF
> +DB_CFLAGS!$DB_CFLAGS$ac_delim
> +DB_LIB!$DB_LIB$ac_delim
> +NEEDS_LIBRT!$NEEDS_LIBRT$ac_delim
> TARGET_OS_DARWIN!$TARGET_OS_DARWIN$ac_delim
> TARGET_OS_LINUX!$TARGET_OS_LINUX$ac_delim
> BUILD_BMI_TCP!$BUILD_BMI_TCP$ac_delim
> @@ -18670,7 +18679,7 @@ LIBOBJS!$LIBOBJS$ac_delim
> LTLIBOBJS!$LTLIBOBJS$ac_delim
> _ACEOF
>
> -  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X`  
> = 25; then
> +  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X`  
> = 28; then
>     break
>   elif $ac_last_try; then
>     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS"  
> >&5
> diff --git a/configure.in b/configure.in
> index d4a34f3..3fecc6b 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -16,17 +16,20 @@ dnl
> dnl PVFS2 versioning information.
> dnl An @ in the date string can confuse e.g. scp and 'make kmod'
> CONFIGURE_TIME=`date -u +"%Y-%m-%d-%H%M%S"`
> -PVFS2_MAJOR=2
> -PVFS2_MINOR=7
> -PVFS2_SUB=1
> +PVFS2_VERSION_MAJOR=2
> +PVFS2_VERSION_MINOR=7
> +PVFS2_VERSION_SUB=1
> #PVFS2_PRE=""
> -PVFS2_PRE="pre1-$CONFIGURE_TIME"
> +PVFS2_VERSION_PRE="pre1-$CONFIGURE_TIME"
>
> -PVFS2_VERSION=$PVFS2_MAJOR.$PVFS2_MINOR.$PVFS2_SUB$PVFS2_PRE
> +PVFS2_VERSION=$PVFS2_VERSION_MAJOR.$PVFS2_VERSION_MINOR. 
> $PVFS2_VERSION_SUB$PVFS2_VERSION_PRE
> AC_SUBST(PVFS2_VERSION)
> -AC_DEFINE_UNQUOTED(PVFS2_VERSION_MAJOR, $PVFS2_MAJOR, major version  
> number)
> -AC_DEFINE_UNQUOTED(PVFS2_VERSION_MINOR, $PVFS2_MINOR, minor version  
> number)
> -AC_DEFINE_UNQUOTED(PVFS2_VERSION_SUB, $PVFS2_SUB, sub version number)
> +AC_DEFINE_UNQUOTED(PVFS2_VERSION_MAJOR, $PVFS2_VERSION_MAJOR, major  
> version number)
> +AC_DEFINE_UNQUOTED(PVFS2_VERSION_MINOR, $PVFS2_VERSION_MINOR, minor  
> version number)
> +AC_DEFINE_UNQUOTED(PVFS2_VERSION_SUB, $PVFS2_VERSION_SUB, sub  
> version number)
> +AC_SUBST(PVFS2_VERSION_MAJOR)
> +AC_SUBST(PVFS2_VERSION_MINOR)
> +AC_SUBST(PVFS2_VERSION_SUB)
>
> dnl Checks for host type
> dnl Ensures we can compile on this OS
> -- 
> 1.5.4.1
>
> _______________________________________________
> Pvfs2-developers mailing list
> Pvfs2-developers at beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
Url : http://www.beowulf-underground.org/pipermail/pvfs2-developers/attachments/20080314/406a3caa/smime-0001.bin


More information about the Pvfs2-developers mailing list