From a662ba767a6444b76b0394eb60380eee3e839db7 Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 14 Dec 2016 02:24:46 +0100 Subject: Sync with Krypton branch --- project/cmake/scripts/common/PrepareEnv.cmake | 47 ++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 9 deletions(-) (limited to 'project/cmake/scripts/common/PrepareEnv.cmake') diff --git a/project/cmake/scripts/common/PrepareEnv.cmake b/project/cmake/scripts/common/PrepareEnv.cmake index 51be739..8e02382 100644 --- a/project/cmake/scripts/common/PrepareEnv.cmake +++ b/project/cmake/scripts/common/PrepareEnv.cmake @@ -51,14 +51,43 @@ foreach(binding ${bindings}) configure_file(${CORE_SOURCE_DIR}/${header} ${APP_INCLUDE_DIR} COPYONLY) endforeach() -### processing additional tools required by the platform -if(EXISTS ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/) - file(GLOB platform_tools ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/*.cmake) - foreach(platform_tool ${platform_tools}) - get_filename_component(platform_tool_name ${platform_tool} NAME_WE) - message(STATUS "Processing ${CORE_SYSTEM_NAME} specific tool: ${platform_tool_name}") +### on windows we need a "patch" binary to be able to patch 3rd party sources +if(WIN32) + find_program(PATCH_FOUND NAMES patch patch.exe) + if(PATCH_FOUND) + message(STATUS "patch utility found at ${PATCH_FOUND}") + else() + set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-3") + set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip") + set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}") + set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE}) - # include the file - include(${platform_tool}) - endforeach() + # download the archive containing patch.exe + message(STATUS "Downloading patch utility from ${PATCH_URL}...") + file(DOWNLOAD "${PATCH_URL}" "${PATCH_DOWNLOAD}" STATUS PATCH_DL_STATUS LOG PATCH_LOG SHOW_PROGRESS) + list(GET PATCH_DL_STATUS 0 PATCH_RETCODE) + if(NOT ${PATCH_RETCODE} EQUAL 0) + message(FATAL_ERROR "ERROR downloading ${PATCH_URL} - status: ${PATCH_DL_STATUS} log: ${PATCH_LOG}") + endif() + + # extract the archive containing patch.exe + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${PATCH_DOWNLOAD} + WORKING_DIRECTORY ${BUILD_DIR}) + + # make sure the extraction worked and that patch.exe is there + set(PATCH_PATH ${BUILD_DIR}/${PATCH_ARCHIVE_NAME}) + set(PATCH_BINARY_PATH ${PATCH_PATH}/bin/patch.exe) + if(NOT EXISTS ${PATCH_PATH} OR NOT EXISTS ${PATCH_BINARY_PATH}) + message(FATAL_ERROR "ERROR extracting patch utility from ${PATCH_DOWNLOAD_DIR}") + endif() + + # copy patch.exe into the output directory + file(INSTALL ${PATCH_BINARY_PATH} DESTINATION ${ADDON_DEPENDS_PATH}/bin) + + # make sure that cmake can find the copied patch.exe + find_program(PATCH_FOUND NAMES patch patch.exe) + if(NOT PATCH_FOUND) + message(FATAL_ERROR "ERROR installing patch utility from ${PATCH_BINARY_PATH} to ${ADDON_DEPENDS_PATH}/bin") + endif() + endif() endif() -- cgit v1.2.3