[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH]: move all dlopen()ed modules to subdirectory

From: Arkadiusz Miskiewicz <misiek_at_pld.ORG.PL>
Date: 2002-08-02 22:04:01 CEST

This patch does that:

    * Makefile.in: Introduce fs_dso_libdir, base_dso_libdir,
      LD_DSOFLAGS and LINK_DSO for DSO handling. Define
      SVN_LIBDIR=$(libdir) for subversion/libsvn_ra/ra_load.c.

    * build.conf (libsvn_ra_dav, libsvn_ra_local): Change install
      variable to new values (base-lib -> base-dso-lib,
      fs-lib -> fs-dso-lib) as they need to be handled in special
      way when DSO is enabled.

    * configure.in: New DSO INSTALL_ and BUILD_ targets. DSO modules
      are installed in $(libdir)/subversion. Modules are compiled
      with versioning disabled.

    * subversion/libsvn_ra/ra_loader.c: Load DSO from
      $(libdir)/subversion directory.

So when --enable-dso is specified non-versioned (well, versioned
in file name by using version from build.conf) dso modules are
installed in separate directory like this:

[misiek@arm misiek]$ ls -l ~/s-test/lib/subversion/
razem 212
-rw-r--r-- 1 misiek users 77226 sie 2 21:29 libsvn_ra_dav-1.a
-rwxr-xr-x 1 misiek users 1031 sie 2 21:29 libsvn_ra_dav-1.la
-rwxr-xr-x 1 misiek users 76646 sie 2 21:29 libsvn_ra_dav-1.so
-rw-r--r-- 1 misiek users 22746 sie 2 21:29 libsvn_ra_local-1.a
-rwxr-xr-x 1 misiek users 1180 sie 2 21:29 libsvn_ra_local-1.la
-rwxr-xr-x 1 misiek users 28606 sie 2 21:29 libsvn_ra_local-1.so

Intention for this patch was:
- cleanup (don't mix libraries and dso modules)
- remove versioning from modules (it's not needed and even not desired)
- allow to make dso handling really dynamic (see below)

> > Since the ra_loader code only looks for specific modules anyway,
> > I'm not sure what the rationale is for having them dynamically
> > loaded. There isn't a way to register your provider with the
> > ra functions without a recompile anyway.
> Load all *.so from $(libdir}/subversion/ ?
And now ra_load.c can be just changed to load all *.so modules
from $(libdir)/subversion. No need to recompile svn to use third
party modules.

No idea how this change affect windows builds.

diff -urN subversion.org/Makefile.in subversion/Makefile.in
--- subversion.org/Makefile.in Fri Aug 2 14:34:55 2002
+++ subversion/Makefile.in Fri Aug 2 21:28:16 2002
@@ -22,9 +22,11 @@
 exec_prefix = @exec_prefix@
 libdir = @libdir@
 base_libdir = @libdir@
-fs_libdir= @libdir@
+base_dso_libdir = @SVN_BASE_DSO_LIBDIR@
+fs_libdir = @libdir@
+fs_dso_libdir = @SVN_FS_DSO_LIBDIR@
 bindir = @bindir@
-fs_bindir=@bindir@
+fs_bindir = @bindir@
 includedir = @includedir@
 mandir = @mandir@
 srcdir = @srcdir@
@@ -59,8 +61,9 @@
 
 # the EXTRA_ exist so that extra flags can be passed at 'make' time
 CFLAGS = @CFLAGS@ $(EXTRA_CFLAGS)
-CPPFLAGS = @CPPFLAGS@ $(EXTRA_CPPFLAGS)
+CPPFLAGS = -DSVN_LIBDIR=\"$(libdir)\" @CPPFLAGS@ $(EXTRA_CPPFLAGS)
 LDFLAGS = @LDFLAGS@ $(EXTRA_LDFLAGS)
+LD_DSOFLAGS = @SVN_LD_DSOFLAGS@ $(EXTRA_LD_DSOFLAGS)
 
 COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES)
 LT_COMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE)
@@ -71,12 +74,15 @@
 COMPILE_SWIG_PY = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CPPFLAGS) -DSWIGPYTHON $(CFLAGS) $(SWIG_PY_INCLUDES) $(INCLUDES) -o $@ -c $<
 
 LINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(LT_LDFLAGS) $(COMPILE) $(LDFLAGS) -rpath $(libdir)
+LINK_DSO = $(LIBTOOL) $(LTFLAGS) --mode=link $(LT_LDFLAGS) $(COMPILE) $(LDFLAGS) -rpath $(fs_dso_libdir) $(LD_DSOFLAGS)
 LINK_APACHE_MOD = $(LIBTOOL) $(LTFLAGS) --mode=link $(LT_LDFLAGS) $(COMPILE) $(LDFLAGS) -rpath $(APACHE_LIBEXECDIR)
 
 INSTALL = @INSTALL@
 INSTALL_LIB = $(LIBTOOL) --mode=install $(INSTALL)
 INSTALL_BASE_LIB = $(INSTALL_LIB)
+INSTALL_BASE_DSO_LIB = $(INSTALL_LIB)
 INSTALL_FS_LIB = $(INSTALL_LIB)
+INSTALL_FS_DSO_LIB = $(INSTALL_LIB)
 INSTALL_BIN = $(LIBTOOL) --mode=install $(INSTALL)
 INSTALL_FS_BIN = $(INSTALL_BIN)
 INSTALL_INCLUDE = $(INSTALL) -m 644
diff -urN subversion.org/build.conf subversion/build.conf
--- subversion.org/build.conf Fri Aug 2 14:34:55 2002
+++ subversion/build.conf Fri Aug 2 20:06:13 2002
@@ -142,7 +142,7 @@
 [libsvn_ra_dav]
 type = lib
 path = subversion/libsvn_ra_dav
-install = base-lib
+install = base-dso-lib
 libs = libsvn_subr $(SVN_APRUTIL_LIBS) $(SVN_APR_LIBS) $(NEON_LIBS)
 custom = ra-module
 
@@ -150,7 +150,7 @@
 [libsvn_ra_local]
 type = lib
 path = subversion/libsvn_ra_local
-install = fs-lib
+install = fs-dso-lib
 libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr $(SVN_APRUTIL_LIBS) $(SVN_APR_LIBS)
 custom = ra-module
 
diff -urN subversion.org/configure.in subversion/configure.in
--- subversion.org/configure.in Fri Aug 2 14:34:55 2002
+++ subversion/configure.in Fri Aug 2 21:26:38 2002
@@ -139,12 +139,12 @@
 
 # Only add *_APACHE_RULE if we also have db, since mod_dav_svn depends on it.
 INSTALL_STATIC_RULES="install-bin install-docs"
-INSTALL_RULES="install-base-lib install-lib install-include install-static"
-BUILD_RULES="base-lib lib bin test"
+INSTALL_RULES="install-base-lib install-base-dso-lib install-lib install-include install-static"
+BUILD_RULES="base-lib base-dso-lib lib bin test"
 if test "$svn_lib_berkeley_db" = "yes"; then
- BUILD_RULES="base-lib fs-lib lib bin fs-bin $BUILD_APACHE_RULE test fs-test"
+ BUILD_RULES="base-lib fs-lib fs-dso-lib lib bin fs-bin $BUILD_APACHE_RULE test fs-test"
   INSTALL_STATIC_RULES="install-bin install-fs-bin install-docs"
- INSTALL_RULES="install-base-lib install-fs-lib install-lib install-include install-static $INSTALL_APACHE_RULE"
+ INSTALL_RULES="install-base-lib install-base-dso-lib install-fs-lib install-fs-dso-lib install-lib install-include install-static $INSTALL_APACHE_RULE"
   FS_TEST_DEPS="\$(FS_TEST_DEPS)"
   FS_TEST_PROGRAMS="\$(FS_TEST_PROGRAMS)"
 fi
@@ -334,16 +334,25 @@
 AC_SUBST(INSTALL_INFO)
 
 dnl decide whether we want to link against the RA libraries
+SVN_FS_DSO_LIBDIR="\$(fs_libdir)"
+SVN_BASE_DSO_LIBDIR="\$(base_libdir)"
+SVN_LD_DSOFLAGS=""
 AC_ARG_ENABLE(dso,
 [ --enable-dso Turn on DSO loading of RA libraries],
 [
     if test "$enableval" = "yes"; then
       enable_dso=yes
+ SVN_FS_DSO_LIBDIR="\$(fs_libdir)/subversion"
+ SVN_BASE_DSO_LIBDIR="\$(base_libdir)/subversion"
+ SVN_LD_DSOFLAGS="-module -avoid-version"
       if test "$enable_shared" = "no"; then
         AC_MSG_ERROR([--enable-dso conflicts with --disable-shared])
       fi
     fi
 ])
+AC_SUBST(SVN_FS_DSO_LIBDIR)
+AC_SUBST(SVN_BASE_DSO_LIBDIR)
+AC_SUBST(SVN_LD_DSOFLAGS)
 
 if test "$enable_shared" = "no" -o "$enable_dso" != "yes"; then
   AC_DEFINE(SVN_LIBSVN_CLIENT_LINKS_RA_DAV, 1,
diff -urN subversion.org/subversion/libsvn_ra/ra_loader.c subversion/subversion/libsvn_ra/ra_loader.c
--- subversion.org/subversion/libsvn_ra/ra_loader.c Fri Aug 2 14:35:26 2002
+++ subversion/subversion/libsvn_ra/ra_loader.c Fri Aug 2 21:20:39 2002
@@ -89,7 +89,7 @@
     apr_status_t status;
 
     /* ### fix the .so part */
- libname = apr_psprintf (pool, "libsvn_ra_%s.so", ra_name);
+ libname = apr_psprintf (pool, SVN_LIBDIR "/subversion/libsvn_ra_%s-1.so", ra_name);
     funcname = apr_psprintf (pool, "svn_ra_%s_init", ra_name);
 
     /* find/load the specified library */

ps. -1 is hardcoded here because this patch only moves modules
from libdir to libdir/subversion/. Now what needs to be done is
change ra_load to load all so modules.

-- 
Arkadiusz Mi¶kiewicz   IPv6 ready PLD Linux at http://www.pld.org.pl
misiek(at)pld.org.pl   AM2-6BONE, 1024/3DB19BBD, arekm(at)ircnet, PWr
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Aug 2 22:53:25 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.