Re: Libtool and Shared Library Version numbers



Tero Pulkkinen wrote:

> Christof Petig <christof.petig@wtal.de> writes:
> > In correspondance with Marcus Brinkmann (debian maintainer of gtk--,
> > glade, glade--, perhaps more) I said I was shocked to see a shared
> > library named 'gtk-1.1.so.0.0.0'. I promised to take a deep look inside
> > libtool to find out how to fix this. He answered if I could find out how
> > to set sensible version number, I should tell you first.
>
> Hmm, where is this -version-info argument given for libtool?
> (if I can use variables from configure.in for that arg, then
> could start using the method specified in the libtool info page...)
>
> >  [...]
>
> This does work fine... It isnt huge job to update this number when updating
> the release number too..
>
> The gtk way of doing library versioning kinda sucks. IMHO. Gtk shared
> lib versions should be fixed asap! :)

 Hi Tero,

here are three patches to implement shared library versioning for gtkmm, since
they might be of interest to the gtk people, I cc them to gtk-list.

First one: use libtool's versioning sceme

Second one: stamp package version into library version (not recommended, see
previous posting)

Third one: stamp package version and use libtool's versioning sceme
(e.g. libgtkmm-0.9.7.so.1.0.0 <- libgtkmm-0.9.7.so.1 <- libgtkmm.so)
if you want libgtkmm.so.1 you might replace line 1160 of ltconfig
(soname_spec='${libname}${release}.so.$major) by
soname_spec='${libname}.so.$major, and change the preceding line accordingly.
It's not only a matter of taste, but enables cross-version runtime usage IF
the libtool version is well maintained!

I would recommend the third one, then the first one, second one is last
ressort (no runtime version control).

For Gtk 1.1 I would recommend to use
libgtk-980709.so.2.1.7 and so on (-release <date> -version-info 2:7:1)
[2.7.1 is just an random number, replace by a true versioning sceme]. They
should keep the release-date within the so-name (binary incompatibility
indicator).

This (that gtk's and gtkmm's policy differ) might be an indicator for a new
libtool flag (-releases-are-binary-[in]compatible).

Enjoy
      Christof
--- /home/christof/Gtk---0.9.7/configure.in	Tue Jun 16 01:05:42 1998
+++ configure.in	Thu Jul  9 09:50:55 1998
@@ -12,6 +12,9 @@
 AC_DEFINE_UNQUOTED(GTKMM_MICRO_VERSION, $GTKMM_MICRO_VERSION)
 AC_SUBST(GTKMM_VERSION)
 
+LIBGTKMM_SO_VERSION=1:0:0
+AC_SUBST(LIBGTKMM_SO_VERSION)
+
 # For automake.
 VERSION=$GTKMM_VERSION                                                          
 PACKAGE=Gtk--                                                                   
--- /home/christof/Gtk---0.9.7/src/gtk--/Makefile.am	Mon Jun 15 21:16:11 1998
+++ src/gtk--/Makefile.am	Thu Jul  9 09:54:08 1998
@@ -49,7 +49,7 @@
 # This builds the library
 libgtkmm_la_SOURCES = $(gtkmmc)
 #libgtkmm_la_DEPENDENCIES = genfiles
-libgtkmm_la_LDFLAGS = $(GTK_LIBS) -no-undefined
+libgtkmm_la_LDFLAGS = -version-info @LIBGTKMM_SO_VERSION@ $(GTK_LIBS) -no-undefined
 libgtkmm_la_INCLUDES = $(GTK_CFLAGS)
 
 DISTCLEANFILES = $(gtkmmh) $(gtkmmc)
--- /home/christof/Gtk---0.9.7/configure.in	Tue Jun 16 01:05:42 1998
+++ configure.in	Thu Jul  9 10:15:56 1998
@@ -12,6 +12,10 @@
 AC_DEFINE_UNQUOTED(GTKMM_MICRO_VERSION, $GTKMM_MICRO_VERSION)
 AC_SUBST(GTKMM_VERSION)
 
+LIBTOOL_CURRENT=`expr $GTKMM_MAJOR_VERSION + $GTKMM_MINOR_VERSION`
+LIBGTKMM_SO_VERSION="$LIBTOOL_CURRENT:$GTKMM_MICRO_VERSION:$GTKMM_MINOR_VERSION"
+AC_SUBST(LIBGTKMM_SO_VERSION)
+
 # For automake.
 VERSION=$GTKMM_VERSION                                                          
 PACKAGE=Gtk--                                                                   
--- /home/christof/Gtk---0.9.7/src/gtk--/Makefile.am	Mon Jun 15 21:16:11 1998
+++ src/gtk--/Makefile.am	Thu Jul  9 10:14:31 1998
@@ -49,7 +49,7 @@
 # This builds the library
 libgtkmm_la_SOURCES = $(gtkmmc)
 #libgtkmm_la_DEPENDENCIES = genfiles
-libgtkmm_la_LDFLAGS = $(GTK_LIBS) -no-undefined
+libgtkmm_la_LDFLAGS = -version-info "$(LIBGTKMM_SO_VERSION)" $(GTK_LIBS) -no-undefined
 libgtkmm_la_INCLUDES = $(GTK_CFLAGS)
 
 DISTCLEANFILES = $(gtkmmh) $(gtkmmc)
--- /home/christof/Gtk---0.9.7/configure.in	Tue Jun 16 01:05:42 1998
+++ configure.in	Thu Jul  9 10:19:35 1998
@@ -12,6 +12,10 @@
 AC_DEFINE_UNQUOTED(GTKMM_MICRO_VERSION, $GTKMM_MICRO_VERSION)
 AC_SUBST(GTKMM_VERSION)
 
+LIBGTKMM_SO_VERSION="1:0:0"
+AC_SUBST(LIBGTKMM_SO_VERSION)
+
+
 # For automake.
 VERSION=$GTKMM_VERSION                                                          
 PACKAGE=Gtk--                                                                   
--- /home/christof/Gtk---0.9.7/src/gtk--/Makefile.am	Mon Jun 15 21:16:11 1998
+++ src/gtk--/Makefile.am	Thu Jul  9 10:21:56 1998
@@ -49,7 +49,8 @@
 # This builds the library
 libgtkmm_la_SOURCES = $(gtkmmc)
 #libgtkmm_la_DEPENDENCIES = genfiles
-libgtkmm_la_LDFLAGS = $(GTK_LIBS) -no-undefined
+libgtkmm_la_LDFLAGS = -release $(GTKMM_VERSION) \
+	-version-info $(LIBGTKMM_SO_VERSION) $(GTK_LIBS) -no-undefined
 libgtkmm_la_INCLUDES = $(GTK_CFLAGS)
 
 DISTCLEANFILES = $(gtkmmh) $(gtkmmc)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]