Commit d4676fb9 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Include rootca.pem in the iOS framework.

parent 32885fe4
......@@ -407,7 +407,10 @@ if(ENABLE_STATIC)
)
endif()
if(ENABLE_SHARED)
set(LINPHONE_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../share/cpim_grammar") #keep it relative to current dir to allow CMakeList inclusion
set(LINPHONE_RESOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/../share/cpim_grammar"
"${CMAKE_CURRENT_SOURCE_DIR}/../share/rootca.pem"
) # Keep it relative to current dir to allow CMakeList inclusion
add_library(linphone SHARED ${LINPHONE_RESOURCES} ${LINPHONE_HEADER_FILES}
${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES} ${LINPHONE_OBJC_SOURCE_FILES}
$<TARGET_OBJECTS:linphone-coreapi>
......@@ -425,7 +428,7 @@ if(ENABLE_SHARED)
FRAMEWORK TRUE
MACOSX_FRAMEWORK_IDENTIFIER org.linphone.linphone
MACOSX_FRAMEWORK_INFO_PLIST Info.plist.in
RESOURCE ${LINPHONE_RESOURCES}
RESOURCE "${LINPHONE_RESOURCES}"
)
endif()
if(BELCARD_FOUND)
......
......@@ -71,21 +71,27 @@ IosPlatformHelpers::IosPlatformHelpers (LinphoneCore *lc, void *system_context)
mCpuLockCount = 0;
mCpuLockTaskId = 0;
std::string cpimPath = directoryForResource(CFSTR("org.linphone.linphone"), CFSTR("cpim_grammar"));
string rootCaPath = directoryForResource(CFSTR("org.linphone.linphone"), CFSTR("rootca.pem"));
if (!rootCaPath.empty())
linphone_core_set_root_ca(lc, rootCaPath.c_str());
else
lError() << "IosPlatformHelpers did not find rootca.pem resource";
string cpimPath = directoryForResource(CFSTR("org.linphone.linphone"), CFSTR("cpim_grammar"));
if (!cpimPath.empty())
belr::GrammarLoader::get().addPath(cpimPath);
else
lError() << "IosPlatformHelpers did not find cpim grammar resource directory...";
#ifdef VCARD_ENABLED
std::string vcardPath = directoryForResource(CFSTR("org.linphone.belcard"), CFSTR("vcard_grammar"));
string vcardPath = directoryForResource(CFSTR("org.linphone.belcard"), CFSTR("vcard_grammar"));
if (!vcardPath.empty())
belr::GrammarLoader::get().addPath(vcardPath);
else
lError() << "IosPlatformHelpers did not find vcard grammar resource directory...";
#endif
lInfo() << "IosPlatformHelpers is fully initialised.";
lInfo() << "IosPlatformHelpers is fully initialised";
}
// -----------------------------------------------------------------------------
......@@ -127,16 +133,16 @@ void IosPlatformHelpers::releaseCpuLock () {
mCpuLockTaskId = 0;
}
std::string IosPlatformHelpers::directoryForResource (CFStringRef framework, CFStringRef resource) {
string IosPlatformHelpers::directoryForResource (CFStringRef framework, CFStringRef resource) {
CFBundleRef bundle = CFBundleGetBundleWithIdentifier(framework);
CFURLRef grammarUrl = CFBundleCopyResourceURL(bundle, resource, nullptr, nullptr);
CFURLRef grammarUrlDirectory = CFURLCreateCopyDeletingLastPathComponent(nullptr, grammarUrl);
CFStringRef grammarPath = CFURLCopyFileSystemPath(grammarUrlDirectory, kCFURLPOSIXPathStyle);
CFURLRef resourceUrl = CFBundleCopyResourceURL(bundle, resource, nullptr, nullptr);
CFURLRef resourceUrlDirectory = CFURLCreateCopyDeletingLastPathComponent(nullptr, resourceUrl);
CFStringRef resourcePath = CFURLCopyFileSystemPath(resourceUrlDirectory, kCFURLPOSIXPathStyle);
CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
std::string path(CFStringGetCStringPtr(grammarPath, encodingMethod));
CFRelease(grammarUrl);
CFRelease(grammarPath);
CFRelease(grammarUrlDirectory);
string path(CFStringGetCStringPtr(resourcePath, encodingMethod));
CFRelease(resourceUrl);
CFRelease(resourcePath);
CFRelease(resourceUrlDirectory);
return path;
}
......
Markdown is supported
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