summaryrefslogtreecommitdiffstats
path: root/project
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2015-03-04 00:23:39 +0100
committermanuel <manuel@mausz.at>2015-03-04 00:23:39 +0100
commit9d11b08ad61b1f0d6d7023ce403285d8662efaed (patch)
tree5bc0c947d9e10d3e8c9dc1e6b26f3d6599f0cea1 /project
parentc159d9f91f1573901868100a9464527a5a71575b (diff)
downloadkodi-pvr-build-9d11b08ad61b1f0d6d7023ce403285d8662efaed.tar.gz
kodi-pvr-build-9d11b08ad61b1f0d6d7023ce403285d8662efaed.tar.bz2
kodi-pvr-build-9d11b08ad61b1f0d6d7023ce403285d8662efaed.zip
sync with upstream
Diffstat (limited to 'project')
-rw-r--r--project/cmake/addons/CMakeLists.txt151
-rw-r--r--project/cmake/addons/README12
-rw-r--r--project/cmake/kodi-config.cmake.in2
3 files changed, 107 insertions, 58 deletions
diff --git a/project/cmake/addons/CMakeLists.txt b/project/cmake/addons/CMakeLists.txt
index 0afc622..83f424a 100644
--- a/project/cmake/addons/CMakeLists.txt
+++ b/project/cmake/addons/CMakeLists.txt
@@ -73,6 +73,11 @@ set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
73 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} 73 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
74 -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}) 74 -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS})
75 75
76if(MSVC)
77 # move cmake specific targets to a CMakePredefinedTargets folder in Visual Studio
78 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
79endif()
80
76if(PACKAGE_ZIP) 81if(PACKAGE_ZIP)
77 # needed for project installing 82 # needed for project installing
78 list(APPEND BUILD_ARGS -DPACKAGE_ZIP=1) 83 list(APPEND BUILD_ARGS -DPACKAGE_ZIP=1)
@@ -92,6 +97,10 @@ else()
92 separate_arguments(ADDONS_TO_BUILD) 97 separate_arguments(ADDONS_TO_BUILD)
93endif() 98endif()
94 99
100if(ADDON_SRC_PREFIX)
101 message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}")
102endif()
103
95if(NOT KODI_LIB_DIR) 104if(NOT KODI_LIB_DIR)
96 set(KODI_LIB_DIR "${DEPENDS_PATH}/lib/kodi") 105 set(KODI_LIB_DIR "${DEPENDS_PATH}/lib/kodi")
97else() 106else()
@@ -160,81 +169,113 @@ foreach(addon ${addons})
160 list(GET def 1 url) 169 list(GET def 1 url)
161 170
162 set(archive_name ${id}) 171 set(archive_name ${id})
172 if(ADDON_SRC_PREFIX)
173 set(SOURCE_DIR ${ADDON_SRC_PREFIX}/${id})
174 set(archive_name "")
175 else()
176 set(SOURCE_DIR "")
177 endif()
163 178
164 # if there is a 3rd parameter in the file, we consider it a git revision 179 # if there is a 3rd parameter in the file, we consider it a git revision
165 if(deflength GREATER 2) 180 if(deflength GREATER 2 AND "${SOURCE_DIR}" STREQUAL "")
166 list(GET def 2 revision) 181 list(GET def 2 revision)
167 182
168 # Note: downloading specific revisions via http in the format below is probably github specific 183 # Note: downloading specific revisions via http in the format below is probably github specific
169 # if we ever use other repositories, this might need adapting 184 # if we ever use other repositories, this might need adapting
170 set(url ${url}/archive/${revision}.tar.gz) 185 set(url ${url}/archive/${revision}.tar.gz)
171 set(archive_name ${archive_name}-${revision}) 186 set(archive_name ${archive_name}-${revision})
172 endif() 187 elseif("${SOURCE_DIR}" STREQUAL "")
188 # check if the URL starts with file://
189 string(REGEX MATCH "^file://.*$" local_url "${url}")
173 190
174 # download and extract the addon 191 #if not we assume this to be a local directory
175 if(NOT EXISTS ${BUILD_DIR}/download/${archive_name}.tar.gz) 192 if(local_url)
176 # cleanup any of the previously downloaded archives of this addon 193 # this is not an archive
177 file(GLOB archives "${BUILD_DIR}/download/${id}*.tar.gz") 194 set(archive_name "")
178 if(archives) 195
179 message(STATUS "Removing old archives of ${id}: ${archives}") 196 # remove the file:// protocol from the URL
180 file(REMOVE ${archives}) 197 string(REPLACE "file://" "" SOURCE_DIR "${url}")
181 endif()
182 198
183 # download the addon 199 # on win32 we may have to remove another leading /
184 file(DOWNLOAD "${url}" "${BUILD_DIR}/download/${archive_name}.tar.gz" STATUS dlstatus LOG dllog SHOW_PROGRESS) 200 if(WIN32)
185 list(GET dlstatus 0 retcode) 201 # check if the path is a local path
186 if(NOT ${retcode} EQUAL 0) 202 string(REGEX MATCH "^/.*$" local_path "${SOURCE_DIR}")
187 message(FATAL_ERROR "ERROR downloading ${url} - status: ${dlstatus} log: ${dllog}") 203 if(local_path)
204 string(SUBSTRING "${SOURCE_DIR}" 1 -1 SOURCE_DIR)
205 endif()
206 endif()
188 endif() 207 endif()
189 endif() 208 endif()
190 209
191 # remove any previously extracted version of the addon 210 # download the addon if necessary
192 if(EXISTS "${BUILD_DIR}/${id}") 211 if(NOT "${archive_name}" STREQUAL "")
193 file(REMOVE_RECURSE "${BUILD_DIR}/${id}") 212 # download and extract the addon
194 endif() 213 if(NOT EXISTS ${BUILD_DIR}/download/${archive_name}.tar.gz)
214 # cleanup any of the previously downloaded archives of this addon
215 file(GLOB archives "${BUILD_DIR}/download/${id}*.tar.gz")
216 if(archives)
217 message(STATUS "Removing old archives of ${id}: ${archives}")
218 file(REMOVE ${archives})
219 endif()
195 220
196 # extract the addon from the archive 221 # download the addon
197 execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${BUILD_DIR}/download/${archive_name}.tar.gz 222 file(DOWNLOAD "${url}" "${BUILD_DIR}/download/${archive_name}.tar.gz" STATUS dlstatus LOG dllog SHOW_PROGRESS)
198 WORKING_DIRECTORY ${BUILD_DIR}) 223 list(GET dlstatus 0 retcode)
199 file(GLOB extract_dir "${BUILD_DIR}/${archive_name}*") 224 if(NOT ${retcode} EQUAL 0)
200 if(extract_dir STREQUAL "") 225 message(FATAL_ERROR "ERROR downloading ${url} - status: ${dlstatus} log: ${dllog}")
201 message(FATAL_ERROR "Error extracting ${BUILD_DIR}/download/${archive_name}.tar.gz") 226 endif()
202 else() 227 endif()
203 file(RENAME "${extract_dir}" "${BUILD_DIR}/${id}")
204 endif()
205 228
206 list(APPEND downloaded_addons ${id}) 229 # remove any previously extracted version of the addon
230 if(EXISTS "${BUILD_DIR}/${id}")
231 file(REMOVE_RECURSE "${BUILD_DIR}/${id}")
232 endif()
207 233
208 endif() 234 # extract the addon from the archive
209 endif() 235 execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${BUILD_DIR}/download/${archive_name}.tar.gz
210 endif() 236 WORKING_DIRECTORY ${BUILD_DIR})
211endforeach() 237 file(GLOB extract_dir "${BUILD_DIR}/${archive_name}*")
238 if(extract_dir STREQUAL "")
239 message(FATAL_ERROR "${id}: error extracting ${BUILD_DIR}/download/${archive_name}.tar.gz")
240 else()
241 file(RENAME "${extract_dir}" "${BUILD_DIR}/${id}")
242 endif()
212 243
213foreach(id ${downloaded_addons}) 244 set(SOURCE_DIR ${BUILD_DIR}/${id})
214 externalproject_add(${id} 245 endif()
215 SOURCE_DIR ${BUILD_DIR}/${id} 246
216 INSTALL_DIR ${ADDON_INSTALL_DIR} 247 if(NOT "${SOURCE_DIR}" STREQUAL "" AND EXISTS ${SOURCE_DIR})
217 CMAKE_ARGS ${BUILD_ARGS}) 248 # setup the buildsystem for the addon
249 externalproject_add(${id}
250 SOURCE_DIR ${SOURCE_DIR}
251 INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
252 CMAKE_ARGS ${BUILD_ARGS})
218 253
219 # add a custom step to the external project between the configure and the build step which will always 254 # add a custom step to the external project between the configure and the build step which will always
220 # be executed and therefore forces a re-build of all changed files 255 # be executed and therefore forces a re-build of all changed files
221 externalproject_add_step(${id} forcebuild 256 externalproject_add_step(${id} forcebuild
222 COMMAND ${CMAKE_COMMAND} -E echo "Force build of ${id}" 257 COMMAND ${CMAKE_COMMAND} -E echo "Force build of ${id}"
223 DEPENDEES configure 258 DEPENDEES configure
224 DEPENDERS build 259 DEPENDERS build
225 ALWAYS 1) 260 ALWAYS 1)
226 261
227 # add "kodi-platform" as a dependency to every addon 262 # add "kodi-platform" as a dependency to every addon
228 add_dependencies(${id} kodi-platform) 263 add_dependencies(${id} kodi-platform)
229 264
230 set(${id}_DEPENDS_DIR ${BUILD_DIR}/${id}/depends) 265 set(${id}_DEPENDS_DIR ${SOURCE_DIR}/depends)
231 266
232 if(EXISTS ${${id}_DEPENDS_DIR}) 267 if(EXISTS ${${id}_DEPENDS_DIR})
233 include(${APP_ROOT}/project/cmake/scripts/common/handle-depends.cmake) 268 include(${APP_ROOT}/project/cmake/scripts/common/handle-depends.cmake)
234 add_addon_depends(${id} ${${id}_DEPENDS_DIR}) 269 add_addon_depends(${id} ${${id}_DEPENDS_DIR})
235 if (${id}_DEPS AND NOT "${${id}_DEPS}" STREQUAL "") 270 if(${id}_DEPS AND NOT "${${id}_DEPS}" STREQUAL "")
236 message(STATUS "${id} DEPENDENCIES: ${${id}_DEPS}") 271 message(STATUS "${id} DEPENDENCIES: ${${id}_DEPS}")
237 add_dependencies(${id} ${${id}_DEPS}) 272 add_dependencies(${id} ${${id}_DEPS})
273 endif()
274 endif()
275 else()
276 message(FATAL_ERROR "${id}: invalid or missing addon source directory at ${SOURCE_DIR}")
277 endif()
278 endif()
238 endif() 279 endif()
239 endif() 280 endif()
240endforeach() 281endforeach()
diff --git a/project/cmake/addons/README b/project/cmake/addons/README
index c66e668..b901bb7 100644
--- a/project/cmake/addons/README
+++ b/project/cmake/addons/README
@@ -3,14 +3,19 @@ KODI ADDONS
3This directory contains the cmake-based buildsystem for addons. It looks into 3This directory contains the cmake-based buildsystem for addons. It looks into
4the "addons" sub-directory and parses all *.txt files recursively. Each addon 4the "addons" sub-directory and parses all *.txt files recursively. Each addon
5must have its own <addon-id>.txt file in a separate sub-directory which must 5must have its own <addon-id>.txt file in a separate sub-directory which must
6follow the defined format: 6follow one of the defined format:
7 <addon-id> <git-url> <git-revision> 7 <addon-id> <git-url> <git-revision>
8 <addon-id> <tarball-url>
9 <addon-id> <file://path>
8where 10where
9 * <addon-id> must be identical to the addon's ID as defined in the addon's 11 * <addon-id> must be identical to the addon's ID as defined in the addon's
10 addon.xml 12 addon.xml
11 * <git-url> must be the URL of the git repository containing the addon. 13 * <git-url> must be the URL of the git repository containing the addon
12 * <git-revision> must be a valid git tag/branch/commit in the addon's git 14 * <git-revision> must be a valid git tag/branch/commit in the addon's git
13 repository which will be used for the build. 15 repository which will be used for the build.
16 * <tarball-url> must be the URL to a .tar.gz tarball containing the addon
17 * <file://path> must be a file:// based path to the directory containing the
18 addon
14 19
15Reserved filenames (for additional information on how to build an addon) 20Reserved filenames (for additional information on how to build an addon)
16are: 21are:
@@ -24,6 +29,9 @@ executing cmake with the -D<variable-name>=<value> option) to e.g. access
24specific paths: 29specific paths:
25 * ADDONS_TO_BUILD is a quoted, space delimited list of <addon-id>s that 30 * ADDONS_TO_BUILD is a quoted, space delimited list of <addon-id>s that
26 you want to build (default is "all"). 31 you want to build (default is "all").
32 * ADDON_SRC_PREFIX can be used to override the addon repository location.
33 It must point to the locally available parent directory of the addon(s) to build
34 <addon-id> will be appended to this path automatically
27 * CMAKE_BUILD_TYPE specifies the type of the build. This can be either "Debug" 35 * CMAKE_BUILD_TYPE specifies the type of the build. This can be either "Debug"
28 or "Release" (default is "Release"). 36 or "Release" (default is "Release").
29 * CMAKE_INSTALL_PREFIX points to the directory where the built addons and their 37 * CMAKE_INSTALL_PREFIX points to the directory where the built addons and their
diff --git a/project/cmake/kodi-config.cmake.in b/project/cmake/kodi-config.cmake.in
index 0e3b158..118d723 100644
--- a/project/cmake/kodi-config.cmake.in
+++ b/project/cmake/kodi-config.cmake.in
@@ -6,6 +6,6 @@ IF(NOT WIN32)
6 SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@") 6 SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@")
7ENDIF() 7ENDIF()
8LIST(APPEND CMAKE_MODULE_PATH @prefix@/lib/kodi) 8LIST(APPEND CMAKE_MODULE_PATH @prefix@/lib/kodi)
9ADD_DEFINITIONS(@ARCH_DEFINES@) 9ADD_DEFINITIONS(@ARCH_DEFINES@ -DBUILD_KODI_ADDON)
10 10
11include(addon-helpers) 11include(addon-helpers)