summaryrefslogtreecommitdiffstats
path: root/project/cmake/scripts/common/PrepareEnv.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'project/cmake/scripts/common/PrepareEnv.cmake')
-rw-r--r--project/cmake/scripts/common/PrepareEnv.cmake47
1 files changed, 9 insertions, 38 deletions
diff --git a/project/cmake/scripts/common/PrepareEnv.cmake b/project/cmake/scripts/common/PrepareEnv.cmake
index 8e02382..51be739 100644
--- a/project/cmake/scripts/common/PrepareEnv.cmake
+++ b/project/cmake/scripts/common/PrepareEnv.cmake
@@ -51,43 +51,14 @@ foreach(binding ${bindings})
51 configure_file(${CORE_SOURCE_DIR}/${header} ${APP_INCLUDE_DIR} COPYONLY) 51 configure_file(${CORE_SOURCE_DIR}/${header} ${APP_INCLUDE_DIR} COPYONLY)
52endforeach() 52endforeach()
53 53
54### on windows we need a "patch" binary to be able to patch 3rd party sources 54### processing additional tools required by the platform
55if(WIN32) 55if(EXISTS ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/)
56 find_program(PATCH_FOUND NAMES patch patch.exe) 56 file(GLOB platform_tools ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/*.cmake)
57 if(PATCH_FOUND) 57 foreach(platform_tool ${platform_tools})
58 message(STATUS "patch utility found at ${PATCH_FOUND}") 58 get_filename_component(platform_tool_name ${platform_tool} NAME_WE)
59 else() 59 message(STATUS "Processing ${CORE_SYSTEM_NAME} specific tool: ${platform_tool_name}")
60 set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-3")
61 set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip")
62 set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}")
63 set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE})
64 60
65 # download the archive containing patch.exe 61 # include the file
66 message(STATUS "Downloading patch utility from ${PATCH_URL}...") 62 include(${platform_tool})
67 file(DOWNLOAD "${PATCH_URL}" "${PATCH_DOWNLOAD}" STATUS PATCH_DL_STATUS LOG PATCH_LOG SHOW_PROGRESS) 63 endforeach()
68 list(GET PATCH_DL_STATUS 0 PATCH_RETCODE)
69 if(NOT ${PATCH_RETCODE} EQUAL 0)
70 message(FATAL_ERROR "ERROR downloading ${PATCH_URL} - status: ${PATCH_DL_STATUS} log: ${PATCH_LOG}")
71 endif()
72
73 # extract the archive containing patch.exe
74 execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${PATCH_DOWNLOAD}
75 WORKING_DIRECTORY ${BUILD_DIR})
76
77 # make sure the extraction worked and that patch.exe is there
78 set(PATCH_PATH ${BUILD_DIR}/${PATCH_ARCHIVE_NAME})
79 set(PATCH_BINARY_PATH ${PATCH_PATH}/bin/patch.exe)
80 if(NOT EXISTS ${PATCH_PATH} OR NOT EXISTS ${PATCH_BINARY_PATH})
81 message(FATAL_ERROR "ERROR extracting patch utility from ${PATCH_DOWNLOAD_DIR}")
82 endif()
83
84 # copy patch.exe into the output directory
85 file(INSTALL ${PATCH_BINARY_PATH} DESTINATION ${ADDON_DEPENDS_PATH}/bin)
86
87 # make sure that cmake can find the copied patch.exe
88 find_program(PATCH_FOUND NAMES patch patch.exe)
89 if(NOT PATCH_FOUND)
90 message(FATAL_ERROR "ERROR installing patch utility from ${PATCH_BINARY_PATH} to ${ADDON_DEPENDS_PATH}/bin")
91 endif()
92 endif()
93endif() 64endif()