Commit 0ba1dde2 authored by Martin Klapetek's avatar Martin Klapetek
Browse files

Force the installation of providers and services to $CMAKE_INSTALL_PREFIX/share/kaccounts

Because distros are unable to solve this file conflict, this will now
force all providers and services to be installed in own directory to
which libaccounts-glib needs to be pointed by env vars. Things won't
work without those env vars.

BUG: 347219
FIXED-IN: 16.04.0
parent 0b2bbbb1
find_package(PkgConfig REQUIRED)
# The provider and service files used with KAccounts REQUIRE
# an env variable set (see https://bugs.kde.org/347219), so
# we might as well just read it directly as an install path
# if those are not set, read CMAKE_INSTALL_PREFIX and add
# the subpath of share/kaccounts/*
execute_process(
COMMAND "${PKG_CONFIG_EXECUTABLE}" --variable=prefix libaccounts-glib
OUTPUT_VARIABLE _pkgconfig_invoke_result
RESULT_VARIABLE _pkgconfig_failed)
if (_pkgconfig_failed)
message(FAILED "Couldn't find the prefix for libaccounts-glib")
else()
string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
set(ACCOUNTS_PREFIX_DIR ${_pkgconfig_invoke_result})
endif()
execute_process(
COMMAND "${PKG_CONFIG_EXECUTABLE}" --variable=providerfilesdir libaccounts-glib
OUTPUT_VARIABLE _pkgconfig_invoke_result
RESULT_VARIABLE _pkgconfig_failed)
if (_pkgconfig_failed)
message(FAILED "Couldn't find the providerfilesdir for libaccounts-glib")
if(ENV{AG_PROVIDERS} AND ENV{AG_SERVICES})
set(ACCOUNTS_PROVIDERS_DIR $ENV{AG_PROVIDERS})
set(ACCOUNTS_SERVICES_DIR $ENV{AG_SERVICES})
else()
string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
if (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
string(REPLACE ${ACCOUNTS_PREFIX_DIR} ${CMAKE_INSTALL_PREFIX} _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
endif()
set(ACCOUNTS_PROVIDERS_DIR ${_pkgconfig_invoke_result})
endif()
set(ACCOUNTS_PROVIDERS_DIR ${CMAKE_INSTALL_PREFIX}/share/kaccounts/providers)
set(ACCOUNTS_SERVICES_DIR ${CMAKE_INSTALL_PREFIX}/share/kaccounts/services)
execute_process(
COMMAND "${PKG_CONFIG_EXECUTABLE}" --variable=servicefilesdir libaccounts-glib
OUTPUT_VARIABLE _pkgconfig_invoke_result
RESULT_VARIABLE _pkgconfig_failed)
if (_pkgconfig_failed)
message(FAILED "Couldn't find the servicefilesdir for libaccounts-glib")
else()
string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
if (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
string(REPLACE ${ACCOUNTS_PREFIX_DIR} ${CMAKE_INSTALL_PREFIX} _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
endif()
set(ACCOUNTS_SERVICES_DIR ${_pkgconfig_invoke_result})
message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! \n\n\
Provider files will be installed to ${ACCOUNTS_PROVIDERS_DIR} \n\
Service files will be installed to ${ACCOUNTS_SERVICES_DIR} \n\
\n\
Please ensure your system has these environment variables set:\n\n\
AG_PROVIDERS=${ACCOUNTS_PROVIDERS_DIR}
AG_SERVICES=${ACCOUNTS_SERVICES_DIR}\n\n\
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
endif()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment