Re: [PATCH] fix libdbi hardcoded driver directory usage
On Wednesday 19 May 2010, Bill Nottingham wrote: > Geert Janssens (janssens-ge...@telenet.be) said: > > Obviously, it's easy to configure with --with-dbi-dbd-path pointing at > > the proper location for development and all is well. > > > > I just wonder if it's possible to rewrite configure in such a way that it > > always does the right thing. I mean is there some automatic parameter > > like $libdir but one that then points to the system wide lib directory > > instead of the one relative to prefix ? > > You could have the configury not set GNC_DBD_DIR *at all*, unless > --with-dbi-dbd-path is passed. That's a more complex change to the > environment, though. > > Bill > That was a good suggestion. I have complemented your patch to implement this. Committed to svn in r19191. Thanks ! Geert ___ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel
Re: [PATCH] fix libdbi hardcoded driver directory usage
Geert Janssens (janssens-ge...@telenet.be) said: > Obviously, it's easy to configure with --with-dbi-dbd-path pointing at the > proper location for development and all is well. > > I just wonder if it's possible to rewrite configure in such a way that it > always does the right thing. I mean is there some automatic parameter like > $libdir but one that then points to the system wide lib directory instead of > the one relative to prefix ? You could have the configury not set GNC_DBD_DIR *at all*, unless --with-dbi-dbd-path is passed. That's a more complex change to the environment, though. Bill ___ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel
Re: [PATCH] fix libdbi hardcoded driver directory usage
On Tuesday 18 May 2010, Bill Nottingham wrote: > 1) libdbi, in its default configuration, puts the driver directory > in $libdir/dbd, not a hardcoded /usr/lib/dbd. Fix gnucash's configury > to use the same. > > 2) If GNC_DBD_DIR is not set, fall back to the libdbi compiled-in default > (whatever it may be) rather than a hardcoded value, as it's more likely > to be correct. > > Bill > Thank you for your patch. I tested it and it basically works like you describe. There's one thing though that keeps me from committing it right away and I would like to discuss first. Using $libdir/dbd works well when GnuCash will be installed with the same prefix as libdbi, so it works well for packagers. However, when developing, GnuCash is usually installed in a different prefix, to avoid clashing with an installed stable version. In this case, $libdir/dbd will be pointing to $prefex/lib/dbd. Usually that's not where a GnuCash developer has installed the dbd drivers, which are still in the standard installation location. Obviously, it's easy to configure with --with-dbi-dbd-path pointing at the proper location for development and all is well. I just wonder if it's possible to rewrite configure in such a way that it always does the right thing. I mean is there some automatic parameter like $libdir but one that then points to the system wide lib directory instead of the one relative to prefix ? That would give an even better solution. Geert ___ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel
[PATCH] fix libdbi hardcoded driver directory usage
1) libdbi, in its default configuration, puts the driver directory in $libdir/dbd, not a hardcoded /usr/lib/dbd. Fix gnucash's configury to use the same. 2) If GNC_DBD_DIR is not set, fall back to the libdbi compiled-in default (whatever it may be) rather than a hardcoded value, as it's more likely to be correct. Bill diff -up gnucash-2.3.12/src/backend/dbi/gnc-backend-dbi.c.foo gnucash-2.3.12/src/backend/dbi/gnc-backend-dbi.c --- gnucash-2.3.12/src/backend/dbi/gnc-backend-dbi.c.foo2010-05-18 12:36:31.929812252 -0400 +++ gnucash-2.3.12/src/backend/dbi/gnc-backend-dbi.c2010-05-18 12:38:29.962687968 -0400 @@ -1007,7 +1007,6 @@ void gnc_module_init_backend_dbi(void) { QofBackendProvider *prov; -#define DEFAULT_DBD_DIR "/usr/lib/dbd" const gchar* driver_dir; int num_drivers; gboolean have_sqlite3_driver = FALSE; @@ -1019,8 +1018,7 @@ gnc_module_init_backend_dbi(void) driver_dir = g_getenv( "GNC_DBD_DIR" ); if ( driver_dir == NULL ) { -PWARN( "GNC_DBD_DIR not set: using %s\n", DEFAULT_DBD_DIR ); -driver_dir = DEFAULT_DBD_DIR; +PWARN( "GNC_DBD_DIR not set: using libdi built-in default\n"); } num_drivers = dbi_initialize( driver_dir ); diff -up gnucash-2.3.12/configure.in.foo gnucash-2.3.12/configure.in --- gnucash-2.3.12/configure.in.foo 2010-05-18 12:51:28.688812527 -0400 +++ gnucash-2.3.12/configure.in 2010-05-18 12:52:28.985062367 -0400 @@ -582,9 +582,9 @@ then AC_CHECK_HEADERS(dbi/dbi.h) if test "x$ac_cv_header_dbi_dbi_h" != xno; then AC_ARG_WITH( dbi-dbd-dir, - [AS_HELP_STRING([--with-dbi-dbd-dir=PATH],[specify location of libdbi drivers @<:@default=/usr/lib/dbd@:>@])], + [AS_HELP_STRING([--with-dbi-dbd-dir=PATH],[specify location of libdbi drivers @<:@default=${libdir}/dbd@:>@])], GNC_DBD_DIR="$with_dbi_dbd_dir", - GNC_DBD_DIR="/usr/lib/dbd") + GNC_DBD_DIR="${libdir}/dbd") LIBDBI_LIBS=-ldbi DBI_DIR=dbi ___ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel