< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate] soname for shared libraries


I /think/ this is a good idea, although we'd need to do more than your patch does (for starters, we'd need to change a bunch of stuff in build/Makefile.pkg to get all the various apps/test programs to build). I am not sure how much of a shock this would be for people whose build systems assume unversioned libs. At any rate, I think I should go through a few releases and see how much our API/ABI tends to change from release to release.

Best regards,
Byron Campen

Hi,

Currently I'm trying to package reSIProcate for Debian[0]. This is a rather difficult process due to many requirements for Debian library packages[1].

The most difficult packaging problem is to get the shared object name and version right.

Correct me if I'm wrong, but reSIProcate doesn't provide ABI or API compatibility between releases. So according to [1] adding a release version to the soname is recommended.

This would result in the following package layout:

libresiprocate-1.5:
/usr/lib/librutil-1.5.so (soname librutil-1.5.so)
/usr/lib/libresip-1.5.so (soname libresip-1.5.so)
/usr/lib/libdum-1.5.so   (soname libdum-1.5.so)

libresiprocate-1.5-dev:
/usr/lib/librutil.so (-> librutil-1.5.so)
/usr/lib/libresip.so (-> libresip-1.5.so)
/usr/lib/libdum.so   (-> libdum-1.5.so)

So, for the linking process nothing changes. Developers will continue to link via -ldum. But due to the soname the linker will search for libdum-1.5.so on startup. That way it will be possible to have different (library) packages of resiprocate installed in parallel and also an defined upgrade path. For the development packages there will be only a single version installable.

Attached to this mail you'll find a patch for the described behavior.
Are you willing to apply this patch? Maybe in a modified form?

Thanks for your comments!
Gregor

[0] http://git.debian.org/?p=collab-maint/resiprocate.git;a=summary
[1] http://packages.debian.org/de/sid/libpkg-guide
From: Gregor Jasny <gjasny@xxxxxxxxxxxxxx>
Subject: [PATCH] features/versioned-libraries

Add version information to shared libraries.

Signed-off-by: Gregor Jasny <gjasny@xxxxxxxxxxxxxx>

---
build/Makefile.post  |   12 +++++++++++-
build/Makefile.tools |    1 +
2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/build/Makefile.post b/build/Makefile.post
index 5db4ee5..742b650 100644
--- a/build/Makefile.post
+++ b/build/Makefile.post
@@ -120,6 +120,11 @@ DEPENDENCIES = $(patsubst %.cpp,$(OBJ)/%.d,$ (patsubst %.c,$(OBJ)/%.d,$(patsubst SHARED_LIB = $(patsubst %,$(OBJ)/%.$(SHARED_EXTENSION),$(strip $ (TARGET_LIBRARY)))
STATIC_LIB = $(patsubst %,$(OBJ)/%.a,$(strip $(TARGET_LIBRARY)))

+VERSION_MAJ=1
+VERSION_MIN=5
+
+VERSION_SUFFIX=-$(VERSION_MAJ).$(VERSION_MIN)
+
ifeq ($(BUILD_SHARED_LIBS),yes)
LIBTARGETS += $(SHARED_LIB)
else
@@ -295,7 +300,7 @@ $(OBJ)/$(strip $(TARGET_LIBRARY)).a: $(OBJS) $ (OTHERLIBS)

$(OBJ)/$(strip $(TARGET_LIBRARY)).$(SHARED_EXTENSION): $(OBJS) $ (OTHERLIBS)
        -@ test -f $@ && /bin/rm $@
-       $(MKSHLIB) -o $@ $^
+ $(MKSHLIB) $(call MKSONAME,$(strip $(TARGET_LIBRARY))$ (VERSION_SUFFIX).$(SHARED_EXTENSION)) -o $@ $^
        -@ mkdir -p $(ROOT)/lib.$(TARGET_NAME)
@ test -h $(ROOT)/lib.$(TARGET_NAME)/$(strip $(TARGET_LIBRARY)).$ (SHARED_EXTENSION) || ln -s $(shell pwd)/$@ $(ROOT)/lib.$(TARGET_NAME)
endif
@@ -314,7 +319,12 @@ INSTALL_INCDIR := $(DESTDIR)$(INSTALL_PREFIX)/ include/$(subst lib,,$(TARGET_LIBR
install: all
        $(INSTALL) -d $(DESTDIR)$(INSTALL_PREFIX)
        $(INSTALL) -d $(DESTDIR)$(INSTALL_PREFIX)/lib
+ifeq ($(BUILD_SHARED_LIBS),yes)
+ $(INSTALL) $(OBJ)/$(TARGET_LIBRARY).$(LIBSUFFIX) $(INSTALL_LIBDIR)/ $(TARGET_LIBRARY)$(VERSION_SUFFIX).$(LIBSUFFIX) + @ ln -sf $(TARGET_LIBRARY)$(VERSION_SUFFIX).$(LIBSUFFIX) $ (INSTALL_LIBDIR)/$(TARGET_LIBRARY).$(LIBSUFFIX)
+else
$(INSTALL) $(OBJ)/$(TARGET_LIBRARY).$(LIBSUFFIX) $(INSTALL_LIBDIR)/$ (TARGET_LIBRARY).$(LIBSUFFIX)
+endif
        $(INSTALL) -d $(INSTALL_INCDIR)
        $(INSTALL) -m 644 *.h* $(INSTALL_INCDIR)
ifdef CODE_SUBDIRS
diff --git a/build/Makefile.tools b/build/Makefile.tools
index 0e0ab5e..7aaf4fa 100644
--- a/build/Makefile.tools
+++ b/build/Makefile.tools
@@ -36,6 +36,7 @@ ifeq ($(OSTYPE),Darwin)
  MKSHLIB               += -dynamiclib -undefined dynamic_lookup
else
  MKSHLIB               += -shared
+  MKSONAME             = -Wl,-soname,$(1)
endif

DEP             := $(CXX)
--
tg: (e925bc8..) features/versioned-libraries (depends on: upstream)
_______________________________________________
resiprocate-devel mailing list
resiprocate-devel@xxxxxxxxxxxxxxx
https://list.resiprocate.org/mailman/listinfo/resiprocate-devel

Attachment: smime.p7s
Description: S/MIME cryptographic signature