[Olsr-dev] [PATCH 1/1] [RFC] Linux: correctly set plugin soname

Ferry Huberts (spam-protected)
Wed Aug 17 13:36:56 CEST 2011


From: Ferry Huberts <(spam-protected)>

By convention, non-core libraries should start with the 'lib'
prefix on Linux systems. Currently this is not the case for the
olsrd plugin libraries.

Since renaming them would break all configurations, the soname
of an olsrd plugin library is now correctly set so that a
'ldconfig -l <library>' will create the correct link.

This patches fixes the issue for Linux only, other platforms
are not touched since I don't have those platforms available.

To completely fix the issue, PLUGIN_FULLNAME must be set as:
  PLUGIN_FULLNAME ?= lib$(PLUGIN_NAME).so.$(PLUGIN_VER)
But this will rename all olsrd plugin libraries.

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 Makefile.inc          |    2 +-
 make/Makefile.android |    1 +
 make/Makefile.fbsd    |    1 +
 make/Makefile.kfbsd   |    1 +
 make/Makefile.linux   |    1 +
 make/Makefile.nbsd    |    1 +
 make/Makefile.obsd    |    1 +
 make/Makefile.osx     |    1 +
 make/Makefile.win32   |    1 +
 9 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/Makefile.inc b/Makefile.inc
index 1f254d9..34af527 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -137,7 +137,7 @@ ifeq ($(OS),win32)
   LDFLAGS +=	-Wl,-export-all-symbols,--enable-auto-import
 endif
 LDFLAGS +=	-shared
-LDFLAGS +=	-Wl,-soname,$(PLUGIN_NAME)
+LDFLAGS +=	-Wl,-soname,$(PLUGIN_SONAME)
 LDFLAGS +=	-Wl,--version-script=version-script.txt 
 else
 # c and ld flags for main
diff --git a/make/Makefile.android b/make/Makefile.android
index e323ec8..0b57a84 100644
--- a/make/Makefile.android
+++ b/make/Makefile.android
@@ -70,6 +70,7 @@ CPPFLAGS += \
 	-fno-strict-aliasing
 endif
 
+PLUGIN_SONAME ?= $(PLUGIN_NAME)
 PLUGIN_FULLNAME ?= $(PLUGIN_NAME).so.$(PLUGIN_VER)
 INSTALL_LIB =	install -D -m 755 $(PLUGIN_FULLNAME) $(LIBDIR)/$(PLUGIN_FULLNAME); \
 		/sbin/ldconfig -n $(LIBDIR)
diff --git a/make/Makefile.fbsd b/make/Makefile.fbsd
index 67074c8..283e3ff 100644
--- a/make/Makefile.fbsd
+++ b/make/Makefile.fbsd
@@ -32,6 +32,7 @@ CFLAGS +=	-fPIC
 LDFLAGS +=	-fPIC
 endif
 
+PLUGIN_SONAME ?= $(PLUGIN_NAME)
 PLUGIN_FULLNAME ?= $(PLUGIN_NAME).so.$(PLUGIN_VER)
 INSTALL_LIB =	install -m 755 $(PLUGIN_FULLNAME) $(LIBDIR)/$(PLUGIN_FULLNAME); \
 		/sbin/ldconfig
diff --git a/make/Makefile.kfbsd b/make/Makefile.kfbsd
index b2841ae..933a1e2 100644
--- a/make/Makefile.kfbsd
+++ b/make/Makefile.kfbsd
@@ -34,6 +34,7 @@ CFLAGS +=	-fPIC
 LDFLAGS +=	-fPIC
 endif
 
+PLUGIN_SONAME ?= $(PLUGIN_NAME)
 PLUGIN_FULLNAME ?= $(PLUGIN_NAME).so.$(PLUGIN_VER)
 INSTALL_LIB =	install -m 755 $(PLUGIN_FULLNAME) $(LIBDIR)/$(PLUGIN_FULLNAME);
 UNINSTALL_LIB =	rm -f $(LIBDIR)/$(PLUGIN_FULLNAME);
diff --git a/make/Makefile.linux b/make/Makefile.linux
index 3292258..3fb19b9 100644
--- a/make/Makefile.linux
+++ b/make/Makefile.linux
@@ -12,6 +12,7 @@ HDRS +=		$(wildcard src/linux/*.h src/unix/*.h)
 CPPFLAGS += 	-Dlinux -DLINUX_NETLINK_ROUTING
 LIBS +=		
 
+PLUGIN_SONAME ?= lib$(PLUGIN_NAME).so
 PLUGIN_FULLNAME ?= $(PLUGIN_NAME).so.$(PLUGIN_VER)
 INSTALL_LIB =	install -D -m 755 $(PLUGIN_FULLNAME) $(LIBDIR)/$(PLUGIN_FULLNAME); \
 		/sbin/ldconfig -n $(LIBDIR)
diff --git a/make/Makefile.nbsd b/make/Makefile.nbsd
index 4d655f3..392b1c0 100644
--- a/make/Makefile.nbsd
+++ b/make/Makefile.nbsd
@@ -11,6 +11,7 @@ HDRS +=		$(wildcard src/bsd/*.h src/unix/*.h)
 CPPFLAGS +=	-D__NetBSD__
 LIBS +=		
 
+PLUGIN_SONAME ?= $(PLUGIN_NAME)
 PLUGIN_FULLNAME ?= $(PLUGIN_NAME).so.$(PLUGIN_VER)
 INSTALL_LIB =	install -m 755 $(PLUGIN_FULLNAME) $(LIBDIR)/$(PLUGIN_FULLNAME); \
 		/sbin/ldconfig
diff --git a/make/Makefile.obsd b/make/Makefile.obsd
index ea2c1e0..1cac7df 100644
--- a/make/Makefile.obsd
+++ b/make/Makefile.obsd
@@ -11,6 +11,7 @@ HDRS +=		$(wildcard src/bsd/*.h src/unix/*.h)
 CPPFLAGS +=	-D__OpenBSD__
 LIBS +=		
 
+PLUGIN_SONAME ?= $(PLUGIN_NAME)
 PLUGIN_FULLNAME ?= $(PLUGIN_NAME).so.$(PLUGIN_VER)
 INSTALL_LIB =	install -m 755 $(PLUGIN_FULLNAME) $(LIBDIR)/$(PLUGIN_FULLNAME); \
 		/sbin/ldconfig
diff --git a/make/Makefile.osx b/make/Makefile.osx
index a74dc16..614a28c 100644
--- a/make/Makefile.osx
+++ b/make/Makefile.osx
@@ -15,6 +15,7 @@ HDRS +=		$(wildcard src/bsd/*.h src/unix/*.h)
 CPPFLAGS +=	-D__MacOSX__
 LIBS +=		
 
+PLUGIN_SONAME ?= $(PLUGIN_NAME)
 PLUGIN_FULLNAME ?= $(PLUGIN_NAME).so.$(PLUGIN_VER)
 INSTALL_LIB =	install -m 755 $(PLUGIN_FULLNAME) $(LIBDIR)/$(PLUGIN_FULLNAME)
 UNINSTALL_LIB =	rm -f $(LIBDIR)/$(PLUGIN_FULLNAME)
diff --git a/make/Makefile.win32 b/make/Makefile.win32
index ae0bfd1..703873c 100644
--- a/make/Makefile.win32
+++ b/make/Makefile.win32
@@ -13,6 +13,7 @@ LIBS +=		-mno-cygwin -lws2_32 -liphlpapi
 CPPFLAGS += 	-I$(TOPDIR)/src/win32
 CFLAGS +=	-mno-cygwin
 
+PLUGIN_SONAME ?= $(PLUGIN_NAME)
 PLUGIN_FULLNAME ?= $(PLUGIN_NAME).dll
 INSTALL_LIB =	cp $(PLUGIN_FULLNAME) ../..
 UNINSTALL_LIB =	del /F ../../$(PLUGIN_FULLNAME)
-- 
1.7.6





More information about the Olsr-dev mailing list