From 09826ab84fa84d244c6747e309d07febaa5a7085 Mon Sep 17 00:00:00 2001 From: wsnipex Date: Tue, 3 Mar 2015 11:04:12 +0100 Subject: [PATCH] cmake: allow to override local addon location via ADDON_SRC_PREFIX --- project/cmake/addons/CMakeLists.txt | 17 +++++++++++++---- project/cmake/addons/README | 3 +++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/project/cmake/addons/CMakeLists.txt b/project/cmake/addons/CMakeLists.txt index 6b22fa2e230c5..0dad18d675fca 100644 --- a/project/cmake/addons/CMakeLists.txt +++ b/project/cmake/addons/CMakeLists.txt @@ -92,6 +92,10 @@ else() separate_arguments(ADDONS_TO_BUILD) endif() +if(ADDON_SRC_PREFIX) + message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}") +endif() + if(NOT KODI_LIB_DIR) set(KODI_LIB_DIR "${DEPENDS_PATH}/lib/kodi") else() @@ -160,17 +164,22 @@ foreach(addon ${addons}) list(GET def 1 url) set(archive_name ${id}) - set(SOURCE_DIR "") + if(ADDON_SRC_PREFIX) + set(SOURCE_DIR ${ADDON_SRC_PREFIX}/${id}) + set(archive_name "") + else() + set(SOURCE_DIR "") + endif() - # if there is a 3rd parameter in the file, we consider it a git revision - if(deflength GREATER 2) + # if there is a 3rd parameter in the file, we consider it a git revision + if(deflength GREATER 2 AND "${SOURCE_DIR}" STREQUAL "") list(GET def 2 revision) # Note: downloading specific revisions via http in the format below is probably github specific # if we ever use other repositories, this might need adapting set(url ${url}/archive/${revision}.tar.gz) set(archive_name ${archive_name}-${revision}) - else() + elseif("${SOURCE_DIR}" STREQUAL "") # check if the URL starts with file:// string(REGEX MATCH "^file://.*$" local_url "${url}") diff --git a/project/cmake/addons/README b/project/cmake/addons/README index 2e6b46ad4424f..b901bb7a7b748 100644 --- a/project/cmake/addons/README +++ b/project/cmake/addons/README @@ -29,6 +29,9 @@ executing cmake with the -D= option) to e.g. access specific paths: * ADDONS_TO_BUILD is a quoted, space delimited list of s that you want to build (default is "all"). + * ADDON_SRC_PREFIX can be used to override the addon repository location. + It must point to the locally available parent directory of the addon(s) to build + will be appended to this path automatically * CMAKE_BUILD_TYPE specifies the type of the build. This can be either "Debug" or "Release" (default is "Release"). * CMAKE_INSTALL_PREFIX points to the directory where the built addons and their