summaryrefslogtreecommitdiffstats
path: root/project/cmake/scripts/common/PrepareEnv.cmake
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2016-12-14 02:24:46 +0100
committermanuel <manuel@mausz.at>2016-12-14 02:24:46 +0100
commita662ba767a6444b76b0394eb60380eee3e839db7 (patch)
treea13d904b75e8d899e2b11df3db5bd2a8a47b0acb /project/cmake/scripts/common/PrepareEnv.cmake
parent2818eb9609d118212211cd657134974f10428b31 (diff)
downloadkodi-pvr-build-a662ba767a6444b76b0394eb60380eee3e839db7.tar.gz
kodi-pvr-build-a662ba767a6444b76b0394eb60380eee3e839db7.tar.bz2
kodi-pvr-build-a662ba767a6444b76b0394eb60380eee3e839db7.zip
Sync with Krypton branch
Diffstat (limited to 'project/cmake/scripts/common/PrepareEnv.cmake')
-rw-r--r--project/cmake/scripts/common/PrepareEnv.cmake47
1 files changed, 38 insertions, 9 deletions
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})
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### processing additional tools required by the platform 54### on windows we need a "patch" binary to be able to patch 3rd party sources
55if(EXISTS ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/) 55if(WIN32)
56 file(GLOB platform_tools ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/*.cmake) 56 find_program(PATCH_FOUND NAMES patch patch.exe)
57 foreach(platform_tool ${platform_tools}) 57 if(PATCH_FOUND)
58 get_filename_component(platform_tool_name ${platform_tool} NAME_WE) 58 message(STATUS "patch utility found at ${PATCH_FOUND}")
59 message(STATUS "Processing ${CORE_SYSTEM_NAME} specific tool: ${platform_tool_name}") 59 else()
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})
60 64
61 # include the file 65 # download the archive containing patch.exe
62 include(${platform_tool}) 66 message(STATUS "Downloading patch utility from ${PATCH_URL}...")
63 endforeach() 67 file(DOWNLOAD "${PATCH_URL}" "${PATCH_DOWNLOAD}" STATUS PATCH_DL_STATUS LOG PATCH_LOG SHOW_PROGRESS)
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()
64endif() 93endif()