From: Marco van Wieringen Date: Tue, 10 Jan 2012 12:33:55 +0000 (+0100) Subject: Add support for soname setting in libtool. X-Git-Tag: Release-7.0.0~349 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=51b3b98fb77ab3c0decee455cc6c4d2eb3c5303a;p=bacula%2Fbacula Add support for soname setting in libtool. We allow to specify the SONAME in a library so we can create a libbaccats--.so which has an internal soname of libbaccats-.so This way each catalog backend is a direct replacement of the dummy libbaccats library and copying and linking works without the ldconfig trying to be to smart. When no symlink exists ldconfig will create one (it might point to the wrong one however) but if you only install one it cannot go wrong. Also a nice side effect is that if we create the symlink ldconfig now doesn't replace it with a new one as it thinks its a stale or wrong link. install-default-backend is updated to create the symlink in the same way that ldconfig does and point to the libbaccats-.so which points to libbaccats--.so --- diff --git a/bacula/autoconf/ltmain.sh b/bacula/autoconf/ltmain.sh index 3061e3c5a2..5ddcc7922e 100644 --- a/bacula/autoconf/ltmain.sh +++ b/bacula/autoconf/ltmain.sh @@ -2428,6 +2428,7 @@ The following components of LINK-COMMAND are treated specially: -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension + -soname SONAME override the standard shared object name -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries @@ -5422,6 +5423,11 @@ func_mode_link () prev= continue ;; + soname) + soname_spec="$arg" + prev= + continue + ;; weak) func_append weak_libs " $arg" prev= @@ -5741,6 +5747,11 @@ func_mode_link () continue ;; + -soname) + prev=soname + continue + ;; + -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that diff --git a/bacula/src/cats/Makefile.in b/bacula/src/cats/Makefile.in index 2df93d7778..e49c4840cd 100644 --- a/bacula/src/cats/Makefile.in +++ b/bacula/src/cats/Makefile.in @@ -150,23 +150,28 @@ libbaccats.la: Makefile cats_dummy.lo libbaccats-mysql.la: Makefile $(MYSQL_LOBJS) @echo "Making $@ ..." - $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(MYSQL_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) $(MYSQL_LIBS) + $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(MYSQL_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) \ + -soname libbaccats-$(LIBBACCATS_LT_RELEASE).so $(MYSQL_LIBS) libbaccats-postgresql.la: Makefile $(POSTGRESQL_LOBJS) @echo "Making $@ ..." - $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(POSTGRESQL_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) $(POSTGRESQL_LIBS) + $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(POSTGRESQL_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) \ + -soname libbaccats-$(LIBBACCATS_LT_RELEASE).so $(POSTGRESQL_LIBS) libbaccats-sqlite3.la: Makefile $(SQLITE_LOBJS) @echo "Making $@ ..." - $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(SQLITE_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) $(SQLITE_LIBS) + $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(SQLITE_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) \ + -soname libbaccats-$(LIBBACCATS_LT_RELEASE).so $(SQLITE_LIBS) #libbaccats-ingres.la: Makefile $(INGRES_LOBJS) # @echo "Making $@ ..." -# $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(INGRES_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) $(INGRES_LIBS) +# $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(INGRES_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) \ +# -soname libbaccats-$(LIBBACCATS_LT_RELEASE).so $(INGRES_LIBS) #libbaccats-dbi.la: Makefile $(DBI_LOBJS) # @echo "Making $@ ..." -# $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(DBI_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) $(DBI_LIBS) +# $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(DBI_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) \ +# -soname libbaccats-$(LIBBACCATS_LT_RELEASE).so $(DBI_LIBS) Makefile: $(srcdir)/Makefile.in $(topdir)/config.status cd $(topdir) \ diff --git a/bacula/src/cats/install-default-backend.in b/bacula/src/cats/install-default-backend.in index 54bc3d092f..80eae6aefa 100755 --- a/bacula/src/cats/install-default-backend.in +++ b/bacula/src/cats/install-default-backend.in @@ -33,7 +33,7 @@ if [ -f ${install_dir}/libbaccats-${default_backend}-${library_version}${SHLIB_E # As all backends are in the same directory anyhow this should # always work. # - ln -s libbaccats-${default_backend}-${library_version}${SHLIB_EXT} \ + ln -s libbaccats-${default_backend}${SHLIB_EXT} \ ${install_dir}/libbaccats-${library_version}${SHLIB_EXT} fi