[evolution-ews] CMake: Add FORCE_INSTALL_PREFIX compile time option



commit 7a57e101ccf07dcc6b0cc551e77e50e539fa5230
Author: Milan Crha <mcrha redhat com>
Date:   Wed Feb 24 17:57:34 2021 +0100

    CMake: Add FORCE_INSTALL_PREFIX compile time option
    
    This allows to install evolution-data-server and evolution files
    files into the CMAKE_INSTALL_PREFIX instead of the prefix advertised
    by respective pkg-config files. It's useful, when the eds/evo prefixes
    are not writable for the builder.
    
    Also use EBookMetaBackendClass::backend_module_directory, which is
    closely related to this new option.

 CMakeLists.txt                           | 20 +++++++++++++++++---
 src/EWS/addressbook/e-book-backend-ews.c |  1 +
 2 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e91a56e7..9fcb3bd2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -240,14 +240,28 @@ endif(WITH_MICROSOFT365_ENDPOINT_HOST STREQUAL "")
 
 set(privlibdir "${LIB_INSTALL_DIR}/${PROJECT_NAME}")
 
-pkg_check_variable(errordir evolution-shell-3.0 errordir)
-pkg_check_variable(evo_privlibdir evolution-shell-3.0 privlibdir)
 pkg_check_variable(camel_providerdir camel-1.2 camel_providerdir)
 pkg_check_variable(ebook_backenddir libedata-book-1.2 backenddir)
 pkg_check_variable(ecal_backenddir libedata-cal-2.0 backenddir)
 pkg_check_variable(eds_moduledir libebackend-1.2 moduledir)
-pkg_check_variable(evo_moduledir evolution-shell-3.0 moduledir)
 pkg_check_variable(ewsdatadir evolution-data-server-1.2 privdatadir)
+pkg_check_variable(evo_privlibdir evolution-shell-3.0 privlibdir)
+pkg_check_variable(errordir evolution-shell-3.0 errordir)
+pkg_check_variable(evo_moduledir evolution-shell-3.0 moduledir)
+
+add_printable_variable(FORCE_INSTALL_PREFIX "Whether to force install evolution-data-server and evolution 
files into the install prefix" OFF)
+if(FORCE_INSTALL_PREFIX)
+       pkg_check_variable(eds_prefix evolution-data-server-1.2 prefix)
+       string(REGEX REPLACE "^${eds_prefix}" "${CMAKE_INSTALL_PREFIX}" camel_providerdir 
"${camel_providerdir}")
+       string(REGEX REPLACE "^${eds_prefix}" "${CMAKE_INSTALL_PREFIX}" ebook_backenddir 
"${ebook_backenddir}")
+       string(REGEX REPLACE "^${eds_prefix}" "${CMAKE_INSTALL_PREFIX}" ecal_backenddir "${ecal_backenddir}")
+       string(REGEX REPLACE "^${eds_prefix}" "${CMAKE_INSTALL_PREFIX}" eds_moduledir "${eds_moduledir}")
+       string(REGEX REPLACE "^${eds_prefix}" "${CMAKE_INSTALL_PREFIX}" ewsdatadir "${ewsdatadir}")
+
+       pkg_check_variable(evo_prefix evolution-shell-3.0 prefix)
+       string(REGEX REPLACE "^${evo_prefix}" "${CMAKE_INSTALL_PREFIX}" errordir "${errordir}")
+       string(REGEX REPLACE "^${evo_prefix}" "${CMAKE_INSTALL_PREFIX}" evo_moduledir "${evo_moduledir}")
+endif(FORCE_INSTALL_PREFIX)
 
 set(ewsdatadir "${ewsdatadir}/ews")
 
diff --git a/src/EWS/addressbook/e-book-backend-ews.c b/src/EWS/addressbook/e-book-backend-ews.c
index 8eae6a39..a72ed5b1 100644
--- a/src/EWS/addressbook/e-book-backend-ews.c
+++ b/src/EWS/addressbook/e-book-backend-ews.c
@@ -4089,6 +4089,7 @@ e_book_backend_ews_class_init (EBookBackendEwsClass *klass)
        EBookMetaBackendClass *book_meta_backend_class;
 
        book_meta_backend_class = E_BOOK_META_BACKEND_CLASS (klass);
+       book_meta_backend_class->backend_module_directory = BACKENDDIR;
        book_meta_backend_class->backend_module_filename = "libebookbackendews.so";
        book_meta_backend_class->backend_factory_type_name = "EBookBackendEwsFactory";
        book_meta_backend_class->connect_sync = ebb_ews_connect_sync;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]