gnucash unstable: Bug 791422 - gnucash 2.7 no longer opens sqlite3...
John Ralls
jralls at code.gnucash.org
Sun Dec 10 15:55:01 EST 2017
Updated via https://github.com/Gnucash/gnucash/commit/c0659c8e (commit)
from https://github.com/Gnucash/gnucash/commit/ec9f60d3 (commit)
commit c0659c8e2bb520abb940dd2303969fc468101a16
Author: John Ralls <jralls at ceridwen.us>
Date: Sun Dec 10 12:51:24 2017 -0800
Bug 791422 - gnucash 2.7 no longer opens sqlite3...
as it doesn't load proper backend.
The cause was that the libdbi-driver path in CMakeLists.txt was wrong
and GNC_DBD_DIR was being set unconditionally in etc/gnucash/environment
with an invalid path.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 205fbcd..6479bef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -389,9 +389,14 @@ ENDIF(NOT LIBXSLT_FOUND)
SET(PKG_CONFIG_EXECUTABLE ${GNC_PKG_CONFIG_EXE})
# libdbi
-FIND_PATH (LIBDBI_INCLUDE_PATH dbi/dbi.h HINTS ${CMAKE_PREFIX_PATH}/libdbi/include)
-FIND_LIBRARY (LIBDBI_LIBRARY dbi HINTS ${CMAKE_PREFIX_PATH}/libdbi/lib)
-FIND_PATH (LIBDBI_DRIVERS_DIR dbd HINTS ${CMAKE_PREFIX_PATH}/lib ${CMAKE_PREFIX_PATH}/libdbi-drivers/lib)
+FIND_PATH (LIBDBI_INCLUDE_PATH dbi/dbi.h)
+FIND_LIBRARY (LIBDBI_LIBRARY dbi)
+FIND_LIBRARY (LIBDBI_DRIVERS_DIR
+ NAMES dbdmysql dbdpgsql dbdsqlite3 NAMES_PER_DIR
+ PATH_SUFFIXES dbd libdbi-drivers/dbd
+ HINTS LIBDBI_LIBRARY
+ PATHS GNC_DBD_DIR
+ DOC "Libdbi Drivers Directory")
IF (WITH_SQL)
IF (NOT LIBDBI_INCLUDE_PATH)
MESSAGE (SEND_ERROR "Include file <dbi/dbi.h> was not found - did you install libdbi0-dev or libdbi-dev?")
@@ -400,6 +405,12 @@ IF (WITH_SQL)
MESSAGE (SEND_ERROR "Library libdbi was not found")
ENDIF (NOT LIBDBI_LIBRARY)
SET(HAVE_DBI_DBI_H 1)
+ IF (NOT LIBDBI_DRIVERS_DIR)
+ MESSAGE (SEND_ERROR "No libdbi drivers found, SQL tests will fail.")
+ ELSE()
+ get_filename_component(drivers_dir ${LIBDBI_DRIVERS_DIR} DIRECTORY)
+ set(LIBDBI_DRIVERS_DIR ${drivers_dir} CACHE FILEPATH "Directory containing the libdbi driver modules." FORCE)
+ ENDIF()
ENDIF (WITH_SQL)
# ############################################################
diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt
index e18aaa1..b4c33f9 100644
--- a/gnucash/CMakeLists.txt
+++ b/gnucash/CMakeLists.txt
@@ -129,16 +129,18 @@ SET(XDG_TEXT "
# and gsettings schema are found.\n"
)
-IF (NOT(${GNC_DBD_DIR} STREQUAL "${CMAKE_PREFIX_PATH}/lib/dbd"))
- FILE(APPEND ${ENV_FILE_OUT} "GNC_DBD_DIR=${GNC_DBD_DIR}")
-ENDIF()
-
IF (NOT(${CMAKE_INSTALL_FULL_DATADIR} STREQUAL "/usr/share") AND NOT(${CMAKE_INSTALL_FULL_DATADIR} STREQUAL "/usr/local/share"))
FILE(APPEND ${ENV_FILE_OUT} ${XDG_TEXT})
- FILE(APPEND ${ENV_FILE_OUT} "XDG_DATA_DIRS=${CMAKE_INSTALL_DATADIR};{XDG_DATA_DIRS};" "${GNC_SYSTEM_XDG_DATA_DIRS}\n")
+ FILE(APPEND ${ENV_FILE_OUT} "XDG_DATA_DIRS=${CMAKE_INSTALL_FULL_DATADIR};{XDG_DATA_DIRS};" "${GNC_SYSTEM_XDG_DATA_DIRS}\n")
ENDIF()
-FILE(APPEND ${BUILD_ENV_FILE_OUT} "GNC_DBD_DIR=${LIBDBI_DRIVERS_DIR}/dbd")
+if (LIBDBI_LIBRARY AND LIBDBI_DRIVERS_DIR)
+ get_filename_component(libdir ${LIBDBI_LIBRARY} DIRECTORY)
+ string(FIND ${LIBDBI_DRIVERS_DIR} ${libdir} is_subdir)
+ if (NOT is_subdir EQUAL 0)
+ FILE(APPEND ${BUILD_ENV_FILE_OUT} "GNC_DBD_DIR=${LIBDBI_DRIVERS_DIR}")
+ endif()
+ENDIF()
FILE(APPEND ${BUILD_ENV_FILE_OUT} ${XDG_TEXT})
FILE(APPEND ${BUILD_ENV_FILE_OUT} "XDG_DATA_DIRS=${DATADIR_BUILD};{XDG_DATA_DIRS};" "${GNC_SYSTEM_XDG_DATA_DIRS}\n")
Summary of changes:
CMakeLists.txt | 17 ++++++++++++++---
gnucash/CMakeLists.txt | 14 ++++++++------
2 files changed, 22 insertions(+), 9 deletions(-)
More information about the gnucash-changes
mailing list