Commit 64982b9e authored by François Grisez's avatar François Grisez
Browse files

Rework the way of dealing with binary dependencies in the Linphone SDK on MacOSX

IDs of libavcodec, libavutil, libswresample, libswscale and libopenh264
are rewrote after they are installed in the OUTPUT directory instead of
at package generation time. Thus, the correct IDs are used while compiling
libraries which depend of these.
parent 8da7d5ab
......@@ -32,3 +32,25 @@ endif()
if(EXISTS ${INSTALL_PREFIX}/lib/swscale-2.def)
execute_process(COMMAND "lib" "/def:${INSTALL_PREFIX}/lib/swscale-2.def" "/out:${INSTALL_PREFIX}/lib/swscale.lib" "/machine:X86")
endif()
if(APPLE AND NOT IOS)
execute_process(COMMAND install_name_tool
-id @rpath/libavcodec.53.61.100.dylib
-change ${INSTALL_PREFIX}/lib/libavutil.51.35.100.dylib @rpath/libavutil.51.35.100.dylib
${INSTALL_PREFIX}/lib/libavcodec.53.61.100.dylib
)
execute_process(COMMAND install_name_tool
-id @rpath/libavutil.51.35.100.dylib
${INSTALL_PREFIX}/lib/libavutil.51.35.100.dylib
)
execute_process(COMMAND install_name_tool
-id @rpath/libswresample.0.6.100.dylib
-change ${INSTALL_PREFIX}/lib/libavutil.51.35.100.dylib @rpath/libavutil.51.35.100.dylib
${INSTALL_PREFIX}/lib/libswresample.0.6.100.dylib
)
execute_process(COMMAND install_name_tool
-id @rpath/libswscale.2.1.100.dylib
-change ${INSTALL_PREFIX}/lib/libavutil.51.35.100.dylib @rpath/libavutil.51.35.100.dylib
${INSTALL_PREFIX}/lib/libswscale.2.1.100.dylib
)
endif()
......@@ -26,3 +26,8 @@ endif()
if(EXISTS ${INSTALL_PREFIX}/bin/openh264.dll)
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "${SOURCE_DIR}/cmake/importlib.py" "${INSTALL_PREFIX}/bin/openh264.dll" "${INSTALL_PREFIX}/lib/openh264.lib")
endif()
if(APPLE AND NOT IOS)
execute_process(COMMAND install_name_tool -id @rpath/libopenh264.0.dylib ${INSTALL_PREFIX}/lib/libopenh264.0.dylib)
endif()
......@@ -43,47 +43,36 @@ list(GET SPLITTED_LINPHONE_VERSION 1 LINPHONE_MINOR_VERSION)
list(GET SPLITTED_LINPHONE_VERSION 2 LINPHONE_MICRO_VERSION)
set(PACKAGE_VERSION "${LINPHONE_VERSION}")
# Translates absolute internal dependency path of FFMepeg libraries into relative path on MacOSX
# Preparing the Linphone SDK bundle
if(APPLE)
set(LINPHONE_SDK_TMP ${CMAKE_CURRENT_BINARY_DIR}/linphone-sdk-tmp)
file(REMOVE_RECURSE ${LINPHONE_SDK_TMP})
file(COPY ${LINPHONE_OUTPUT_DIR} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/OUTPUT ${LINPHONE_SDK_TMP})
set(RPATH_CHANGE_CMDS
-change ${LINPHONE_OUTPUT_DIR}/lib/libavcodec.53.61.100.dylib @rpath/libavcodec.53.61.100.dylib
-change ${LINPHONE_OUTPUT_DIR}/lib/libavutil.51.35.100.dylib @rpath/libavutil.51.35.100.dylib
-change ${LINPHONE_OUTPUT_DIR}/lib/libswscale.2.1.100.dylib @rpath/libswscale.2.1.100.dylib
-change ${LINPHONE_OUTPUT_DIR}/lib/libswresample.0.6.100.dylib @rpath/libswresample.0.6.100.dylib
-change ${LINPHONE_OUTPUT_DIR}/lib/libopenh264.0.dylib @rpath/libopenh264.0.dylib
-change /opt/local/lib/libintl.8.dylib @rpath/libintl.8.dylib
-change /opt/local/lib/libiconv.2.dylib @rpath/libiconv.2.dylib
-change /lib/libopenh264.0.dylib @rpath/libopenh264.0.dylib
)
set(RPATH_LIBS_TO_MODIFY
libavcodec.53.61.100.dylib
libavutil.51.35.100.dylib
liblinphone.7.dylib
libmediastreamer_voip.5.dylib
libswresample.0.6.100.dylib
libswscale.2.1.100.dylib
mediastreamer/plugins/libmsamr.dylib
mediastreamer/plugins/libmsbcg729.dylib
mediastreamer/plugins/libmsilbc.dylib
mediastreamer/plugins/libmsopenh264.dylib
mediastreamer/plugins/libmssilk.dylib
mediastreamer/plugins/libmswebrtc.dylib
file(COPY
/opt/local/lib/libintl.8.dylib
/opt/local/lib/libintl.dylib
/opt/local/lib/libiconv.dylib
/opt/local/lib/libiconv.2.dylib
DESTINATION ${LINPHONE_SDK_TMP}/lib
)
foreach(LIB_TO_CHANGE ${RPATH_LIBS_TO_MODIFY})
execute_process(
COMMAND install_name_tool ${RPATH_CHANGE_CMDS} ${LINPHONE_SDK_TMP}/lib/${LIB_TO_CHANGE}
COMMAND install_name_tool -id @rpath/${LIB_TO_CHANGE} ${LINPHONE_SDK_TMP}/lib/${LIB_TO_CHANGE}
COMMAND install_name_tool -delete_rpath ${LINPHONE_OUTPUT_DIR}/lib ${LINPHONE_SDK_TMP}/lib/${LIB_TO_CHANGE}
)
endforeach()
file(COPY /opt/local/lib/libintl.8.dylib /opt/local/lib/libintl.dylib /opt/local/lib/libiconv.dylib /opt/local/lib/libiconv.2.dylib DESTINATION ${LINPHONE_SDK_TMP}/lib)
execute_process(
COMMAND install_name_tool -id @rpath/libintl.8.dylib -change /opt/local/lib/libiconv.2.dylib @rpath/libiconv.2.dylib ${LINPHONE_SDK_TMP}/lib/libintl.8.dylib
COMMAND install_name_tool -id @rpath/libiconv.2.dylib ${LINPHONE_SDK_TMP}/lib/libiconv.2.dylib
execute_process(COMMAND install_name_tool
-id @rpath/libintl.8.dylib
-change /opt/local/lib/libiconv.2.dylib @rpath/libiconv.2.dylib
${LINPHONE_SDK_TMP}/lib/libintl.8.dylib
)
execute_process(COMMAND install_name_tool
-id @rpath/libiconv.2.dylib
${LINPHONE_SDK_TMP}/lib/libiconv.2.dylib
)
execute_process(COMMAND install_name_tool
-change /opt/local/lib/libintl.8.dylib @rpath/libintl.8.dylib
-change /opt/local/lib/libiconv.2.dylib @rpath/libiconv.2.dylib
${LINPHONE_SDK_TMP}/lib/liblinphone.dylib
)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/README.openh264.txt DESTINATION ${LINPHONE_SDK_TMP})
endif()
......
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