Add an option to add the plugin and extension to rpath (#7425)
This commit is contained in:
parent
41d03143b8
commit
58b24f13fe
@ -873,6 +873,7 @@ endif()
|
||||
set(FREERDP_ADDIN_PATH "${FREERDP_PLUGIN_PATH}")
|
||||
|
||||
# Path to put extensions
|
||||
set(FREERDP_EXTENSION_REL_PATH "${CMAKE_INSTALL_LIBDIR}/freerdp${FREERDP_VERSION_MAJOR}/extensions")
|
||||
set(FREERDP_EXTENSION_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp${FREERDP_VERSION_MAJOR}/extensions")
|
||||
|
||||
# Proxy plugins path
|
||||
@ -896,6 +897,10 @@ else (APPLE)
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
if (NOT FREEBSD)
|
||||
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/..")
|
||||
option(WITH_ADD_PLUGIN_TO_RPATH "Add extension and plugin path to RPATH" OFF)
|
||||
if (WITH_ADD_PLUGIN_TO_RPATH)
|
||||
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${FREERDP_EXTENSION_REL_PATH}:\$ORIGIN/../${FREERDP_PLUGIN_PATH}:${CMAKE_INSTALL_RPATH}")
|
||||
endif()
|
||||
endif()
|
||||
endif(APPLE)
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#cmakedefine AVRESAMPLE_FOUND
|
||||
|
||||
/* Options */
|
||||
#cmakedefine WITH_ADD_PLUGIN_TO_RPATH
|
||||
#cmakedefine WITH_PROFILER
|
||||
#cmakedefine WITH_GPROF
|
||||
#cmakedefine WITH_SSE2
|
||||
|
@ -992,7 +992,7 @@ static int test_MppcCompressBufferRdp5(void)
|
||||
int rc = -1;
|
||||
int status;
|
||||
UINT32 Flags;
|
||||
BYTE* pSrcData;
|
||||
const BYTE* pSrcData;
|
||||
UINT32 SrcSize;
|
||||
UINT32 DstSize;
|
||||
BYTE* pDstData;
|
||||
@ -1042,7 +1042,7 @@ static int test_MppcDecompressBufferRdp5(void)
|
||||
int rc = -1;
|
||||
int status;
|
||||
UINT32 Flags;
|
||||
BYTE* pSrcData;
|
||||
const BYTE* pSrcData;
|
||||
UINT32 SrcSize;
|
||||
UINT32 DstSize;
|
||||
MPPC_CONTEXT* mppc;
|
||||
|
@ -90,6 +90,9 @@ LPSTR freerdp_get_library_install_path(void)
|
||||
|
||||
LPSTR freerdp_get_dynamic_addin_install_path(void)
|
||||
{
|
||||
#if defined(WITH_ADD_PLUGIN_TO_RPATH)
|
||||
return NULL;
|
||||
#else
|
||||
LPSTR pszPath;
|
||||
size_t cchPath;
|
||||
size_t cchAddinPath;
|
||||
@ -131,6 +134,7 @@ LPSTR freerdp_get_dynamic_addin_install_path(void)
|
||||
WLog_DBG(TAG, "freerdp_get_dynamic_addin_install_path -> pszPath: %s", pszPath);
|
||||
|
||||
return pszPath;
|
||||
#endif
|
||||
}
|
||||
|
||||
PVIRTUALCHANNELENTRY freerdp_load_dynamic_addin(LPCSTR pszFileName, LPCSTR pszPath,
|
||||
@ -245,60 +249,74 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName, LP
|
||||
PVIRTUALCHANNELENTRY entry;
|
||||
LPSTR pszFileName;
|
||||
const size_t cchBaseFileName = sizeof(FREERDP_SHARED_LIBRARY_PREFIX) + 32;
|
||||
LPCSTR pszExtension;
|
||||
LPCSTR pszPrefix = FREERDP_SHARED_LIBRARY_PREFIX;
|
||||
size_t nameLen = 0;
|
||||
size_t subsystemLen = 0;
|
||||
size_t typeLen = 0;
|
||||
size_t extensionLen = 0;
|
||||
pszExtension = PathGetSharedLibraryExtensionA(0);
|
||||
size_t cchFileName = 0;
|
||||
|
||||
if (pszName)
|
||||
nameLen = strnlen(pszName, MAX_PATH);
|
||||
if (pszSubsystem)
|
||||
subsystemLen = strnlen(pszSubsystem, MAX_PATH);
|
||||
if (pszType)
|
||||
typeLen = strnlen(pszType, MAX_PATH);
|
||||
if (pszExtension)
|
||||
extensionLen = strnlen(pszExtension, MAX_PATH);
|
||||
|
||||
if (pszName && pszSubsystem && pszType)
|
||||
{
|
||||
const size_t cchFileName =
|
||||
cchBaseFileName + nameLen + subsystemLen + typeLen + extensionLen;
|
||||
cchFileName =
|
||||
cchBaseFileName + nameLen + subsystemLen + typeLen;
|
||||
pszFileName = (LPSTR)malloc(cchFileName);
|
||||
|
||||
if (!pszFileName)
|
||||
return NULL;
|
||||
|
||||
sprintf_s(pszFileName, cchFileName, "%s%s-client-%s-%s.%s", pszPrefix, pszName,
|
||||
pszSubsystem, pszType, pszExtension);
|
||||
sprintf_s(pszFileName, cchFileName, "%s-client-%s-%s", pszName,
|
||||
pszSubsystem, pszType);
|
||||
}
|
||||
else if (pszName && pszSubsystem)
|
||||
{
|
||||
const size_t cchFileName = cchBaseFileName + nameLen + subsystemLen + extensionLen;
|
||||
cchFileName = cchBaseFileName + nameLen + subsystemLen;
|
||||
pszFileName = (LPSTR)malloc(cchFileName);
|
||||
|
||||
if (!pszFileName)
|
||||
return NULL;
|
||||
|
||||
sprintf_s(pszFileName, cchFileName, "%s%s-client-%s.%s", pszPrefix, pszName, pszSubsystem,
|
||||
pszExtension);
|
||||
sprintf_s(pszFileName, cchFileName, "%s-client-%s", pszName, pszSubsystem );
|
||||
}
|
||||
else if (pszName)
|
||||
{
|
||||
const size_t cchFileName = cchBaseFileName + nameLen + extensionLen;
|
||||
cchFileName = cchBaseFileName + nameLen ;
|
||||
pszFileName = (LPSTR)malloc(cchFileName);
|
||||
|
||||
if (!pszFileName)
|
||||
return NULL;
|
||||
|
||||
sprintf_s(pszFileName, cchFileName, "%s%s-client.%s", pszPrefix, pszName, pszExtension);
|
||||
sprintf_s(pszFileName, cchFileName, "%s-client", pszName);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
{
|
||||
LPCSTR pszExtension = PathGetSharedLibraryExtensionA(0);
|
||||
LPCSTR pszPrefix = FREERDP_SHARED_LIBRARY_PREFIX;
|
||||
LPSTR tmp;
|
||||
int rc;
|
||||
|
||||
if (pszPrefix)
|
||||
cchFileName += strnlen(pszPrefix, MAX_PATH);
|
||||
if (pszExtension)
|
||||
cchFileName += strnlen(pszExtension, MAX_PATH) + 1;
|
||||
tmp = calloc(cchFileName, sizeof(CHAR));
|
||||
if (tmp)
|
||||
rc = sprintf_s(tmp, cchFileName, "%s%s.%s", pszPrefix, pszFileName, pszExtension);
|
||||
free(pszFileName);
|
||||
pszFileName = tmp;
|
||||
if (!pszFileName)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pszSubsystem)
|
||||
{
|
||||
LPSTR pszEntryName;
|
||||
|
@ -453,7 +453,7 @@ static BOOL rdp_recv_server_redirection_pdu(rdpRdp* rdp, wStream* s)
|
||||
|
||||
if (redirection->flags & LB_TARGET_NET_ADDRESSES)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
UINT32 count;
|
||||
UINT32 targetNetAddressesLength;
|
||||
|
||||
@ -470,7 +470,7 @@ static BOOL rdp_recv_server_redirection_pdu(rdpRdp* rdp, wStream* s)
|
||||
|
||||
WLog_DBG(TAG, "TargetNetAddressesCount: %" PRIu32 "", redirection->TargetNetAddressesCount);
|
||||
|
||||
for (i = 0; i < (int)count; i++)
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (!rdp_redirection_read_unicode_string(s, &(redirection->TargetNetAddresses[i]), 80))
|
||||
return FALSE;
|
||||
|
@ -129,7 +129,8 @@ HMODULE LoadLibraryA(LPCSTR lpLibFileName)
|
||||
|
||||
if (!library)
|
||||
{
|
||||
WLog_ERR(TAG, "%s failed with %s", __FUNCTION__, dlerror());
|
||||
const char* err = dlerror();
|
||||
WLog_ERR(TAG, "%s failed with %s", __FUNCTION__, err);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user