devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libfdt: include version number in soname
@ 2011-04-21 10:13 Paolo Bonzini
       [not found] ` <1303380829-16965-1-git-send-email-pbonzini-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Paolo Bonzini @ 2011-04-21 10:13 UTC (permalink / raw)
  To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

The libfdt shared library is only installed by its unversioned name.
Including it properly in a distribution requires installation of both
the versioned name (used in the binary-only package) and the unversioned
name (used in the development package).  The latter is just a symbolic
link, so you need to change the soname in turn to include the version.

While at it, use Makefile variables to shorten some lines and avoid
cut-and-paste typos; and clean up remnants of when shared libraries were
not supported on Darwin.

Signed-off-by: Paolo Bonzini <pbonzini-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 Makefile |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index a07648c..1db9f30 100644
--- a/Makefile
+++ b/Makefile
@@ -131,9 +131,10 @@ LIBFDT_objdir = libfdt
 LIBFDT_srcdir = libfdt
 LIBFDT_archive = $(LIBFDT_objdir)/libfdt.a
 LIBFDT_lib = $(LIBFDT_objdir)/libfdt.$(SHAREDLIB_EXT)
+LIBFDT_lib_VERSIONED = $(subst .$(SHAREDLIB_EXT),-$(DTC_VERSION).$(SHAREDLIB_EXT),$(LIBFDT_lib))
+LIBFDT_lib_SONAME = $(notdir $(LIBFDT_lib_VERSIONED))
 LIBFDT_include = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_INCLUDES))
 LIBFDT_version = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_VERSION))
-
 include $(LIBFDT_srcdir)/Makefile.libfdt
 
 .PHONY: libfdt
@@ -145,7 +146,7 @@ $(LIBFDT_lib): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS))
 libfdt_clean:
 	@$(VECHO) CLEAN "(libfdt)"
 	rm -f $(addprefix $(LIBFDT_objdir)/,$(STD_CLEANFILES))
-	rm -f $(LIBFDT_objdir)/*.so
+	rm -f $(LIBFDT_objdir)/*.$(SHAREDLIB_EXT)
 
 ifneq ($(DEPTARGETS),)
 -include $(LIBFDT_OBJS:%.o=$(LIBFDT_objdir)/%.d)
@@ -161,7 +162,8 @@ install: all $(SCRIPTS)
 	$(INSTALL) -d $(DESTDIR)$(BINDIR)
 	$(INSTALL) $(BIN) $(SCRIPTS) $(DESTDIR)$(BINDIR)
 	$(INSTALL) -d $(DESTDIR)$(LIBDIR)
-	$(INSTALL) $(LIBFDT_lib) $(DESTDIR)$(LIBDIR)
+	$(INSTALL) $(LIBFDT_lib_VERSIONED) $(DESTDIR)$(LIBDIR)
+	ln -sf $(notdir $(LIBFDT_lib_VERSIONED)) $(DESTDIR)$(LIBDIR)/$(notdir $(LIBFDT_lib))
 	$(INSTALL) -m 644 $(LIBFDT_archive) $(DESTDIR)$(LIBDIR)
 	$(INSTALL) -d $(DESTDIR)$(INCLUDEDIR)
 	$(INSTALL) -m 644 $(LIBFDT_include) $(DESTDIR)$(INCLUDEDIR)
@@ -188,7 +190,7 @@ include tests/Makefile.tests
 #
 # Clean rules
 #
-STD_CLEANFILES = *~ *.o *.so *.d *.a *.i *.s core a.out vgcore.* \
+STD_CLEANFILES = *~ *.o *.$(SHAREDLIB_EXT) *.d *.a *.i *.s core a.out vgcore.* \
 	*.tab.[ch] *.lex.c *.output
 
 clean: libfdt_clean tests_clean
@@ -234,8 +236,8 @@ clean: libfdt_clean tests_clean
 
 $(LIBFDT_lib):
 	@$(VECHO) LD $@
-	$(CC) $(LDFLAGS) -fPIC $(SHAREDLIB_LINK_OPTIONS)$(notdir $@) -o $(LIBFDT_objdir)/libfdt-$(DTC_VERSION).$(SHAREDLIB_EXT) $^
-	ln -sf libfdt-$(DTC_VERSION).$(SHAREDLIB_EXT) $(LIBFDT_objdir)/libfdt.$(SHAREDLIB_EXT)
+	$(CC) $(LDFLAGS) -fPIC $(SHAREDLIB_LINK_OPTIONS)$(LIBFDT_lib_SONAME) -o $(LIBFDT_lib_VERSIONED) $^
+	ln -sf $(notdir $(LIBFDT_lib_VERSIONED)) $(LIBFDT_lib)
 
 %.lex.c: %.l
 	@$(VECHO) LEX $@
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-05-11 15:13 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-21 10:13 [PATCH] libfdt: include version number in soname Paolo Bonzini
     [not found] ` <1303380829-16965-1-git-send-email-pbonzini-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-04-25  3:07   ` David Gibson
2011-04-25 18:09     ` Paolo Bonzini
     [not found]       ` <4DB5B8D0.90802-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-04-26 10:45         ` David Gibson
2011-04-26 11:16           ` Paolo Bonzini
     [not found]             ` <4DB6A98B.6020107-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-04-26 15:19               ` David Gibson
2011-04-29 13:48                 ` Jon Loeliger
     [not found]                   ` <E1QFo3q-0001O9-IK-CYoMK+44s/E@public.gmane.org>
2011-04-29 14:06                     ` Paolo Bonzini
     [not found]                       ` <4DBAC5F0.8050409-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-04-29 14:48                         ` Jon Loeliger
     [not found]                           ` <E1QFoza-0001mA-2y-CYoMK+44s/E@public.gmane.org>
2011-04-29 14:50                             ` Paolo Bonzini
2011-05-11 14:29                     ` Domenico Andreoli
     [not found]                       ` <20110511142953.GA8845-iIV0ii4H0r6tG0bUXCXiUA@public.gmane.org>
2011-05-11 14:36                         ` Jon Loeliger
2011-05-11 15:06                         ` David Gibson
2011-05-11 15:13                         ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).